Debian Codegraph @

ext/bifrost/CMakeLists.txt

raw ◀ ▶
Source reconstructed at patch state 1 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_KMER_SIZE "31" CACHE STRING "MAX_KMER_SIZE")
9 SET(MAX_GMER_SIZE "63" CACHE STRING "MAX_GMER_SIZE")
10 # Enable architecture optimizations
11 SET(COMPILATION_ARCH "native" CACHE STRING "COMPILATION_ARCH")
12 # Enable AVX2 instructions
13 SET(ENABLE_AVX2 "ON" CACHE STRING "ENABLE_AVX2")
14
15 # Set some default compile flags
16 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
17 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
18
19 set_property(SOURCE BlockedBloomFilter.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -funroll-loops")
20
21
22 #check if we are on arm64 and apple, if so, disable AVX2
23 if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
24 message("Disabling AVX2 instructions on arm64")
25 set(ENABLE_AVX2 "OFF")
26 set(COMPILATION_ARCH "OFF")
27 endif(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
28
29 if(COMPILATION_ARCH MATCHES "OFF")
30 message("Disabling native architecture compilation (including AVX2)")
31 else(COMPILATION_ARCH MATCHES "OFF")
32 message("Compilation architecture: ${COMPILATION_ARCH}")
33 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${COMPILATION_ARCH}")
34 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${COMPILATION_ARCH}")
35 endif(COMPILATION_ARCH MATCHES "OFF")
36
37 if(ENABLE_AVX2 MATCHES "OFF")
38 message("Disabling AVX2 instructions")
39 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mno-avx2")
40 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-avx2")
41 endif(ENABLE_AVX2 MATCHES "OFF")
42
43 # Manages build types
44 if(NOT CMAKE_BUILD_TYPE)
45 set(CMAKE_BUILD_TYPE "Release")
46 endif(NOT CMAKE_BUILD_TYPE)
47
48 if(CMAKE_BUILD_TYPE MATCHES Debug)
49 message("Build type: Debug")
50 add_compile_options(-g)
51 else(CMAKE_BUILD_TYPE MATCHES Debug)
52 if(CMAKE_BUILD_TYPE MATCHES Profile)
53 message("Build type: Profiling")
54 add_compile_options(-pg)
55 set(CMAKE_SHARED_LINKER_FLAGS "-pg")
56 set(CMAKE_EXE_LINKER_FLAGS "-pg")
57 else(CMAKE_BUILD_TYPE MATCHES Profile)
58 message("Build type: Release")
59 add_compile_options(-O3)
60 endif(CMAKE_BUILD_TYPE MATCHES Profile)
61 endif(CMAKE_BUILD_TYPE MATCHES Debug)
62
63 MATH(EXPR PRINT_MAX_KMER_SIZE "${MAX_KMER_SIZE}-1")
64 message("Maximum k-mer size: " ${PRINT_MAX_KMER_SIZE})
65
66 MATH(EXPR PRINT_MAX_GMER_SIZE "${MAX_GMER_SIZE}-1")
67 message("Maximum g-mer size: " ${PRINT_MAX_GMER_SIZE})
68
69 add_subdirectory(src)