forked from njoy/scion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
96 lines (70 loc) · 2.88 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
########################################################################
# Preamble
########################################################################
cmake_minimum_required( VERSION 3.14 )
project( scion LANGUAGES CXX )
########################################################################
# Project-wide setup
########################################################################
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED YES )
option( scion.tests "Build the scion unit tests" OFF )
option( scion.python "Build scion python bindings" ON )
option( strict_compile
"Treat all warnings as errors." ON
)
# Compile flags
set( common_flags "-Wall" "-Wextra" "-Wpedantic" )
set( strict_flags "-Werror" )
set( release_flags "-O3" )
set( debug_flags "-O0" "-g" )
########################################################################
# Dependencies
########################################################################
set( REPOSITORIES "release"
CACHE STRING
"Options for where to fetch repositories: develop, release, local"
)
message( STATUS "Using ${REPOSITORIES} repositories" )
if( REPOSITORIES STREQUAL "develop" )
include( cmake/develop_dependencies.cmake )
elseif( REPOSITORIES STREQUAL "release" )
include( cmake/release_dependencies.cmake )
elseif( REPOSITORIES STREQUAL "local" )
include( cmake/local_dependencies.cmake )
endif()
########################################################################
# Project targets
########################################################################
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# scion : library
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
include_directories( src/ )
add_library( scion INTERFACE )
target_include_directories( scion INTERFACE src/ )
target_link_libraries( scion
INTERFACE Log
INTERFACE catch-adapter
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# scion : python bindings
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if( scion.python )
pybind11_add_module( scion.python
python/src/scion.python.cpp
)
target_link_libraries( scion.python PRIVATE scion )
target_include_directories( scion.python PRIVATE python/src )
target_compile_options( scion.python PRIVATE "-fvisibility=hidden" )
set_target_properties( scion.python PROPERTIES OUTPUT_NAME scion )
set_target_properties( scion.python PROPERTIES COMPILE_DEFINITIONS "PYBIND11" )
set_target_properties( scion.python PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
#######################################################################
# Top-level Only
#######################################################################
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
if( scion.tests )
include( cmake/unit_testing.cmake )
endif()
endif()