-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathCMakeLists.txt
executable file
·215 lines (181 loc) · 7.1 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Copyright (c) 2010-2019, Delft University of Technology
# All rigths reserved
#
# This file is part of the Tudat. Redistribution and use in source and
# binary forms, with or without modification, are permitted exclusively
# under the terms of the Modified BSD license. You should have received
# a copy of the license with this file. If not, please or visit:
# http://tudat.tudelft.nl/LICENSE.
# Specify minimum CMake version required to compile Tudat.
cmake_minimum_required( VERSION 2.8.10 )
# Clean cache
if(EXISTS "${CMAKE_BINARY_DIR}/CMakeCache.txt")
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeCache.txt")
endif()
# Specific Tudat project name.
project( TudatBundle )
# Package options
option(USE_CSPICE "Build CSPICE libary, tudat with SPICE support and example applications." ON)
option(USE_JSON "Build JSON library and example applications." ON)
option(USE_NRLMSISE00 "Build NRLMISE-00 library and tudat with NRLMSISE support." ON)
option(USE_SOFA "Build Sofa library." ON)
option(USE_PAGMO "Build PaGMO2 library. Forced to ON if optimization package is enabled" OFF)
option(USE_PYGMO "Build PaGMO library with Python bindings." OFF)
option(USE_NLOPT "Build PaGMO library with Python bindings." OFF)
option(USE_TUDAT_EXAMPLE_APPLICATIONS "Build Tudat with example applications." ON)
# Set root-directory for code to current source directory.
set(PROJECTROOT "${CMAKE_CURRENT_SOURCE_DIR}/")
message(STATUS ${PROJECT_SOURCE_DIR})
enable_testing( )
# Set the flag to force to use include_directories macro on Apple too
option(APPLE_INCLUDE_FORCE "Force include_directories on Apple too." ON)
# Let CMake find our custom cmake modules/scritpts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/CMake" "${CMAKE_CURRENT_SOURCE_DIR}/tudat/Tudat/External/CMake")
#
# Boost
#
# Set the required boost components (for Tudat)
set(BoostComponents filesystem system regex date_time unit_test_framework thread)
# Add additional required boost componets for other libraries
# if these are used.
if(USE_PAGMO)
list(APPEND BoostComponents serialization chrono atomic)
endif()
if(USE_PYGMO)
list(APPEND BoostComponents python python3)
endif()
# Pick a boost version
set(BoostVersion 1.64.0)
set(BoostSHA1 51421ef259a4530edea0fbfc448460fcc5c64edb)
#set(BoostVersion 1.60.0)
#set(BoostSHA1 7f56ab507d3258610391b47fef6b11635861175a)
# set(BoostVersion 1.57.0)
# set(BoostSHA1 e151557ae47afd1b43dc3fac46f8b04a8fe51c12)
# set(BoostVersion 1.53.0)
# set(BoostSHA1 e6dd1b62ceed0a51add3dda6f3fc3ce0f636a7f3)
# set(BoostVersion 1.48.0)
# set(BoostSHA1 27aced5086e96c6f7b2b684bda2bd515e115da35)
# Minimum boost version required for PagMO2 is 1.55
if(USE_PAGMO)
# Explode the BoostVersion string ##.##.## into boost_version;boost_release;##
string(REPLACE "." ";" boost_v_list ${BoostVersion})
list(GET boost_v_list 0 boost_version)
list(GET boost_v_list 1 boost_release)
math(EXPR boost_v_number "${boost_version} * 100000 + ${boost_release} * 100")
# If calculated version < 105500 change to BoostVersion to 1.57.0
if( boost_v_number LESS 105500 )
set(BoostVersion 1.57.0)
set(BoostSHA1 e151557ae47afd1b43dc3fac46f8b04a8fe51c12)
message(STATUS "Setting boost version to ${BoostVersion}")
endif()
unset(boost_v_list)
unset(boost_version)
unset(boost_release)
endif()
# Build boost
include(add_boost)
#
# SPICE
#
if(USE_CSPICE)
add_subdirectory( "${PROJECTROOT}/cspice/")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-implicit-int")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-incompatible-pointer-types")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-pointer-to-int-cast")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-shift-op-parentheses")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-logical-op-parentheses")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-parentheses")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-tautological-compare")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-format")
set_property(TARGET cspice APPEND PROPERTY COMPILE_OPTIONS "-Wno-unsequenced")
endif()
#
# JSON
#
if(USE_JSON)
add_subdirectory( "${PROJECTROOT}/json/")
endif()
#
# NRLMSISE
#
# Add the NRLMSISE project and build
if(USE_NRLMSISE00)
set(NRLMSISE00_WITH_TESTS OFF CACHE BOOL "Building of NRLMSISE00 tests.")
add_subdirectory( "${PROJECTROOT}/nrlmsise-00/")
endif()
#
# SOFA
#
if(USE_SOFA)
add_subdirectory( "${PROJECTROOT}/sofa/src")
endif()
#
# PaGMO2
#
if(USE_PAGMO)
option(PAGMO_BUILD_TESTS "Build PaGMO2 with test set." ON)
option(PAGMO_BUILD_EXAMPLES "Build PaGMO2 with examples." ON)
option(PAGMO_BUILD_TUTORIALS "Build PaGMO2 with tutorials." ON)
option(PAGMO_WITH_EIGEN3 "Build PaGMO2 with Eigen 3." ON)
option(PAGMO_USE_TBB "Build with TBB." OFF)
option(PAGMO_AS_STATIC_LIB "Compile pagmo as a static instead of a dynamic library." ON)
if(PAGMO_AS_STATIC_LIB)
add_definitions(-DPAGMO_STATIC_LIB=1)
else()
add_definitions(-DPAGMO_STATIC_LIB=0)
endif()
if(USE_NLOPT)
option(PAGMO_WITH_NLOPT "Build PaGMO2 with NLOPT." ON)
endif()
if(USE_PYGMO)
option(PAGMO_BUILD_PAGMO "Do not build PaGMO2" OFF)
option(PAGMO_BUILD_PYGMO "Build PaGMO2 with Python bindings" ON)
message(STATUS "this")
else(USE_PYGMO)
option(PAGMO_BUILD_PAGMO "Build PaGMO2" ON)
option(PAGMO_BUILD_PYGMO "Do not build PaGMO2 with Python bindings" OFF)
message(STATUS "not this ${PAGMO_BUILD_PAGMO}")
endif(USE_PYGMO)
message(STATUS "The things are: ${PAGMO_BUILD_PAGMO} ${PAGMO_BUILD_PYGMO} ${PAGMO_BUILD_TESTS} ${PAGMO_BUILD_EXAMPLES}")
unset(pagmo_LIB_DEPENDS CACHE)
if(PAGMO_USE_TBB)
set(TBB_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/tbb")
add_subdirectory( "${PROJECTROOT}tbb/")
endif()
add_subdirectory( "${PROJECTROOT}pagmo2/" )
elseif(USE_PYGMO)
option(PAGMO_BUILD_PAGMO "Do not build PaGMO2" OFF)
option(PAGMO_BUILD_PYGMO "Do not build PaGMO2 with Python bindings" ON)
unset(pagmo_LIB_DEPENDS CACHE)
add_subdirectory( "${PROJECTROOT}pagmo2/" )
endif()
#
# NLOPT
#
if(USE_NLOPT)
if(PAGMO_AS_STATIC_LIB)
option(BUILD_SHARED_LIBS "Building NLOPT as static libraries" OFF)
else()
option(BUILD_SHARED_LIBS "Building NLOPT as shared libraries" ON)
endif()
option(NLOPT_TESTS "Enabling NLOPT tests" ON)
add_subdirectory( "${PROJECTROOT}/nlopt/")
endif()
#
# Tudat and applications
#
option(BUILD_WITH_ESTIMATION_TOOLS "Build Tudat with state estimation functionality." ON)
if(NOT BUILD_WITH_ESTIMATION_TOOLS)
add_definitions(-DBUILD_WITH_ESTIMATION_TOOLS=0)
else()
add_definitions(-DBUILD_WITH_ESTIMATION_TOOLS=1)
endif()
set(TUDAT_BUILD_DIR "${PROJECTROOT}/tudat")
add_subdirectory( "${PROJECTROOT}/tudat/Tudat/")
if(USE_TUDAT_EXAMPLE_APPLICATIONS)
add_subdirectory( "${PROJECTROOT}/tudatExampleApplications/satellitePropagatorExamples/SatellitePropagatorExamples/")
if(USE_PAGMO)
add_subdirectory( "${PROJECTROOT}/tudatExampleApplications/libraryExamples/PaGMOEx")
endif()
endif()
add_subdirectory( "${PROJECTROOT}/tudatExampleApplications/templateApplication/TemplateApplication")