-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
218 lines (176 loc) · 5.12 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
cmake_minimum_required(VERSION 3.0.2)
project(rmagine_gazebo_plugins)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
add_compile_options(-std=c++17)
set(CMAKE_CXX_STANDARD 17)
# DEFAULT RELEASE
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
endif()
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
set(GZ_RM_DEPS
gazebo_ros
roscpp
sensor_msgs
)
find_package(catkin REQUIRED COMPONENTS
${GZ_RM_DEPS}
)
find_package(gazebo REQUIRED)
find_package(rmagine 2.2.1...
COMPONENTS
core
OPTIONAL_COMPONENTS
embree
cuda
optix
)
set(rmagine_gazebo_libs)
if(TARGET rmagine::embree)
list(APPEND rmagine_gazebo_libs rmagine_embree_spherical_gzplugin)
list(APPEND rmagine_gazebo_libs rmagine_embree_sensors_gzregister)
list(APPEND rmagine_gazebo_libs rmagine_embree_map_gzplugin)
list(APPEND rmagine_gazebo_libs rmagine_embree_ros_gzplugin)
endif(TARGET rmagine::embree)
if(TARGET rmagine::optix)
list(APPEND rmagine_gazebo_libs rmagine_optix_spherical_gzplugin)
list(APPEND rmagine_gazebo_libs rmagine_optix_sensors_gzregister)
list(APPEND rmagine_gazebo_libs rmagine_optix_map_gzplugin)
list(APPEND rmagine_gazebo_libs rmagine_optix_ros_gzplugin)
endif(TARGET rmagine::optix)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
${rmagine_gazebo_libs}
CATKIN_DEPENDS
${GZ_RM_DEPS}
DEPENDS
rmagine
)
# add_dependencies(${PROJECT_NAME}_gencfg ${catkin_EXPORTED_TARGETS})
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
${GAZEBO_MSG_INCLUDE_DIRS}
${GAZEBO_INCLUDE_DIRS}
)
#### ROS-less Gazebo plugins
add_library(rmagine_gazebo_helper SHARED
src/helper/helper_functions.cpp
src/helper/SceneState.cpp
src/helper/SceneDiff.cpp
src/helper/conversions.cpp
)
target_link_libraries(rmagine_gazebo_helper
${GAZEBO_LIBRARIES}
rmagine::core
)
if(TARGET rmagine::embree)
add_library(rmagine_embree_spherical_gzplugin SHARED
src/rmagine_embree_spherical_gzplugin.cpp
)
target_link_libraries(rmagine_embree_spherical_gzplugin
${GAZEBO_LIBRARIES}
rmagine::embree
)
add_library(rmagine_embree_sensors_gzregister SHARED
src/rmagine_embree_spherical_gzregister.cpp
)
target_link_libraries(rmagine_embree_sensors_gzregister
rmagine_embree_spherical_gzplugin
${GAZEBO_LIBRARIES}
rmagine::embree
)
add_library(rmagine_embree_map_gzplugin SHARED
src/rmagine_embree_map_gzplugin.cpp
src/helper/embree_conversions.cpp
)
target_link_libraries(rmagine_embree_map_gzplugin
rmagine_gazebo_helper
${GAZEBO_LIBRARIES}
rmagine::embree
)
# ROS Gazebo plugins
add_library(rmagine_embree_ros_gzplugin SHARED
src/rmagine_embree_ros_gzplugin.cpp)
target_link_libraries(rmagine_embree_ros_gzplugin
rmagine_embree_spherical_gzplugin
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
rmagine::embree
)
install(
TARGETS
rmagine_embree_map_gzplugin
rmagine_embree_spherical_gzplugin
rmagine_embree_sensors_gzregister
rmagine_embree_ros_gzplugin
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
endif(TARGET rmagine::embree)
### OPTIX
if(TARGET rmagine::optix)
#### ROS-less Gazebo plugins
add_library(rmagine_optix_spherical_gzplugin SHARED
src/rmagine_optix_spherical_gzplugin.cpp
)
target_link_libraries(rmagine_optix_spherical_gzplugin
${GAZEBO_LIBRARIES}
rmagine::optix
)
add_library(rmagine_optix_sensors_gzregister SHARED
src/rmagine_optix_spherical_gzregister.cpp
)
target_link_libraries(rmagine_optix_sensors_gzregister
rmagine_optix_spherical_gzplugin
${GAZEBO_LIBRARIES}
rmagine::optix
)
add_library(rmagine_optix_map_gzplugin SHARED
src/rmagine_optix_map_gzplugin.cpp
src/helper/optix_conversions.cpp
)
target_link_libraries(rmagine_optix_map_gzplugin
rmagine_optix_spherical_gzplugin
rmagine_gazebo_helper
${GAZEBO_LIBRARIES}
rmagine::optix
)
# ROS Gazebo plugins
add_library(rmagine_optix_ros_gzplugin SHARED
src/rmagine_optix_ros_gzplugin.cpp)
target_link_libraries(rmagine_optix_ros_gzplugin
rmagine_optix_spherical_gzplugin
${catkin_LIBRARIES}
${GAZEBO_LIBRARIES}
rmagine::optix
)
install(
TARGETS
rmagine_optix_map_gzplugin
rmagine_optix_spherical_gzplugin
rmagine_optix_sensors_gzregister
rmagine_optix_ros_gzplugin
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
endif(TARGET rmagine::optix)