forked from OpenSSE/opensse-schemes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
134 lines (107 loc) · 3.22 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
cmake_minimum_required(VERSION 3.5.1)
project(opensse-schemes VERSION 0.3 DESCRIPTION "OpenSSE's Schemes Implementation")
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/externals/CMake-codecov/cmake"
)
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/externals/sanitizers-cmake/cmake"
)
# Build in Debug mode by default
set(default_build_type "Debug")
# Options
option(opensse_ENABLE_WALL "Enable all warnings" ON)
option(opensse_ENABLE_WEXTRA "Enable extra warnings" ON)
option(opensse_ENABLE_WERROR "Make all warnings into errors" ON)
option(
opensse_OPTIMIZE_FOR_NATIVE_ARCH
"Enable compiler optimizations for the native processor architecture (if available)"
ON
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Load modules
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
# enable code coverage
find_package(codecov)
list(
APPEND
LCOV_REMOVE_PATTERNS
'${CMAKE_CURRENT_SOURCE_DIR}/test/*'
'${CMAKE_CURRENT_SOURCE_DIR}/externals/*'
'${CMAKE_CURRENT_SOURCE_DIR}/third_party/*'
'*/deps/*' # For Travis
'*/usr/*' # For Travis
'*.pb.h'
)
# Find Sanitizers
find_package(Sanitizers)
# We use CMake's integrated testing features
enable_testing()
if(opensse_ENABLE_WALL)
check_cxx_compiler_flag("-Wall" COMPILER_OPT_WALL_SUPPORTED)
if(COMPILER_OPT_WALL_SUPPORTED)
add_compile_options(-Wall)
endif()
endif()
if(opensse_ENABLE_WEXTRA)
check_cxx_compiler_flag("-Wextra" COMPILER_OPT_WEXTRA_SUPPORTED)
if(COMPILER_OPT_WEXTRA_SUPPORTED)
add_compile_options(-Wextra)
endif()
endif()
if(opensse_ENABLE_WERROR)
check_cxx_compiler_flag("-Werror" COMPILER_OPT_WERROR_SUPPORTED)
if(COMPILER_OPT_WERROR_SUPPORTED)
add_compile_options(
-Werror -Wno-error=unknown-pragmas -Wno-error=unused-function
)
endif()
endif()
if(opensse_OPTIMIZE_FOR_NATIVE_ARCH)
check_cxx_compiler_flag("-march=native" COMPILER_OPT_ARCH_NATIVE_SUPPORTED)
if(COMPILER_OPT_ARCH_NATIVE_SUPPORTED)
add_compile_options(-march=native)
endif()
endif()
# Go for external dependencies
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(RocksDB REQUIRED)
find_package(Protobuf)
find_package(GRPC)
message(STATUS "Protoc path: " ${Protobuf_PROTOC_EXECUTABLE})
message(STATUS "GRPC plugin path: " ${GRPC_CPP_PLUGIN})
# Import spdlog
add_subdirectory(externals/spdlog)
# Disable memory locks because of race conditions.
set(ENABLE_MEMORY_LOCK
OFF
CACHE BOOL "Disable Memory Lock" FORCE
)
add_subdirectory(third_party/crypto/src)
add_subdirectory(third_party/db-parser/src)
add_subdirectory(lib)
add_coverage(schemes)
add_coverage(runners)
add_sanitizers(schemes)
add_sanitizers(runners)
add_subdirectory(src)
foreach(runner ${runner_bins})
add_sanitizers(${runner})
endforeach(runner ${runner_bins})
# Build googletest for the tests
set(BUILD_GMOCK
OFF
CACHE BOOL "Disable GMock" FORCE
)
add_subdirectory(externals/googletest)
add_subdirectory(test)
add_coverage(check)
add_sanitizers(check)
add_sanitizers(sophos_debug)
add_sanitizers(diana_debug)
add_sanitizers(janus_debug)
# add_sanitizers(oceanus_debug)
add_sanitizers(tethys_core_debug)
add_sanitizers(tethys_debug)
add_sanitizers(pluto_debug)
coverage_evaluate()