-
Notifications
You must be signed in to change notification settings - Fork 492
/
Copy pathgazebo-config.cmake.in
232 lines (197 loc) · 8.7 KB
/
gazebo-config.cmake.in
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
if (@PKG_NAME@_CONFIG_INCLUDED)
return()
endif()
set(@PKG_NAME@_CONFIG_INCLUDED TRUE)
set(@PKG_NAME@_VERSION @GAZEBO_VERSION@)
set(@PKG_NAME@_MAJOR_VERSION @GAZEBO_MAJOR_VERSION@)
@PACKAGE_INIT@
# Including Dartsim will overwrite the PACKAGE_PREFIX_DIR, therefore make gazebo-specific vars
set(GAZEBO_INSTALL_DATAROOT_DIR @PACKAGE_DATAROOT_INSTALL_DIR@)
set(GAZEBO_INSTALL_LIB_DIR @PACKAGE_LIB_INSTALL_DIR@)
set(GAZEBO_INSTALL_INCLUDE_DIR @PACKAGE_BASE_INSTALL_INCLUDEDIR@)
set(@PKG_NAME@_PLUGIN_PATH "${GAZEBO_INSTALL_LIB_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/plugins")
# The media path contains the location on disk where images,
# materials scripts, shaders, and other related resources are stored.
set(@PKG_NAME@_MEDIA_PATH "${GAZEBO_INSTALL_DATAROOT_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/media")
# The model path contains the location on disk where models are stored.
set(@PKG_NAME@_MODEL_PATH "${GAZEBO_INSTALL_DATAROOT_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/models")
# Set whether Gazebo was built with Bullet support
set (GAZEBO_HAS_BULLET @HAVE_BULLET@)
# Set whether Gazebo was built with Simbody support
set (GAZEBO_HAS_SIMBODY @HAVE_SIMBODY@)
# Set whether Gazebo was built with Simbody support
set (GAZEBO_HAS_DART @HAVE_DART@)
set (GAZEBO_DART_MIN_REQUIRED_VERSION @DART_MIN_REQUIRED_VERSION@)
set (GAZEBO_HAS_DART_BULLET @HAVE_DART_BULLET@)
# Set whether Gazebo was built with Ignition Fuel Tools support
set (GAZEBO_HAS_IGNITION_FUEL_TOOLS @HAVE_IGNITION_FUEL_TOOLS@)
find_package(PkgConfig)
#################################################
# @PKG_NAME@_PROTO_PATH, @PKG_NAME@_PROTO_INCLUDE_DIRS, and
# @PKG_NAME@_PROTO_LIBRARIES
#
# These three variables allow Gazebo messages to be used in other projects.
#
# The following examples are for demonstration purposes and are
# incomplete. The first example shows how to use a Gazebo message in a
# custom proto file. The second example shows how to run 'protoc' against
# custom proto files that make use Gazebo message definitions. The third
# example shows how to include the correct directory when compiling a library
# or executable that uses your custom messages.
#
# 1. Use a Gazebo message in a custom proto file:
#
# package my.msgs;
# import "vector3d.proto";
#
# message MyMessage
# {
# required gazebo.msgs.Vector3d p = 1;
# }
#
# 2. Run protoc from a CMakeLists.txt to generate your message's
# header and source files:
#
# add_custom_command(
# OUTPUT
# "${proto_filename}.pb.cc"
# "${proto_filename}.pb.h"
# COMMAND protoc
# ARGS --proto_path ${GAZEBO_PROTO_PATH} ${proto_file_out}
# COMMENT "Running C++ protocol buffer compiler on ${proto_filename}"
# VERBATIM)
#
# 3. When compiling your library or executable, make sure to use the following
# in the CMakeLists.txt file:
#
# include_directories(@PKG_NAME@_PROTO_INCLUDE_DIRS)
# target_link_libraries(your_package @PKG_NAME@_PROTO_LIBRARIES)
#
set(@PKG_NAME@_PROTO_PATH
"${GAZEBO_INSTALL_INCLUDE_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/gazebo/msgs/proto")
find_library(gazebo_proto_msgs_lib gazebo_msgs
PATHS "${GAZEBO_INSTALL_LIB_DIR}" NO_DEFAULT_PATH)
list(APPEND @PKG_NAME@_PROTO_LIBRARIES ${gazebo_proto_msgs_lib})
list(APPEND @PKG_NAME@_PROTO_INCLUDE_DIRS
"${GAZEBO_INSTALL_INCLUDE_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/gazebo/msgs")
# End @PKG_NAME@_PROTO_PATH, @PKG_NAME@_PROTO_INCLUDE_DIRS, and
# @PKG_NAME@_PROTO_LIBRARIES
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${GAZEBO_INSTALL_INCLUDE_DIR})
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${GAZEBO_INSTALL_INCLUDE_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@)
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${GAZEBO_INSTALL_LIB_DIR})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${GAZEBO_INSTALL_LIB_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/plugins)
list(APPEND @PKG_NAME@_CFLAGS -I${GAZEBO_INSTALL_INCLUDE_DIR})
list(APPEND @PKG_NAME@_CFLAGS -I${GAZEBO_INSTALL_INCLUDE_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@)
if (GAZEBO_HAS_BULLET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(BULLET bullet>=2.82)
if (NOT BULLET_FOUND)
pkg_check_modules(BULLET bullet2.82>=2.82)
endif()
if (BULLET_FOUND)
add_definitions(-DLIBBULLET_VERSION=${BULLET_VERSION})
else()
message(FATAL_ERROR "Error: Bullet > 2.82 not found, please install libbullet2.82-dev.")
endif()
if (BULLET_VERSION VERSION_GREATER 2.82)
add_definitions(-DLIBBULLET_VERSION_GT_282)
endif()
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${BULLET_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${BULLET_LIBRARY_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${BULLET_LIBRARIES})
else()
message(FATAL_ERROR "Error: pkg-config not found.")
endif()
endif()
if (GAZEBO_HAS_SIMBODY)
find_package(Simbody REQUIRED)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${Simbody_INCLUDE_DIR})
list(APPEND @PKG_NAME@_LIBRARIES ${Simbody_LIBRARIES})
endif()
if (GAZEBO_HAS_DART)
find_package(DART ${GAZEBO_DART_MIN_REQUIRED_VERSION} REQUIRED CONFIG)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${DART_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${DART_LIBRARIES})
endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND
"${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(@PKG_NAME@_CXX_FLAGS "${@PKG_NAME@_CXX_FLAGS} -stdlib=libc++")
endif ()
foreach(lib @PKG_LIBRARIES@)
set(onelib "${lib}-NOTFOUND")
find_library(onelib ${lib}
PATHS "${GAZEBO_INSTALL_LIB_DIR}"
NO_DEFAULT_PATH
)
if(NOT onelib)
message(FATAL_ERROR "Library '${lib}' in package @PKG_NAME@ is not installed properly")
endif()
list(APPEND @PKG_NAME@_LIBRARIES ${onelib})
endforeach()
# Get the install prefix for OGRE
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=prefix OGRE
OUTPUT_VARIABLE OGRE_INSTALL_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE)
# Add the OGRE cmake path to CMAKE_MODULE_PATH
set(CMAKE_MODULE_PATH
"${OGRE_INSTALL_PREFIX}/share/OGRE/cmake/modules;${OGRE_INSTALL_PREFIX}/lib/OGRE/cmake;${OGRE_INSTALL_PREFIX}/CMake;${CMAKE_MODULE_PATH}")
# Find boost
find_package(Boost @MIN_BOOST_VERSION@ REQUIRED thread system
filesystem program_options regex iostreams date_time)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${Boost_LIBRARIES})
# Find protobuf
find_package(Protobuf REQUIRED)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${PROTOBUF_LIBRARIES})
# Find SDFormat
find_package(sdformat9 REQUIRED VERSION 9.8)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${SDFormat_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${SDFormat_LIBRARIES})
# Find OGRE
find_package(OGRE REQUIRED COMPONENTS Terrain Paging)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${OGRE_LIBRARIES})
# When including OGRE, also include the Terrain and Paging components
list(APPEND GAZEBO_INCLUDE_DIRS
${OGRE_Terrain_INCLUDE_DIRS}
${OGRE_Paging_INCLUDE_DIRS}
${OGRE-Terrain_INCLUDE_DIRS}
${OGRE-Paging_INCLUDE_DIRS})
list(APPEND GAZEBO_LIBRARIES
${OGRE_Terrain_LIBRARIES}
${OGRE_Paging_LIBRARIES}
${OGRE-Terrain_LIBRARIES}
${OGRE-Paging_LIBRARIES})
# Find Ignition Math
find_package(ignition-math6 REQUIRED)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${IGNITION-MATH_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${IGNITION-MATH_LIBRARY_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${IGNITION-MATH_LIBRARIES})
# Find Ignition Transport
find_package(ignition-transport8 REQUIRED)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${IGNITION-TRANSPORT_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${IGNITION-TRANSPORT_LIBRARY_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${IGNITION-TRANSPORT_LIBRARIES})
# Find Ignition Msgs
find_package(ignition-msgs5 REQUIRED)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${IGNITION-MSGS_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${IGNITION-MSGS_LIBRARY_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${IGNITION-MSGS_LIBRARIES})
find_package(ignition-common3 REQUIRED COMPONENTS graphics)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${ignition-common3_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${ignition-common3_LIBRARY_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ignition-common3::ignition-common3-graphics)
find_package(ignition-fuel_tools4 REQUIRED)
list(APPEND @PKG_NAME@_INCLUDE_DIRS ${IGNITION-FUEL_TOOLS_INCLUDE_DIRS})
list(APPEND @PKG_NAME@_LIBRARY_DIRS ${IGNITION-FUEL_TOOLS_LIBRARY_DIRS})
list(APPEND @PKG_NAME@_LIBRARIES ${IGNITION-FUEL_TOOLS_LIBRARIES})
list(APPEND @PKG_NAME@_LDFLAGS -Wl,-rpath,${GAZEBO_INSTALL_LIB_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/plugins)
list(APPEND @PKG_NAME@_LDFLAGS -L${GAZEBO_INSTALL_LIB_DIR})
list(APPEND @PKG_NAME@_LDFLAGS -L${GAZEBO_INSTALL_LIB_DIR}/gazebo-@GAZEBO_MAJOR_VERSION@/plugins)
set (GAZEBO_HAS_TBB_GREATER_OR_EQUAL_2021 @HAVE_TBB_GREATER_OR_EQUAL_2021@)
if (GAZEBO_HAS_TBB_GREATER_OR_EQUAL_2021)
find_package(TBB CONFIG)
if (TARGET TBB::tbb)
list(APPEND @PKG_NAME@_LIBRARIES TBB::tbb)
endif ()
endif ()