-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
110 lines (81 loc) · 3.51 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
cmake_minimum_required(VERSION 3.4)
project(CPP_SCHEDULER)
if(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS True)
endif()
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
if(NOT MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes")
else()
add_definitions( "/wd4251 /wd4275" )
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage -std=c++11 -Wno-attributes -fno-inline -fno-inline-small-functions -fno-default-inline")
set(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
add_custom_target(coverage COMMAND find . -iname "*.gcno" | xargs gcov -s ${CPP_SCHEDULER_SOURCE_DIR})
endif()
set(CPP_SCHEDULER_BUILD_AUTO_UPDATE_DEPENDENCIES TRUE CACHE BOOL "If enabled, dependencies will be automatically updated using the cmake script")
set(THIRD_PARTY_DIRECTORY ${CPP_SCHEDULER_SOURCE_DIR}/ThirdParty CACHE STRING "Path to the folder where third-party libraries will be installed")
set(THIRD_PARTY_PACKAGES_DIRECTORY ${CPP_SCHEDULER_SOURCE_DIR}/ThirdPartyPackages CACHE STRING "Path to the folder where third-party packages will be downloaded")
set(CPP_SCHEDULER_BUILD_ENABLE_COTIRE FALSE CACHE BOOL "If enabled, precompiled headers and unity builds will be enabled (provided by Cotire)")
set(CPP_SCHEDULER_BUILD_ENABLE_IWYU FALSE CACHE BOOL "If enabled, google include-what-you-use (if present) will be used during the build to suggest includes optimizations")
set(CPP_SCHEDULER_BENCHMARK_DATA_DIRECTORY CACHE PATH "Path to the benchmark data directory")
set(CPP_SCHEDULER_ENGINE TRUE CACHE BOOL "If enabled, engine will be built")
set(CPP_SCHEDULER_PERSISTENCE TRUE CACHE BOOL "If enabled, loaders and persisters will be built")
set(CPP_SCHEDULER_SERVICES TRUE CACHE BOOL "If enabled, services like routing will be built")
set(CPP_SCHEDULER_TOOLS TRUE CACHE BOOL "If enabled, utilitary tools will be built")
set(CPP_SCHEDULER_TESTS FALSE CACHE BOOL "If enabled, tests will be built")
if(CPP_SCHEDULER_BUILD_AUTO_UPDATE_DEPENDENCIES)
include(PrepareDeps.cmake)
UpdateDependencies()
endif()
include(InstallUtils.cmake)
include_directories(${CATCH_ROOT})
include_directories(${SPDLOG_ROOT}/include)
include_directories(${BOOST_INCLUDEDIR})
include_directories(${LIBXML2_ROOT}/include)
include_directories(${CIMG_ROOT})
if(CPP_SCHEDULER_BENCHMARK_DATA_DIRECTORY)
message(STATUS "Benchmarks data directory is set: ${CPP_SCHEDULER_BENCHMARK_DATA_DIRECTORY}")
set(CPP_SCHEDULER_TESTS_BENCHMARKS TRUE CACHE BOOL "If enabled, benchmarks will be built")
else()
message(STATUS "Benchmarks data directory is unset. Benchmarks are unavaiable.")
endif()
cmake_policy(SET CMP0054 OLD)
cmake_policy(SET CMP0042 OLD)
include_directories(${CPP_SCHEDULER_SOURCE_DIR})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions("-DDEBUG_LOGGING")
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(CPP_SCHEDULER_TESTS)
enable_testing()
endif()
if(CPP_SCHEDULER_BUILD_ENABLE_COTIRE)
include(${COTIRE_ROOT}/cotire.cmake)
else()
macro(cotire)
endmacro()
endif()
if(CPP_SCHEDULER_ENGINE)
add_subdirectory(Engine)
endif()
if(CPP_SCHEDULER_SERVICES)
add_subdirectory(Services)
endif()
if(CPP_SCHEDULER_PERSISTENCE)
add_subdirectory(Persistence)
endif()
if(CPP_SCHEDULER_TOOLS)
add_subdirectory(Tools)
endif()
if(CPP_SCHEDULER_TESTS_BENCHMARKS)
add_subdirectory(Benchmarks)
endif()