-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
403 lines (320 loc) · 9.73 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
cmake_minimum_required(VERSION 3.5)
project(mrs_gazebo_common_resources)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall")
set(CATKIN_DEPENDENCIES
gazebo_plugins
gazebo_ros
geometry_msgs
roscpp
std_msgs
tf2
tf2_msgs
tf2_ros
)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
${CATKIN_DEPENDENCIES}
)
# include Gazebo
find_package(gazebo REQUIRED)
# include Qt
find_package(Qt5Widgets REQUIRED)
# include OpenCV
find_package(OpenCV REQUIRED)
# include Boost
find_package(Boost REQUIRED COMPONENTS thread)
# include Eigen3
find_package(Eigen3 REQUIRED)
set(Eigen_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS})
set(Eigen_LIBRARIES ${Eigen_LIBRARIES})
# XXX this approach is extremely error prone
# it would be preferable to either depend on the
# compiled headers from Gazebo directly
# or to have something entirely independent.
#
set(PROTOBUF_IMPORT_DIRS "")
foreach(ITR ${GAZEBO_INCLUDE_DIRS})
if(ITR MATCHES ".*gazebo-[0-9.]+$")
set(PROTOBUF_IMPORT_DIRS "${ITR}/gazebo/msgs/proto")
endif()
endforeach()
set(GAZEBO_MSG_INCLUDE_DIRS)
foreach(ITR ${GAZEBO_INCLUDE_DIRS})
if(ITR MATCHES ".*gazebo-[0-9.]+$")
set(GAZEBO_MSG_INCLUDE_DIRS "${ITR}/gazebo/msgs")
endif()
endforeach()
# PROTOBUF_IMPORT_DIRS has to be set before
find_package(Protobuf REQUIRED)
set(sensor_msgs
msgs/SITLGps.proto
msgs/Groundtruth.proto
msgs/MagneticField.proto
msgs/Float.proto
msgs/CommandMotorSpeed.proto
msgs/MotorSpeed.proto
msgs/Wind.proto
)
PROTOBUF_GENERATE_CPP(SEN_PROTO_SRCS SEN_PROTO_HDRS ${sensor_msgs})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
###################################
## catkin specific configuration ##
###################################
set(LIBRARIES
MrsGazeboCommonResources_GuiManager
MrsGazeboCommonResources_RvizCameraSynchronizer
MrsGazeboCommonResources_StaticTransformRepublisher
MrsGazeboCommonResources_RangefinderPlugin
MrsGazeboCommonResources_2DLidarPlugin
MrsGazeboCommonResources_3DLidarPlugin
MrsGazeboCommonResources_3DLidarGpuPlugin
MrsGazeboCommonResources_CameraPlugin
MrsGazeboCommonResources_RealsensePlugin
MrsGazeboCommonResources_ParachutePlugin
MrsGazeboCommonResources_WaterGunPlugin
MrsGazeboCommonResources_GPSPlugin
MrsGazeboCommonResources_MagnetometerPlugin
MrsGazeboCommonResources_LightPlugin
MrsGazeboCommonResources_ServoCameraPlugin
MrsGazeboCommonResources_DynamicModelPlugin
MrsGazeboCommonResources_SafetyLedPlugin
MrsGazeboCommonResources_FluidResistancePlugin
MrsGazeboCommonResources_MotorSpeedRepublisherPlugin
MrsGazeboCommonResources_MotorPropModelPlugin
MrsGazeboCommonResources_LinkStaticTFPublisher
)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS ${CATKIN_DEPENDENCIES}
DEPENDS GAZEBO Qt5Widgets Boost Eigen OpenCV
LIBRARIES ${LIBRARIES}
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${GAZEBO_INCLUDE_DIRS}
${GAZEBO_MSG_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${catkin_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${Eigen_INCLUDE_DIRS}
)
link_directories(${GAZEBO_LIBRARY_DIRS})
## GUI plugins
add_library(MrsGazeboCommonResources_GuiManager SHARED
src/gui_plugins/gui_manager.cpp
)
target_link_libraries(MrsGazeboCommonResources_GuiManager
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Qt5Widgets_LIBRARIES}
)
## world plugins
add_library(MrsGazeboCommonResources_RvizCameraSynchronizer SHARED
src/world_plugins/rviz_cam_synchronizer.cpp
)
target_link_libraries(MrsGazeboCommonResources_RvizCameraSynchronizer
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
)
add_library(MrsGazeboCommonResources_StaticTransformRepublisher SHARED
src/world_plugins/static_transform_republisher.cpp
)
target_link_libraries(MrsGazeboCommonResources_StaticTransformRepublisher
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
)
## sensor and model plugins
add_library(MrsGazeboCommonResources_RangefinderPlugin SHARED
src/sensor_and_model_plugins/rangefinder_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_RangefinderPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
RayPlugin
)
add_library(MrsGazeboCommonResources_2DLidarPlugin SHARED
src/sensor_and_model_plugins/2dlidar_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_2DLidarPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
RayPlugin
)
add_library(MrsGazeboCommonResources_3DLidarPlugin SHARED
src/sensor_and_model_plugins/3dlidar_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_3DLidarPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
RayPlugin
)
add_library(MrsGazeboCommonResources_3DLidarGpuPlugin SHARED
src/sensor_and_model_plugins/3dlidar_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_3DLidarGpuPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
GpuRayPlugin
)
target_compile_definitions(MrsGazeboCommonResources_3DLidarGpuPlugin PRIVATE GAZEBO_GPU_RAY=1)
add_library(MrsGazeboCommonResources_CameraPlugin SHARED
src/sensor_and_model_plugins/camera_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_CameraPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
CameraPlugin
)
# RealsensePlugin
add_library(MrsGazeboCommonResources_RealsensePlugin SHARED
src/sensor_and_model_plugins/realsense_plugin.cpp
src/common/perlin_noise.cpp
)
target_link_libraries(MrsGazeboCommonResources_RealsensePlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${OpenCV_LIBRARIES}
)
# ParachutePlugin
add_library(MrsGazeboCommonResources_ParachutePlugin SHARED
src/sensor_and_model_plugins/parachute_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_ParachutePlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# WaterGunPlugin
add_library(MrsGazeboCommonResources_WaterGunPlugin SHARED
src/sensor_and_model_plugins/water_gun_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_WaterGunPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# GPSPlugin
add_library(MrsGazeboCommonResources_GPSPlugin SHARED
src/sensor_and_model_plugins/gps_plugin.cpp
${SEN_PROTO_SRCS}
)
target_link_libraries(MrsGazeboCommonResources_GPSPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# MagnetometerPlugin
add_library(MrsGazeboCommonResources_MagnetometerPlugin SHARED
src/sensor_and_model_plugins/magnetometer_plugin.cpp
src/common/geo_mag_declination.cpp ${SEN_PROTO_SRCS}
)
target_link_libraries(MrsGazeboCommonResources_MagnetometerPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# LightPlugin
add_library(MrsGazeboCommonResources_LightPlugin SHARED
src/sensor_and_model_plugins/light_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_LightPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# ServoCameraPlugin
add_library(MrsGazeboCommonResources_ServoCameraPlugin SHARED
src/sensor_and_model_plugins/servo_camera_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_ServoCameraPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# DynamicModelPlugin
add_library(MrsGazeboCommonResources_DynamicModelPlugin SHARED
src/sensor_and_model_plugins/dynamic_model_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_DynamicModelPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# SafetyLedPlugin
add_library(MrsGazeboCommonResources_SafetyLedPlugin SHARED
src/sensor_and_model_plugins/safety_led_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_SafetyLedPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# FluidResistancePlugin
add_library(MrsGazeboCommonResources_FluidResistancePlugin SHARED
src/physics_plugins/fluid_resistance_plugin.cpp
)
target_link_libraries(MrsGazeboCommonResources_FluidResistancePlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# MotorSpeedRepublisherPlugin
add_library(MrsGazeboCommonResources_MotorSpeedRepublisherPlugin SHARED
src/sensor_and_model_plugins/motor_speed_republisher.cpp
${SEN_PROTO_SRCS}
)
target_link_libraries(MrsGazeboCommonResources_MotorSpeedRepublisherPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# MotorPropModelPlugin
add_library(MrsGazeboCommonResources_MotorPropModelPlugin SHARED
src/physics_plugins/motor_prop_model_plugin.cpp
${SEN_PROTO_SRCS}
)
target_link_libraries(MrsGazeboCommonResources_MotorPropModelPlugin
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
# LinkStaticTFPublisher
add_library(MrsGazeboCommonResources_LinkStaticTFPublisher SHARED
src/sensor_and_model_plugins/link_static_tf_publisher.cpp
)
target_link_libraries(MrsGazeboCommonResources_LinkStaticTFPublisher
${GAZEBO_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
## --------------------------------------------------------------
## | Install |
## --------------------------------------------------------------
install(TARGETS ${LIBRARIES}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
install(DIRECTORY models/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/models
)
install(DIRECTORY worlds/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/worlds
)