-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
247 lines (193 loc) · 5.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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
cmake_minimum_required(VERSION 3.5)
project(mrs_uav_trackers)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-Wall)
add_definitions(-Wextra)
if(COVERAGE)
message(WARNING "building with --coverage, the performance might be limited")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
endif()
set(CATKIN_DEPENDENCIES
cmake_modules
roscpp
rospy
geometry_msgs
tf
std_msgs
mrs_lib
mrs_msgs
mrs_uav_managers
dynamic_reconfigure
mrs_uav_testing
)
find_package(catkin REQUIRED COMPONENTS
${CATKIN_DEPENDENCIES}
)
generate_dynamic_reconfigure_options(
cfg/mpc_tracker.cfg
cfg/flip_tracker.cfg
)
# include Eigen3
find_package(Eigen3 REQUIRED)
set(Eigen_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS})
set(Eigen_LIBRARIES ${EIGEN3_LIBRARIES})
set(LIBRARIES
MrsUavTrackers_MpcTracker
MrsUavTrackers_LineTracker
MrsUavTrackers_LandoffTracker
MrsUavTrackers_JoyTracker
MrsUavTrackers_SpeedTracker
MrsUavTrackers_FlipTracker
MrsUavTrackers_MidairActivationTracker
)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS ${CATKIN_DEPENDENCIES}
LIBRARIES ${LIBRARIES}
DEPENDS Eigen
)
## --------------------------------------------------------------
## | Build |
## --------------------------------------------------------------
include_directories(
include
${EIGEN_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake
)
# Mpc Solver Library
# Store in CMAKE_DEB_HOST_ARCH var the current build architecture
execute_process(COMMAND
dpkg-architecture
-qDEB_HOST_ARCH
OUTPUT_VARIABLE
CMAKE_DEB_HOST_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# deduce the library path based on the system architecture
if(${CMAKE_DEB_HOST_ARCH} MATCHES "armhf")
MESSAGE(FATAL_ERROR "Mising MpcTrackerSolver.so for armhf")
elseif(${CMAKE_DEB_HOST_ARCH} MATCHES "i386")
MESSAGE(FATAL_ERROR "Mising MpcTrackerSolver.so for i386")
elseif(${CMAKE_DEB_HOST_ARCH} MATCHES "x64")
set(MPC_CONTROLLER_SOLVER_BIN ${PROJECT_SOURCE_DIR}/lib/MpcTrackerSolver/x64/libMpcTrackerSolver.so)
elseif(${CMAKE_DEB_HOST_ARCH} MATCHES "amd64")
set(MPC_CONTROLLER_SOLVER_BIN ${PROJECT_SOURCE_DIR}/lib/MpcTrackerSolver/x64/libMpcTrackerSolver.so)
elseif(${CMAKE_DEB_HOST_ARCH} MATCHES "arm64")
set(MPC_CONTROLLER_SOLVER_BIN ${PROJECT_SOURCE_DIR}/lib/MpcTrackerSolver/arm64/libMpcTrackerSolver.so)
else()
MESSAGE(FATAL_ERROR ${CMAKE_DEB_HOST_ARCH})
MESSAGE(FATAL_ERROR "MpcTrackerSolver.so has not been selected, check CMakeLists.txt.")
endif()
# MPC Tracker
add_library(MrsUavTrackers_MpcTracker
src/mpc_tracker/mpc_tracker.cpp
)
add_dependencies(MrsUavTrackers_MpcTracker
${catkin_EXPORTED_TARGETS}
${${PROJECT_NAME}_EXPORTED_TARGETS}
)
target_link_libraries(MrsUavTrackers_MpcTracker
${catkin_LIBRARIES}
${MPC_CONTROLLER_SOLVER_BIN}
)
# Line Tracker
add_library(MrsUavTrackers_LineTracker
src/line_tracker/line_tracker.cpp
)
add_dependencies(MrsUavTrackers_LineTracker
${catkin_EXPORTED_TARGETS}
${${PROJECT_NAME}_EXPORTED_TARGETS}
)
target_link_libraries(MrsUavTrackers_LineTracker
${catkin_LIBRARIES}
)
# Landoff Tracker
add_library(MrsUavTrackers_LandoffTracker
src/landoff_tracker/landoff_tracker.cpp
)
add_dependencies(MrsUavTrackers_LandoffTracker
${catkin_EXPORTED_TARGETS}
${${PROJECT_NAME}_EXPORTED_TARGETS}
)
target_link_libraries(MrsUavTrackers_LandoffTracker
${catkin_LIBRARIES}
)
# Joy Tracker
add_library(MrsUavTrackers_JoyTracker
src/joy_tracker/joy_tracker.cpp
)
add_dependencies(MrsUavTrackers_JoyTracker
${catkin_EXPORTED_TARGETS}
${${PROJECT_NAME}_EXPORTED_TARGETS}
)
target_link_libraries(MrsUavTrackers_JoyTracker
${catkin_LIBRARIES}
)
# Speed tracker
add_library(MrsUavTrackers_SpeedTracker
src/speed_tracker/speed_tracker.cpp
)
add_dependencies(MrsUavTrackers_SpeedTracker
${catkin_EXPORTED_TARGETS}
${${PROJECT_NAME}_EXPORTED_TARGETS}
)
target_link_libraries(MrsUavTrackers_SpeedTracker
${catkin_LIBRARIES}
)
# Flip tracker
add_library(MrsUavTrackers_FlipTracker
src/flip_tracker/flip_tracker.cpp
)
add_dependencies(MrsUavTrackers_FlipTracker
${catkin_EXPORTED_TARGETS}
${${PROJECT_NAME}_EXPORTED_TARGETS}
)
target_link_libraries(MrsUavTrackers_FlipTracker
${catkin_LIBRARIES}
)
# Midair activation tracker
add_library(MrsUavTrackers_MidairActivationTracker
src/midair_activation_tracker/midair_activation_tracker.cpp
)
add_dependencies(MrsUavTrackers_MidairActivationTracker
${catkin_EXPORTED_TARGETS}
${${PROJECT_NAME}_EXPORTED_TARGETS}
)
target_link_libraries(MrsUavTrackers_MidairActivationTracker
${catkin_LIBRARIES}
)
## --------------------------------------------------------------
## | Testing |
## --------------------------------------------------------------
if(CATKIN_ENABLE_TESTING AND MRS_ENABLE_TESTING)
message(WARNING "Testing enabled.")
add_subdirectory(test)
endif()
## --------------------------------------------------------------
## | Install |
## --------------------------------------------------------------
install(TARGETS ${LIBRARIES}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
install(DIRECTORY config
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(FILES ${MPC_CONTROLLER_SOLVER_BIN}
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
install(DIRECTORY scripts/
USE_SOURCE_PERMISSIONS
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY scripts
USE_SOURCE_PERMISSIONS
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(FILES plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)