-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (64 loc) · 2.15 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
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.29.6)
if (NOT EXISTS $ENV{VCPKG_ROOT})
message(FATAL_ERROR "$VCPKG_ROOT is not defined")
endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)
set(Boost_NO_WARN_NEW_VERSIONS 1)
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(VCPKG_LOAD_VCVARS_ENV ON)
project(sparsegrid VERSION 0.0.2)
set(PROJECT_LIB_NAME ${PROJECT_NAME}core)
set(PROJECT_TEST_NAME ${PROJECT_NAME}test)
set(PROJECT_BENCH_NAME ${PROJECT_NAME}perft)
set(PROJECT_MICRO_BENCH_NAME ${PROJECT_NAME}_micro_bench)
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
add_definitions(-DDEV_ENV)
add_definitions(-DTEST_ENV)
message(STATUS "!!!!!11-------!!! " ${CMAKE_CXX_COMPILER_ID})
add_compile_options(-Wall -Wpedantic -Wextra -mavx2)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message(STATUS "Debug build type")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-g -O0
-fsanitize=address
-fno-omit-frame-pointer
-fsanitize-address-destructor=global
-fsanitize-address-globals-dead-stripping
-fsanitize-address-outline-instrumentation
-fsanitize-address-use-after-scope
-fsanitize-link-c++-runtime
-fsanitize-stats
)
add_link_options(-fuse-ld=lld -fsanitize=address)
else ()
add_compile_options(-g -O0
# -fsanitize=address
)
# add_link_options(-fsanitize=address -static-libasan)
endif ()
add_definitions(-DDEBUG)
else()
message(STATUS "Release build type")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-O3
-ffast-math
-flto=full
-finline-functions
-funsafe-math-optimizations
)
add_link_options(-flto=full)
else ()
add_compile_options(-O3
-finline-functions
-funsafe-math-optimizations
-flto
)
endif ()
add_definitions(-DNDEBUG)
endif()
enable_testing()
add_subdirectory(src)
add_subdirectory(tests)
add_subdirectory(perft)