This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
/
CMakeLists.txt
365 lines (307 loc) · 11 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
####################################################
# CMakeLists.txt for project sick_scan
#
#
####################################################
cmake_minimum_required(VERSION 2.8.3)
# build options: set OFF for relese version, ON for development and test
option(ENABLE_EMULATOR "Build emulator for offline and unittests" OFF) # OFF (release) or ON (development)
option(BUILD_DEBUG_TARGET "Build debug target" OFF) # OFF (release) or ON (development)
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
#
# Added CMP0048 to avoid unstable warning of build process
#
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
project(sick_scan)
macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif ()
else ()
set(CMAKE_CXX_STANDARD 11)
endif ()
endmacro(use_cxx11)
if(BUILD_DEBUG_TARGET)
set(CMAKE_BUILD_TYPE Debug) #uncomment to activate debug mode for lib_sick as well
set(CMAKE_ENABLE_EXPORTS 1) #uncomment to activate debug mode for lib_sick as well
# https://cmake.org/cmake/help/v3.5/prop_tgt/ENABLE_EXPORTS.html
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++03")
endif(BUILD_DEBUG_TARGET)
# Switch on, if you use c11-specific commands
use_cxx11()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-overflow")
# By uncommenting the following lines you can list all variable names ...
# --- CUT ---
# get_cmake_property(_variableNames VARIABLES)
# list (SORT _variableNames)
# foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()
# --- CUT ---
# For warning <catkin_workspace>/devel/include' should be placed in
# the devel space instead of the build space
# see: https://answers.ros.org/question/67244/qtcreator-with-catkin/
# message(${CMAKE_BINARY_DIR})
# set(CATKIN_DEVEL_PREFIX "${CMAKE_BINARY_DIR}/devel")
# set(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/devel;/opt/ros/melodic")
find_package(Boost REQUIRED COMPONENTS system serialization)
if(ENABLE_EMULATOR)
find_package(jsoncpp REQUIRED) # install libjsoncpp by running "sudo apt-get install libjsoncpp-dev"
endif(ENABLE_EMULATOR)
find_package(catkin REQUIRED COMPONENTS
roscpp
roslib # needed ros::package::getPath()
sensor_msgs
diagnostic_updater
dynamic_reconfigure
geometry_msgs
std_msgs
sensor_msgs
visualization_msgs
message_generation
tf
tf2
)
find_package(PkgConfig REQUIRED)
generate_dynamic_reconfigure_options(
cfg/SickScan.cfg
cfg/tf_dyn.cfg
)
# driver messages
add_message_files(
DIRECTORY msg
FILES
SickImu.msg
RadarObject.msg
RadarPreHeaderDeviceBlock.msg
RadarPreHeaderMeasurementParam1Block.msg
RadarPreHeaderStatusBlock.msg
RadarPreHeaderEncoderBlock.msg
RadarPreHeader.msg
RadarScan.msg
Encoder.msg
LFErecFieldMsg.msg
LFErecMsg.msg
LIDoutputstateMsg.msg
)
# driver services
add_service_files(
DIRECTORY srv
FILES
ColaMsgSrv.srv
ECRChangeArrSrv.srv
LIDoutputstateSrv.srv
)
if(ENABLE_EMULATOR)
# emulator messages
add_message_files(
DIRECTORY test/emulator/msg
FILES
SickLocColaTelegramMsg.msg
SickLocDiagnosticMsg.msg
SickLocResultPortCrcMsg.msg
SickLocResultPortHeaderMsg.msg
SickLocResultPortPayloadMsg.msg
SickLocResultPortTelegramMsg.msg
SickLocResultPortTestcaseMsg.msg
)
# emulator services
add_service_files(
DIRECTORY test/emulator/srv
FILES
SickLocColaTelegramSrv.srv
SickLocRequestTimestampSrv.srv
SickLocSetResultModeSrv.srv
SickLocSetResultPoseIntervalSrv.srv
SickLocIsSystemReadySrv.srv
SickLocSetPoseSrv.srv
SickLocSetResultPortSrv.srv
SickLocStartLocalizingSrv.srv
SickLocStopSrv.srv
SickLocRequestResultDataSrv.srv
SickLocSetResultEndiannessSrv.srv
SickLocSetResultPoseEnabledSrv.srv
SickLocStateSrv.srv
SickLocTimeSyncSrv.srv
SickDevGetLidarConfigSrv.srv
SickDevGetLidarIdentSrv.srv
SickDevGetLidarStateSrv.srv
SickDevSetLidarConfigSrv.srv
SickGetSoftwareVersionSrv.srv
SickLocAutoStartActiveSrv.srv
SickLocAutoStartSavePoseIntervalSrv.srv
SickLocAutoStartSavePoseSrv.srv
SickLocForceUpdateSrv.srv
SickLocInitializePoseSrv.srv
SickLocInitialPoseSrv.srv
SickLocMapSrv.srv
SickLocMapStateSrv.srv
SickLocOdometryActiveSrv.srv
SickLocOdometryPortSrv.srv
SickLocOdometryRestrictYMotionSrv.srv
SickLocReflectorsForSupportActiveSrv.srv
SickLocResultEndiannessSrv.srv
SickLocResultModeSrv.srv
SickLocResultPortSrv.srv
SickLocResultPoseIntervalSrv.srv
SickLocResultStateSrv.srv
SickLocRingBufferRecordingActiveSrv.srv
SickLocSaveRingBufferRecordingSrv.srv
SickLocSetAutoStartActiveSrv.srv
SickLocSetAutoStartSavePoseIntervalSrv.srv
SickLocSetMapSrv.srv
SickLocSetOdometryActiveSrv.srv
SickLocSetOdometryPortSrv.srv
SickLocSetOdometryRestrictYMotionSrv.srv
SickLocSetReflectorsForSupportActiveSrv.srv
SickLocSetRingBufferRecordingActiveSrv.srv
SickLocStartDemoMappingSrv.srv
SickReportUserMessageSrv.srv
SickSavePermanentSrv.srv
SickDevSetIMUActiveSrv.srv
SickDevIMUActiveSrv.srv
)
endif(ENABLE_EMULATOR)
generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
sensor_msgs
)
catkin_package(
CATKIN_DEPENDS message_runtime roscpp sensor_msgs diagnostic_updater dynamic_reconfigure pcl_conversions pcl_ros tf tf2
LIBRARIES sick_scan_lib
INCLUDE_DIRS include
DEPENDS Boost
)
include_directories(include include/tinyxml ${catkin_INCLUDE_DIRS} include/sick_scan)
add_library(sick_scan_lib
driver/src/dataDumper.cpp
driver/src/sick_scan_common.cpp
driver/src/abstract_parser.cpp
driver/src/tcp/tcp.cpp
driver/src/tcp/Mutex.cpp
driver/src/tcp/SickThread.cpp
driver/src/tcp/errorhandler.cpp
driver/src/tcp/toolbox.cpp
driver/src/tcp/Time.cpp
driver/src/tcp/colaa.cpp
driver/src/tcp/colab.cpp
driver/src/binScanf.cpp
driver/src/sick_scan_common_tcp.cpp
driver/src/sick_generic_radar.cpp
driver/src/sick_generic_imu.cpp
driver/src/sick_generic_parser.cpp
driver/src/sick_scan_common_nw.cpp
include/sick_scan/sick_scan_config_internal.h
driver/src/sick_scan_config_internal.cpp
include/sick_scan/softwarePLL.h
driver/src/softwarePLL.cpp
driver/src/helper/angle_compensator.cpp
driver/src/sick_generic_field_mon.cpp
driver/src/sick_scan_marker.cpp
driver/src/sick_scan_messages.cpp
driver/src/sick_scan_services.cpp
)
add_dependencies(sick_scan_lib ${PROJECT_NAME}_gencfg ${catkin_EXPORTED_TARGETS} ${${PROJECT_NAME}_EXPORTED_TARGETS})
target_link_libraries(sick_scan_lib
${catkin_LIBRARIES})
add_executable(sick_generic_caller
driver/src/sick_generic_laser.cpp
driver/src/sick_generic_caller.cpp
)
#
# radar_object_marker (receives radar msg. and publishes marker array for rviz or similar
#
add_executable(radar_object_marker
tools/radar_object_marker/src/radar_object_marker.cpp
tools/pcl_converter/src/gnuplotPaletteReader.cpp
include/radar_object_marker/radar_object_marker.h)
target_link_libraries(radar_object_marker sick_scan_lib ${catkin_LIBRARIES} ${Boost_LIBRARIES})
#
#
#
#
# pcl_converter disabled to avoid dependency to pcl
#
# add_executable(pcl_converter tools/pcl_converter/src/pcl_converter.cpp tools/pcl_converter/src/gnuplotPaletteReader.cpp)
#
# target_link_libraries(pcl_converter
# ${catkin_LIBRARIES})
target_link_libraries(sick_generic_caller sick_scan_lib)
add_executable(sick_scan_test
test/src/sick_scan_test.cpp
driver/src/tinyxml/tinystr.cpp
driver/src/tinyxml/tinyxml.cpp
driver/src/tinyxml/tinyxmlerror.cpp
driver/src/tinyxml/tinyxmlparser.cpp
)
target_link_libraries(sick_scan_test
${catkin_LIBRARIES}
${roslib_LIBRARIES}
sick_scan_lib)
install(TARGETS sick_scan_lib
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(
TARGETS
sick_generic_caller
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(
TARGETS
sick_scan_test
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(FILES include/${PROJECT_NAME}/abstract_parser.h
include/${PROJECT_NAME}/sick_scan_common.h
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(DIRECTORY test/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/test
FILES_MATCHING PATTERN "*.xml"
PATTERN "test/src" EXCLUDE)
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
install(DIRECTORY meshes/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/meshes)
install(DIRECTORY urdf/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/urdf)
if(ENABLE_EMULATOR)
#
# emulator
#
# message("ENABLE_EMULATOR: build with emulator...")
add_executable(sick_scan_emulator
test/emulator/src/test_server.cpp
test/emulator/src/test_server_thread.cpp
test/emulator/src/client_socket.cpp
test/emulator/src/cola_converter.cpp
test/emulator/src/cola_encoder.cpp
test/emulator/src/cola_parser.cpp
test/emulator/src/cola_transmitter.cpp
test/emulator/src/crc/crc16ccitt_false.cpp
test/emulator/src/pcapng_json_parser.cpp
test/emulator/src/random_generator.cpp
test/emulator/src/result_port_parser.cpp
test/emulator/src/ros_wrapper.cpp
test/emulator/src/SoftwarePLL.cpp
test/emulator/src/testcase_generator.cpp
test/emulator/src/utils.cpp
)
target_link_libraries(sick_scan_emulator
${catkin_LIBRARIES}
${roslib_LIBRARIES}
jsoncpp_lib # ${jsoncpp_LIBRARIES}
sick_scan_lib)
target_compile_definitions(sick_scan_emulator PUBLIC __ROS_VERSION=1)
target_include_directories(sick_scan_emulator PUBLIC test/emulator/include)
install(TARGETS sick_scan_emulator
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(DIRECTORY test/emulator/launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
install(DIRECTORY test/emulator/yaml/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/yaml)
install(DIRECTORY test/emulator/scandata/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/scandata)
endif(ENABLE_EMULATOR)