-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (47 loc) · 1.88 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required (VERSION 2.8)
project(pid-folding)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(common "-fno-omit-frame-pointer -pg -std=c++17")
set(profiling "-fno-omit-frame-pointer -pg")
set(warnings "-Wall -Wextra -Werror -pedantic")
set(optimizations_debug "-O2")
set(optimizations_release "-O3 -flto -ffast-math")
set(debug "-g")
set(perf_bench "-fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${common} ${debug} ${warnings} ${optimizations_debug}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${common} ${optimizations_release}")
option(WITH_PLOT "Use GNUPLOT to visualize results" ON)
if(WITH_PLOT)
add_definitions(-DPLOT=1)
endif()
# for clang++ use -fuse-ld=gold to avoid LD error "File format not recognized"
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
# set(sanitizer "-fsanitize=address")
# set(sanitizer "-fsanitize=memory")
# set(sanitizer "-fsanitize=memory -fsanitize-memory-track-origins")
# set(sanitizer "-fsanitize=thread")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${sanitizer}")
endif(CMAKE_BUILD_TYPE MATCHES DEBUG)
endif()
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
find_package(Range-V3 REQUIRED)
include_directories(${RANGE-V3_INCLUDE_DIR})
find_package(Hana REQUIRED)
include_directories(${HANA_INCLUDE_DIR})
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
enable_testing()
add_subdirectory(lib)
add_subdirectory(test)
add_subdirectory(src)
if( EXISTS "${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json" )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json
)
endif()