Debian Codegraph @

ext/bifrost/CMakeLists.txt

raw ◀ ▶
Source reconstructed at patch state 0 of 3 — not the installed (fully patched) source.
3 Debian patches touch this file
1 cmake_minimum_required(VERSION 3.0.0)
2
3 project(Bifrost)
4
5 find_package(Threads REQUIRED)
6
7 # To enable a larger default k-mer size, replace MAX_KMER_SIZE with a larger multiple of 32: actual maximum k-mer size will be MAX_KMER_SIZE-1.
8 SET(MAX_GMER_SIZE "${MAX_KMER_SIZE}" CACHE STRING "MAX_GMER_SIZE")
9 # Enable architecture optimizations
10 SET(COMPILATION_ARCH "native" CACHE STRING "COMPILATION_ARCH")
11 # Enable AVX2 instructions
12 SET(ENABLE_AVX2 "ON" CACHE STRING "ENABLE_AVX2")
13
14 # Set some default compile flags
15 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
16 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
17
18 set_property(SOURCE BlockedBloomFilter.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -funroll-loops")
19
20
21 #check if we are on arm64 and apple, if so, disable AVX2
22 if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
23 message("Disabling AVX2 instructions on arm64")
24 set(ENABLE_AVX2 "OFF")
25 set(COMPILATION_ARCH "OFF")
26 endif(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
27
28 if(COMPILATION_ARCH MATCHES "OFF")
29 message("Disabling native architecture compilation (including AVX2)")
30 else(COMPILATION_ARCH MATCHES "OFF")
31 message("Compilation architecture: ${COMPILATION_ARCH}")
32 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${COMPILATION_ARCH}")
33 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${COMPILATION_ARCH}")
34 endif(COMPILATION_ARCH MATCHES "OFF")
35
36 if(ENABLE_AVX2 MATCHES "OFF")
37 message("Disabling AVX2 instructions")
38 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mno-avx2")
39 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-avx2")
40 endif(ENABLE_AVX2 MATCHES "OFF")
41
42 # Manages build types
43 if(NOT CMAKE_BUILD_TYPE)
44 set(CMAKE_BUILD_TYPE "Release")
45 endif(NOT CMAKE_BUILD_TYPE)
46
47 if(CMAKE_BUILD_TYPE MATCHES Debug)
48 message("Build type: Debug")
49 add_compile_options(-g)
50 else(CMAKE_BUILD_TYPE MATCHES Debug)
51 if(CMAKE_BUILD_TYPE MATCHES Profile)
52 message("Build type: Profiling")
53 add_compile_options(-pg)
54 set(CMAKE_SHARED_LINKER_FLAGS "-pg")
55 set(CMAKE_EXE_LINKER_FLAGS "-pg")
56 else(CMAKE_BUILD_TYPE MATCHES Profile)
57 message("Build type: Release")
58 add_compile_options(-O3)
59 endif(CMAKE_BUILD_TYPE MATCHES Profile)
60 endif(CMAKE_BUILD_TYPE MATCHES Debug)
61
62 MATH(EXPR PRINT_MAX_KMER_SIZE "${MAX_KMER_SIZE}-1")
63 message("Maximum k-mer size: " ${PRINT_MAX_KMER_SIZE})
64
65 MATH(EXPR PRINT_MAX_GMER_SIZE "${MAX_GMER_SIZE}-1")
66 message("Maximum g-mer size: " ${PRINT_MAX_GMER_SIZE})
67
68 add_subdirectory(src)