forked from acts-project/actsvg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (85 loc) · 3.4 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
cmake_minimum_required(VERSION 3.11)
project (actsvg VERSION 0.4.35 LANGUAGES CXX )
# Set up the used C++ standard(s).
set( CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use" )
set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "Disable C++ extensions" )
set(ACTSVG_CXX_FLAGS "-Wall -Wextra -Wpedantic -Wshadow -Wno-unused-local-typedefs")
# This adds some useful conversion checks like float-to-bool, float-to-int, etc.
# However, at the moment this is only added to clang builds, since GCC's -Wfloat-conversion
# is much more aggressive and also triggers on e.g., double-to-float
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
set(ACTSVG_CXX_FLAGS "${ACTSVG_CXX_FLAGS} -Wfloat-conversion")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ACTSVG_CXX_FLAGS}")
# CMake include(s).
include( CMakeDependentOption )
include( GNUInstallDirs )
# Flags controlling the meta-build system.
option( ACTSVG_USE_SYSTEM_LIBS "Use system libraries be default" FALSE )
# Explicitly set the output directory for the binaries. Such that if this
# project is included by another project, the main project's configuration would
# win out.
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}" CACHE PATH
"Directory for the built binaries" )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH
"Directory for the built libraries" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" CACHE PATH
"Directory for the built static libraries" )
# Include the Detray CMake code.
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )
include( actsvg-functions )
# Core library component
add_subdirectory(core)
option(ACTSVG_BUILD_META "Build the meta level interface of ACTSVG" ON )
if ( ACTSVG_BUILD_META )
add_subdirectory(meta)
endif()
option(ACTSVG_BUILD_WEB "Build the webpage builder interface of ACTSVG" ON )
if ( ACTSVG_BUILD_WEB )
add_subdirectory(web)
endif()
option(ACTSVG_BUILD_EXAMPLES "Build the example applications of ACTSVG" OFF )
if ( ACTSVG_BUILD_EXAMPLES )
# Setup boost for the examples
set(_actsvg_boost_version 1.71.0)
option(ACTSVG_SETUP_BOOST "Explicitly set up Boost for the project" ON)
option(ACTSVG_USE_SYSTEM_BOOST "Use a system-provided boost" ON)
if (ACTSVG_SETUP_BOOST)
if (ACTSVG_USE_SYSTEM_BOOST)
find_package(Boost ${_actsvg_boost_version} REQUIRED COMPONENTS program_options)
else()
add_subdirectory(extern/boost)
endif()
endif()
# Add the examples
add_subdirectory(examples)
endif()
option(ACTSVG_BUILD_TESTING "Build the (unit) tests of ACTSVG" OFF )
if (ACTSVG_BUILD_TESTING OR ACTSVG_BUILD_EXAMPLES)
add_subdirectory(data)
endif()
# Set up the test(s).
include( CTest )
if( ACTSVG_BUILD_TESTING )
add_subdirectory( tests )
endif()
if (ACTSVG_BUILD_TESTING OR ACTSVG_BUILD_EXAMPLES)
# Set up GoogleTest.
option( ACTSVG_SETUP_GOOGLETEST
"Set up the GoogleTest target(s) explicitly" TRUE )
option( ACTSVG_USE_SYSTEM_GOOGLETEST
"Pick up an existing installation of GoogleTest from the build environment"
${ACTSVG_USE_SYSTEM_LIBS} )
if( ACTSVG_SETUP_GOOGLETEST )
if( ACTSVG_USE_SYSTEM_GOOGLETEST )
find_package( GTest REQUIRED )
else()
add_subdirectory( extern/googletest )
endif()
endif()
endif()
# Set up the packaging of the project.
include( actsvg-packaging )