-
Notifications
You must be signed in to change notification settings - Fork 26
/
CMakeLists.txt
89 lines (71 loc) · 2.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
cmake_minimum_required(VERSION 3.22)
project(FIRESTARTER)
enable_testing()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
include(cmake/GitSubmoduleUpdate.cmake)
# set FIRESTARTER version
find_package(Git)
if(Git_FOUND)
_is_git(${CMAKE_CURRENT_SOURCE_DIR} IN_GIT)
endif()
SET (_FIRESTARTER_VERSION_TEMPERED OFF)
SET(_FIRESTARTER_VERSION_STRING "default" CACHE STRING "_FIRESTARTER_VERSION_STRING should not be used if you do not know what to do.")
if("${_FIRESTARTER_VERSION_STRING}" STREQUAL "default")
if (IN_GIT)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --tags --dirty
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _FIRESTARTER_VERSION_STRING
)
string(STRIP ${_FIRESTARTER_VERSION_STRING} _FIRESTARTER_VERSION_STRING)
else()
message(AUTHOR_WARNING "Cannot detect FIRESTARTER version.")
SET(_FIRESTARTER_VERSION_STRING "unknown")
endif()
else()
SET (_FIRESTARTER_VERSION_TEMPERED ON)
endif()
add_compile_definitions(_FIRESTARTER_VERSION_STRING="${_FIRESTARTER_VERSION_STRING}")
SET(_FIRESTARTER_BUILD_YEAR "default" CACHE STRING "_FIRESTARTER_BUILD_YEAR should not be used if you do not know what to do.")
if("${_FIRESTARTER_BUILD_YEAR}" STREQUAL "default")
if(IN_GIT)
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=%ci HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _FIRESTARTER_BUILD_YEAR
)
string(SUBSTRING ${_FIRESTARTER_BUILD_YEAR} 0 4 _FIRESTARTER_BUILD_YEAR)
else()
message(AUTHOR_WARNING "Cannot detect FIRESTARTER build year.")
SET(_FIRESTARTER_BUILD_YEAR "unknown")
endif()
else()
SET (_FIRESTARTER_VERSION_TEMPERED ON)
endif()
add_compile_definitions(_FIRESTARTER_BUILD_YEAR="${_FIRESTARTER_BUILD_YEAR}")
if(_FIRESTARTER_VERSION_TEMPERED)
add_compile_definitions(_FIRESTARTER_VERSION_TEMPERED)
endif()
# init git submodules
include(cmake/GitSubmoduleUpdate.cmake)
git_submodule_update()
include(cmake/BuildOptions.cmake)
include(cmake/BuildSettings.cmake)
include(cmake/DarwinBuild.cmake)
if(NOT DEFINED ASMJIT_STATIC)
set(ASMJIT_STATIC TRUE)
endif()
add_subdirectory(lib/asmjit)
add_subdirectory(lib/nitro)
include_directories(include)
include_directories(lib/cxxopts/include)
set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install OFF CACHE INTERNAL "")
add_subdirectory(lib/json)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
include(cmake/InstallHwloc.cmake)
include(cmake/InstallGoogleTest.cmake)
add_subdirectory(src)
if(FIRESTARTER_BUILD_TESTS)
add_subdirectory(test)
endif()