-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
47 lines (37 loc) · 1.42 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
cmake_minimum_required(VERSION 3.10)
project(BigAnn)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(OpenMP REQUIRED)
set (CMAKE_CXX_FLAGS "-O3 ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -fPIC")
find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
# -march=native: https://stackoverflow.com/a/54032969/10971650, https://stackoverflow.com/questions/3015306/what-exactly-does-march-native-do
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -fPIC")
endif()
# Log with I/O statistics doing profiling
set(IOPERF 1)
if (IOPERF)
add_compile_options(-DIOPERF=1)
message(STATUS "Optional Flag DIOPERF is ON: to do IO Perf")
endif(IOPERF)
# Refine with Unix IO & O_DIRECT
set(DIRECTIO 1)
if (DIRECTIO)
add_compile_options(-DDIRECTIO=1)
message(STATUS "Optional Flag DIRECTIO is ON: to do DIRECT IO: O_DIRECT")
endif(DIRECTIO)
add_compile_options(-march=native -O3)
include_directories(include)
add_compile_options(-march=native)
add_subdirectory(src)
# add_subdirectory(test)
# add_subdirectory(scripts)