-
Notifications
You must be signed in to change notification settings - Fork 98
/
CMakeLists.txt
228 lines (208 loc) · 4.92 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
include (${sdf_cmake_dir}/SDFUtils.cmake)
link_directories(
${PROJECT_BINARY_DIR}/test
)
if (NOT USE_INTERNAL_URDF)
link_directories(${URDF_LIBRARY_DIRS})
endif()
set (sources
Actor.cc
AirPressure.cc
Altimeter.cc
Atmosphere.cc
Box.cc
Camera.cc
Capsule.cc
Collision.cc
Console.cc
Converter.cc
Cylinder.cc
Element.cc
Ellipsoid.cc
EmbeddedSdf.cc
Error.cc
Exception.cc
Frame.cc
FrameSemantics.cc
Filesystem.cc
ForceTorque.cc
Geometry.cc
Gui.cc
Heightmap.cc
ign.cc
Imu.cc
Joint.cc
JointAxis.cc
Lidar.cc
Light.cc
Link.cc
Magnetometer.cc
Material.cc
Mesh.cc
Model.cc
Noise.cc
parser.cc
parser_urdf.cc
ParserConfig.cc
Param.cc
Pbr.cc
Physics.cc
Plane.cc
Root.cc
Scene.cc
SDF.cc
SDFExtension.cc
SemanticPose.cc
Sensor.cc
Sky.cc
Sphere.cc
Surface.cc
Types.cc
Utils.cc
Visual.cc
World.cc
XmlUtils.cc
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if (USE_INTERNAL_URDF)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/urdf)
set(sources ${sources}
urdf/urdf_parser/model.cpp
urdf/urdf_parser/link.cpp
urdf/urdf_parser/joint.cpp
urdf/urdf_parser/pose.cpp
urdf/urdf_parser/twist.cpp
urdf/urdf_parser/urdf_model_state.cpp
urdf/urdf_parser/urdf_sensor.cpp
urdf/urdf_parser/world.cpp)
else()
include_directories(${URDF_INCLUDE_DIRS})
endif()
if (BUILD_SDF_TEST)
set (gtest_sources
Actor_TEST.cc
AirPressure_TEST.cc
Altimeter_TEST.cc
Atmosphere_TEST.cc
Box_TEST.cc
Camera_TEST.cc
Capsule_TEST.cc
Collision_TEST.cc
Console_TEST.cc
Cylinder_TEST.cc
Element_TEST.cc
Ellipsoid_TEST.cc
Error_TEST.cc
Exception_TEST.cc
Frame_TEST.cc
Filesystem_TEST.cc
ForceTorque_TEST.cc
Geometry_TEST.cc
Gui_TEST.cc
Heightmap_TEST.cc
Imu_TEST.cc
Joint_TEST.cc
JointAxis_TEST.cc
Lidar_TEST.cc
Light_TEST.cc
Link_TEST.cc
Magnetometer_TEST.cc
Material_TEST.cc
Mesh_TEST.cc
Model_TEST.cc
Noise_TEST.cc
Param_TEST.cc
parser_TEST.cc
ParserConfig_TEST.cc
Pbr_TEST.cc
Physics_TEST.cc
Plane_TEST.cc
Root_TEST.cc
Scene_TEST.cc
SemanticPose_TEST.cc
SDF_TEST.cc
Sensor_TEST.cc
Sky_TEST.cc
Sphere_TEST.cc
Surface_TEST.cc
Types_TEST.cc
Visual_TEST.cc
World_TEST.cc
)
# Build this test file only if Ignition Tools is installed.
if (IGNITION-TOOLS_BINARY_DIRS)
set (gtest_sources ${gtest_sources}
ign_TEST.cc
)
endif()
sdf_build_tests(${gtest_sources})
if (TARGET UNIT_ign_TEST)
# Link the libraries that we always need.
target_link_libraries("UNIT_ign_TEST"
PUBLIC
ignition-cmake${IGN_CMAKE_VER}::utilities
)
endif()
if (NOT WIN32)
set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc)
sdf_build_tests(Utils_TEST.cc)
endif()
if (NOT WIN32)
set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS XmlUtils.cc)
sdf_build_tests(XmlUtils_TEST.cc)
target_link_libraries(UNIT_XmlUtils_TEST PRIVATE
${TinyXML2_LIBRARIES})
endif()
if (NOT WIN32)
set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc)
sdf_build_tests(FrameSemantics_TEST.cc)
endif()
if (NOT WIN32)
set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc EmbeddedSdf.cc XmlUtils.cc)
sdf_build_tests(Converter_TEST.cc)
target_link_libraries(UNIT_Converter_TEST PRIVATE
${TinyXML2_LIBRARIES})
endif()
if (NOT WIN32)
set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS SDFExtension.cc parser_urdf.cc XmlUtils.cc)
sdf_build_tests(parser_urdf_TEST.cc)
if (NOT USE_INTERNAL_URDF)
target_compile_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_CFLAGS})
if (${CMAKE_VERSION} VERSION_GREATER 3.13)
target_link_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_LDFLAGS})
endif()
target_link_libraries(UNIT_parser_urdf_TEST PRIVATE ${URDF_LIBRARIES})
endif()
target_link_libraries(UNIT_parser_urdf_TEST PRIVATE
${TinyXML2_LIBRARIES})
endif()
endif()
sdf_add_library(${sdf_target} ${sources})
target_compile_features(${sdf_target} PUBLIC cxx_std_17)
target_link_libraries(${sdf_target}
PUBLIC
ignition-math${IGN_MATH_VER}::ignition-math${IGN_MATH_VER}
ignition-utils${IGN_UTILS_VER}::ignition-utils${IGN_UTILS_VER}
PRIVATE
${TinyXML2_LIBRARIES})
if (WIN32)
target_compile_definitions(${sdf_target} PRIVATE URDFDOM_STATIC)
endif()
target_include_directories(${sdf_target}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/..>
)
message (STATUS "URDF_LIBRARY_DIRS=${URDF_LIBRARY_DIRS}")
message (STATUS "URDF_LIBRARIES=${URDF_LIBRARIES}")
if (NOT USE_INTERNAL_URDF)
target_compile_options(${sdf_target} PRIVATE ${URDF_CFLAGS})
if (${CMAKE_VERSION} VERSION_GREATER 3.13)
target_link_options(${sdf_target} PRIVATE ${URDF_LDFLAGS})
endif()
target_link_libraries(${sdf_target} PRIVATE ${URDF_LIBRARIES})
endif()
sdf_install_library(${sdf_target})
if(NOT WIN32)
add_subdirectory(cmd)
endif()