-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (60 loc) · 2.73 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
cmake_minimum_required(VERSION 3.13)
project (Sallow
VERSION 1.0
DESCRIPTION "An algorithm for finding treedepth decompositions.")
# Options that affect libraries as well.
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3 -march=ivybridge -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=ivybridge -DNDEBUG")
add_subdirectory(libs/GSL)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generate compile_commands.json for IDEs.
if (MSVC)
set(W_FLAGS /W4)
else()
set(W_FLAGS -Wall -Wextra -Wpedantic
-Wcast-align
# -Wconversion
# -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-implicit-int-float-conversion # not supported by GCC
-Wfloat-equal
-Wformat=2
# -Wmissing-prototypes # triggers the "extern C" signal handler, which can't be static.
# -Wmissing-declarations # same in GCC
-Woverlength-strings
-Wshadow
-Wunreachable-code
-Wno-sign-compare
-Wno-unused-function)
endif()
add_executable(sallow)
target_sources(sallow PRIVATE src/environment.h
src/flowCutter.h src/flowCutter.cpp
src/graph.h
src/graphUtils.h src/graphUtils.cpp
src/greedy.h src/greedy.cpp
src/io.h src/io.cpp
src/main.cpp
src/mainAlgo.h src/mainAlgo.cpp
src/minHeap.h
src/simpleCutter.h src/simpleCutter.cpp
src/tinyGraphDB.h src/tinyGraphDB.cpp
src/utils.h
src/queue.h)
target_include_directories(sallow PUBLIC "libs/GSL/include/")
target_link_libraries(sallow PUBLIC GSL)
set_property(TARGET sallow PROPERTY CXX_STANDARD 17)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(sallow PRIVATE -O0 -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls ${W_FLAGS})
target_link_options(sallow PRIVATE -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls)
# `target_link_options` requires CMake >= 3.13, otherwise just add this to link_libraries instead
# To enable LeakSanitizer: set -fsanitize=address,leak here and update ASAN_OPTIONS in .vscode/launch.json.
elseif(CMAKE_BUILT_TYPE STREQUAL "RelWithDebInfo")
target_compile_options(sallow PRIVATE -DNDEBUG -O3 -march=ivybridge -DWITHGPERFTOOLS -g -fno-omit-frame-pointer ${W_FLAGS})
target_link_options(sallow PRIVATE -lprofiler -g)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
# Options for submission of static binary to optil.io.
target_compile_options(sallow PRIVATE -DNDEBUG -O3 -march=ivybridge ${W_FLAGS})
target_link_options(sallow PRIVATE -static)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()