forked from HSF/TrickTrack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
97 lines (79 loc) · 3.55 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
# - Define the minimum CMake version
cmake_minimum_required(VERSION 3.2)
# - Call project() to setup system
# From CMake 3, we can set the project version easily in one go
project(tricktrack VERSION 1.0.9)
#--- Define basic build settings -----------------------------------------------
# - Use GNU-style hierarchy for installing build products
include(GNUInstallDirs)
# - Define a default build type when using a single-mode tool like make/ninja
# If you're using a build tool that supports multiple modes (Visual Studio,
# Xcode), this setting has no effect.
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo
CACHE STRING "Choose the type of build, options are: None Release MinSizeRel Debug RelWithDebInfo"
FORCE
)
else()
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}"
CACHE STRING "Choose the type of build, options are: None Release MinSizeRel Debug RelWithDebInfo"
FORCE
)
endif()
endif()
#--- Define the C++ Standard to use -------------------------------------------
set(CMAKE_CXX_STANDARD 14 CACHE STRING "")
#--- Declare options -----------------------------------------------------------
option(tricktrack_documentation "Create doxygen doc target." OFF)
option(tricktrack_profiling "Create profiling binaries." OFF)
option(tricktrack_python "Create python bindings for tricktrack" OFF)
option(tricktrack_logger "Use spdlog for logging" OFF)
option(tricktrack_logger_standalone "Use spdlog standalone (as opposed to in a framework" OFF)
#--- enable unit testing capabilities ------------------------------------------
include(CTest)
#--- enable CPack --------------------------------------------------------------
include(cmake/tricktrackCPack.cmake)
#--- add path to Find modules -------------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
#--- search for Eigen package --------------------------------------------------
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
#--- logger setup --------------------------------------------------------------
if (tricktrack_logger)
find_package(spdlog REQUIRED)
include_directories(${SPDLOG_INCLUDE_DIR})
find_package(Threads REQUIRED)
add_definitions(-DUSE_SPDLOG)
endif()
if (tricktrack_logger_standalone)
add_definitions(-DUSE_SPDLOG_STANDALONE)
endif()
#--- target for Doxygen documentation ------------------------------------------
if(tricktrack_documentation)
include(cmake/tricktrackDoxygen.cmake)
endif()
#--- add version files ---------------------------------------------------------
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tricktrackVersion.h
${CMAKE_CURRENT_BINARY_DIR}/tricktrackVersion.h )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tricktrackVersion.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tricktrack )
#--- add CMake infrastructure --------------------------------------------------
include(cmake/tricktrackCreateConfig.cmake)
#--- add license files ---------------------------------------------------------
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE
${CMAKE_CURRENT_SOURCE_DIR}/NOTICE
DESTINATION ${CMAKE_INSTALL_DOCDIR})
#--- add actual code -----------------------------------------------------------
add_subdirectory(src)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
if(tricktrack_profiling)
add_subdirectory(profiling)
endif()
if (tricktrack_python)
add_subdirectory(python)
endif()
#--- create uninstall target ---------------------------------------------------
include(cmake/tricktrackUninstall.cmake)