forked from spacegaier/volume-cartographer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
108 lines (82 loc) · 2.84 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
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
include(FetchContent)
include(CMakeDependentOption)
set(VC_VERSION 3.0.0)
option(VC_VERSION_DATESTAMP "Append date stamp to version number" off)
if(VC_VERSION_DATESTAMP)
string(TIMESTAMP VC_VERSION_TWEAK "%s")
set(VC_VERSION ${VC_VERSION}.${VC_VERSION_TWEAK})
endif()
project(VC3D VERSION ${VC_VERSION})
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_FLAGS "-ggdb -O3 -Wno-narrowing")
find_program(CCACHE_PROGRAM "ccache")
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PROGRAM})
endif()
# Use modern C++ for everything and generate compile_commands database.
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
# Choose what to build
option(VC_BUILD_APPS "Compile VC core programs" on)
option(VC_BUILD_GUI "Compile GUI programs" on)
option(VC_BUILD_UTILS "Compile VC utility programs" on)
# Choose what to install
option(VC_INSTALL_APPS "Install VC core programs" on)
option(VC_INSTALL_LIBS "Install VC libraries" on)
option(VC_INSTALL_UTILS "Install VC utility programs" on)
# Some helpful constants to be used in subprojects.
include(VCConstants)
# Look for external dependencies.
include(VCFindDependencies)
# XXX Hack to get ninja output colorized for all source files.
if (CMAKE_GENERATOR MATCHES "Ninja")
add_compile_options(-fdiagnostics-color=always)
endif()
# Weird bug on macOS where system includes aren't included with the right flag
if (APPLE)
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
endif()
if (VC_BUILD_TESTS)
enable_testing()
endif()
## VC Libraries ##
option(VC_DEVELOPER_WARNINGS "For developers: Enable extensive compiler warnings" OFF)
mark_as_advanced(VC_DEVELOPER_WARNINGS)
if(VC_DEVELOPER_WARNINGS)
include(VCWarnings)
endif()
add_subdirectory(core)
if (VC_BUILD_TESTS)
add_subdirectory(testing)
endif()
# App support library
if(VC_BUILD_APPS OR VC_BUILD_UTILS)
add_subdirectory(app_support)
endif()
## VC Core Apps ##
if (VC_BUILD_APPS)
add_subdirectory(apps)
endif()
## VC Utility apps ##
## VC Example Apps ##
## VC Documentation
find_package(Doxygen OPTIONAL_COMPONENTS dot)
CMAKE_DEPENDENT_OPTION(VC_BUILD_DOCS "Build VC Doxygen documentation" on "DOXYGEN_FOUND" off)
CMAKE_DEPENDENT_OPTION(VC_INSTALL_DOCS "Install VC documentation" off "VC_BUILD_DOCS" off)
if(VC_BUILD_DOCS)
add_subdirectory(docs)
endif()
if(VC_BUILD_PYTHON_BINDINGS)
add_subdirectory(python)
endif()
# Setup the config files #
include(VCPackageConfig)
# Install to system directories
include(VCInstall)
# Look for the SDL2 package for Audio
find_package(SDL2 REQUIRED)
# Look for the GNU Scientific Library (GSL) package for interpolation related functionalities
find_package(GSL REQUIRED)
include(Packing)