-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
executable file
·218 lines (177 loc) · 8.52 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
216
# Copyright (c) 2010-2017, 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.
cmake_minimum_required(VERSION 2.6)
# Specify project name.
project(SatellitePropagatorExamples)
# Load UserSettings.txt
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
message(STATUS "Building ${PROJECT_NAME} standalone.")
include("${CMAKE_CURRENT_SOURCE_DIR}/UserSettings.txt" OPTIONAL)
else()
message(STATUS "Building ${PROJECT_NAME} from within ${CMAKE_PROJECT_NAME}.")
include("${CMAKE_CURRENT_SOURCE_DIR}/UserSettings.txt" OPTIONAL)
include("${CMAKE_SOURCE_DIR}/UserSettings.txt" OPTIONAL)
STRING(REGEX REPLACE ${CMAKE_SOURCE_DIR} "" RELATIVE_PROJECT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(RELATIVE_PROJECT_PATH "${RELATIVE_PROJECT_PATH}" CACHE STRING "Relative path wrt to project for function")
message(STATUS "Relative path (wrt to project): ${RELATIVE_PROJECT_PATH}")
endif()
# Set CMake build-type. If it not supplied by the user (either directly as an argument of through
# the "UserSettings.txt" file, the default built type is "Release".
if((NOT CMAKE_BUILD_TYPE) OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
message(STATUS "WARNING: building release version!")
set(CMAKE_BUILD_TYPE Release)
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "WARNING: building debug version!")
endif()
# Set module path to local CMake scripts.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
# Set compiler based on preferences (e.g. USE_CLANG) and system.
include(${CMAKE_MODULE_PATH}/compiler.cmake)
# Define the directory with the source code.
set(SRCROOT "${CMAKE_CURRENT_SOURCE_DIR}")
# Define the code root directory.
set(CODEROOT "${CMAKE_CURRENT_SOURCE_DIR}/..")
# Set testing options based on platform.
enable_testing()
# Set lib and bin directories where static libraries and unit tests are built.
if(NOT LIBROOT)
set(LIBROOT "${CODEROOT}/lib")
endif()
if(NOT BINROOT)
set(BINROOT "${CODEROOT}/bin")
endif()
# Set the global macros for setting up targets.
macro(setup_executable_target target_name CUSTOM_OUTPUT_PATH)
set_property(TARGET ${target_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${BINROOT}/applications")
install(TARGETS ${target_name} RUNTIME DESTINATION "${BINROOT}/applications")
endmacro(setup_executable_target)
macro(setup_library_target target_name CUSTOM_OUTPUT_PATH)
set_property(TARGET ${target_name} PROPERTY LIBRARY_OUTPUT_DIRECTORY "${LIBROOT}")
set_property(TARGET ${target_name} PROPERTY ARCHIVE_OUTPUT_DIRECTORY "${LIBROOT}")
endmacro(setup_library_target)
macro(setup_unit_test_target target_name CUSTOM_OUTPUT_PATH)
set_property(TARGET ${target_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${BINROOT}/unit_tests")
get_property(CUSTOM_TEST_PROGRAM_NAME TARGET ${target_name} PROPERTY OUTPUT_NAME)
add_test("${target_name}" "${BINROOT}/unit_tests/${target_name}")
endmacro(setup_unit_test_target)
# Define the install targets to create a distribution.
if(NOT TUDAT_BUNDLE_DISTRIBUTION_PATH)
set(TUDAT_BUNDLE_DISTRIBUTION_PATH "${CODEROOT}")
endif(NOT TUDAT_BUNDLE_DISTRIBUTION_PATH)
if(NOT SATELLITE_PROPAGATOR_EXAMPLES_DISTRIBUTION_PATH)
set(SATELLITE_PROPAGATOR_EXAMPLES_DISTRIBUTION_PATH
"${TUDAT_BUNDLE_DISTRIBUTION_PATH}/tudatApplications/satellitePropagatorExamples")
endif(NOT SATELLITE_PROPAGATOR_EXAMPLES_DISTRIBUTION_PATH)
# Install files.
install(DIRECTORY "${SRCROOT}/"
DESTINATION "${SATELLITE_PROPAGATOR_EXAMPLES_DISTRIBUTION_PATH}/SatellitePropagatorExamples"
PATTERN ".DS_STORE" EXCLUDE
PATTERN "CMakeLists.txt.user" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN ".git" EXCLUDE
PATTERN ".bzr" EXCLUDE
)
# Include the top-level directories.
include_directories(AFTER
"${CODEROOT}"
)
# Find Eigen3 library on local system.
find_package(Eigen3 REQUIRED)
# Include Eigen3 directories.
# Set CMake flag to suppress Eigen warnings (platform-dependent solution).
if(NOT APPLE)
include_directories(SYSTEM AFTER "${EIGEN3_INCLUDE_DIR}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem \"${EIGEN3_INCLUDE_DIR}\"")
endif()
# Configure Boost libraries.
if(NOT Boost_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
if(NOT Boost_USE_MULTITHREADED)
set(Boost_USE_MULTITHREADED ON)
endif()
if(NOT Boost_USE_STATIC_RUNTIME)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
# Find Boost libraries on local system.
find_package(Boost 1.45.0
COMPONENTS thread date_time system unit_test_framework filesystem regex REQUIRED)
# Include Boost directories.
# Set CMake flag to suppress Boost warnings (platform-dependent solution).
if(NOT APPLE)
include_directories(SYSTEM AFTER "${Boost_INCLUDE_DIRS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem \"${Boost_INCLUDE_DIRS}\"")
endif()
# Find Tudat library on local system.
find_package(Tudat 2.0 REQUIRED)
# Include Tudat directories.
# Set CMake flag to suppress Tudat warnings (platform-dependent solution).
if(NOT APPLE)
include_directories(SYSTEM AFTER "${TUDAT_INCLUDE_DIR}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem \"${TUDAT_INCLUDE_DIR}\"")
endif()
# Find CSPICE library on local system.
find_package(Spice)
# Include CSpice directories.
if(NOT APPLE)
include_directories(SYSTEM AFTER "${SPICE_INCLUDE_DIR}")
else( )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem \"${SPICE_INCLUDE_DIR}\"")
endif( )
option(USE_NRLMSISE00 "build Tudat with NRLMSISE-00 enabled" ON)
if(NOT USE_NRLMSISE00)
message(STATUS "NRLMSISE-00 disabled!")
add_definitions(-DUSE_NRLMSISE00=0)
else()
message(STATUS "NRLMSISE-00 enabled!")
add_definitions(-DUSE_NRLMSISE00=1)
# Find USE_NRLMSISE00 library on local system.
find_package(NRLMSISE00)
# Include NRLMSISE00 directories.
if(NOT APPLE)
include_directories(SYSTEM AFTER "${NRLMSISE00_INCLUDE_DIR}")
else( )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem \"${NRLMSISE00_INCLUDE_DIR}\"")
endif( )
endif( )
list(APPEND TUDAT_APPLICATION_EXTERNAL_LIBRARIES "")
list(APPEND TUDAT_APPLICATION_EXTERNAL_INTERFACE_LIBRARIES "")
list(APPEND TUDAT_APPLICATION_ITRS_LIBRARIES "")
if(USE_SOFA)
list(APPEND TUDAT_APPLICATION_EXTERNAL_LIBRARIES sofa)
list(APPEND TUDAT_APPLICATION_EXTERNAL_INTERFACE_LIBRARIES tudat_sofa_interface )
list(APPEND TUDAT_APPLICATION_ITRS_LIBRARIES tudat_earth_orientation )
endif()
if(USE_CSPICE)
list(APPEND TUDAT_APPLICATION_EXTERNAL_LIBRARIES cspice)
list(APPEND TUDAT_APPLICATION_EXTERNAL_INTERFACE_LIBRARIES tudat_spice_interface )
endif()
if(USE_NRLMSISE00)
list(APPEND TUDAT_APPLICATION_EXTERNAL_LIBRARIES nrlmsise00)
endif()
list(APPEND TUDAT_APPLICATION_PROPAGATION_LIBRARIES tudat_simulation_setup tudat_ground_stations tudat_propagators
tudat_aerodynamics tudat_system_models tudat_geometric_shapes tudat_relativity tudat_gravitation tudat_mission_segments
tudat_electro_magnetism tudat_propulsion tudat_ephemerides ${TUDAT_APPLICATION_ITRS_LIBRARIES} tudat_numerical_integrators tudat_reference_frames
tudat_statistics tudat_propagators ${TUDAT_APPLICATION_EXTERNAL_INTERFACE_LIBRARIES} tudat_basic_astrodynamics tudat_root_finders tudat_basic_mathematics
tudat_input_output tudat_basics ${TUDAT_APPLICATION_EXTERNAL_LIBRARIES})
list(APPEND TUDAT_APPLICATION_ESTIMATION_LIBRARIES tudat_simulation_setup tudat_observation_models tudat_ground_stations tudat_acceleration_partials
tudat_observation_partials tudat_estimatable_parameters tudat_orbit_determination tudat_propagators
tudat_aerodynamics tudat_system_models tudat_geometric_shapes tudat_relativity tudat_gravitation tudat_mission_segments
tudat_electro_magnetism tudat_propulsion tudat_ephemerides ${TUDAT_APPLICATION_ITRS_LIBRARIES} tudat_numerical_integrators tudat_reference_frames
tudat_statistics tudat_propagators ${TUDAT_APPLICATION_EXTERNAL_INTERFACE_LIBRARIES} tudat_basic_astrodynamics tudat_root_finders tudat_basic_mathematics
tudat_input_output tudat_basics ${TUDAT_APPLICATION_EXTERNAL_LIBRARIES})
## INTEGRATION: SLIDE RESULTS
add_executable(po_application_HomeworkWeek1 "${SRCROOT}/homeworkWeek1.cpp")
setup_executable_target(po_application_HomeworkWeek1 "${SRCROOT}")
target_link_libraries(po_application_HomeworkWeek1 json_interface_library ${TUDAT_APPLICATION_PROPAGATION_LIBRARIES} ${Boost_LIBRARIES} )