forked from roboticslibrary/rl
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
289 lines (247 loc) · 9.06 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
cmake_minimum_required(VERSION 2.8.11)
project(rl)
enable_testing()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations -fno-inline-functions")
include(CMakeDependentOption)
include(GNUInstallDirs)
set(VERSION_MAJOR 0)
set(VERSION_MINOR 6)
set(VERSION_PATCH 2)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
set(Boost_ADDITIONAL_VERSIONS "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47")
option(BUILD_DEMOS "Build demos" TRUE)
option(BUILD_EXTRAS "Build extras" TRUE)
option(BUILD_RL_MATH "Build RL::MATH" TRUE)
option(BUILD_RL_UTIL "Build RL::UTIL" TRUE)
option(BUILD_RL_XML "Build RL::XML" TRUE)
option(BUILD_TESTS "Build tests" TRUE)
cmake_dependent_option(BUILD_RL_HAL "Build RL::HAL" ON "BUILD_RL_MATH;BUILD_RL_UTIL" OFF)
cmake_dependent_option(BUILD_RL_KIN "Build RL::KIN" ON "BUILD_RL_MATH;BUILD_RL_XML" OFF)
cmake_dependent_option(BUILD_RL_MDL "Build RL::MDL" ON "BUILD_RL_MATH;BUILD_RL_XML" OFF)
cmake_dependent_option(BUILD_RL_SG "Build RL::SG" ON "BUILD_RL_MATH;BUILD_RL_UTIL;BUILD_RL_XML" OFF)
cmake_dependent_option(BUILD_RL_PLAN "Build RL::PLAN" ON "BUILD_RL_KIN;BUILD_RL_MATH;BUILD_RL_MDL;BUILD_RL_SG;BUILD_RL_UTIL;BUILD_RL_XML" OFF)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
add_definitions(-DEIGEN_DONT_ALIGN)
endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
if(WIN32)
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
-D_USE_MATH_DEFINES
-D_WIN32_WINNT=0x400
-DNOMINMAX
)
endif(WIN32)
include_directories(${rl_SOURCE_DIR}/src)
if(BUILD_RL_MATH)
add_subdirectory(src/rl/math)
if(BUILD_DEMOS)
add_subdirectory(demos/rlDenavitHartenbergDemo)
add_subdirectory(demos/rlInterpolatorDemo)
add_subdirectory(demos/rlKalmanDemo)
add_subdirectory(demos/rlPcaDemo)
add_subdirectory(demos/rlQuaternionDemo)
#add_subdirectory(demos/rlRodriguesDemo)
add_subdirectory(demos/rlSpatialDemo)
add_subdirectory(demos/rlTrapezoidalVelocityDemo)
endif(BUILD_DEMOS)
set(RL_MATH_FOUND TRUE)
set(TARGETS ${TARGETS} rlmath)
endif(BUILD_RL_MATH)
if(BUILD_RL_UTIL)
add_subdirectory(src/rl/util)
if(BUILD_DEMOS)
add_subdirectory(demos/rlThreadsDemo)
add_subdirectory(demos/rlTimerDemo)
endif(BUILD_DEMOS)
set(RL_UTIL_FOUND TRUE)
set(TARGETS ${TARGETS} rlutil)
endif(BUILD_RL_UTIL)
if(BUILD_RL_XML)
add_subdirectory(src/rl/xml)
if(BUILD_DEMOS)
add_subdirectory(demos/rlLoadXmlDemo)
endif(BUILD_DEMOS)
set(RL_XML_FOUND TRUE)
set(TARGETS ${TARGETS} rlxml)
endif(BUILD_RL_XML)
if(BUILD_RL_KIN)
add_subdirectory(src/rl/kin)
if(BUILD_DEMOS)
add_subdirectory(demos/rlJacobianDemo)
add_subdirectory(demos/rlPumaDemo)
endif(BUILD_DEMOS)
if(BUILD_TESTS)
add_subdirectory(tests/rlInverseKinematicsTest)
endif(BUILD_TESTS)
set(RL_KIN_FOUND TRUE)
set(TARGETS ${TARGETS} rlkin)
endif(BUILD_RL_KIN)
if(BUILD_RL_MDL)
add_subdirectory(src/rl/mdl)
if(BUILD_DEMOS)
add_subdirectory(demos/rlDynamics1Demo)
add_subdirectory(demos/rlDynamics2Demo)
add_subdirectory(demos/rlInversePositionDemo)
endif(BUILD_DEMOS)
if(BUILD_TESTS)
add_subdirectory(tests/rlDynamicsTest)
endif(BUILD_TESTS)
set(RL_MDL_FOUND TRUE)
set(TARGETS ${TARGETS} rlmdl)
endif(BUILD_RL_MDL)
if(BUILD_RL_HAL)
add_subdirectory(src/rl/hal)
if(BUILD_DEMOS)
add_subdirectory(demos/rlAxisControllerDemo)
add_subdirectory(demos/rlCameraDemo)
add_subdirectory(demos/rlGripperDemo)
add_subdirectory(demos/rlLaserDemo)
add_subdirectory(demos/rlRangeSensorDemo)
add_subdirectory(demos/rlSixAxisForceTorqueSensorDemo)
endif(BUILD_DEMOS)
if(BUILD_TESTS)
add_subdirectory(tests/rlHalEndianTest)
endif(BUILD_TESTS)
set(RL_HAL_FOUND TRUE)
set(TARGETS ${TARGETS} rlhal)
endif(BUILD_RL_HAL)
if(BUILD_RL_SG)
add_subdirectory(src/rl/sg)
if(BUILD_DEMOS)
add_subdirectory(demos/rlCollisionDemo)
add_subdirectory(demos/rlViewDemo)
endif(BUILD_DEMOS)
set(RL_SG_FOUND TRUE)
set(TARGETS ${TARGETS} rlsg)
endif(BUILD_RL_SG)
if(BUILD_RL_KIN AND BUILD_RL_SG)
if(BUILD_DEMOS)
add_subdirectory(demos/rlCoachKin)
endif(BUILD_DEMOS)
endif(BUILD_RL_KIN AND BUILD_RL_SG)
if(BUILD_RL_MDL AND BUILD_RL_SG)
if(BUILD_DEMOS)
add_subdirectory(demos/rlCoachMdl)
endif(BUILD_DEMOS)
endif(BUILD_RL_MDL AND BUILD_RL_SG)
if(BUILD_RL_PLAN)
add_subdirectory(src/rl/plan)
if(BUILD_DEMOS)
add_subdirectory(demos/rlPlanDemo)
add_subdirectory(demos/rlPrmDemo)
endif(BUILD_DEMOS)
if(BUILD_TESTS)
add_subdirectory(tests/rlPrmTest)
endif(BUILD_TESTS)
set(RL_PLAN_FOUND TRUE)
set(TARGETS ${TARGETS} rlplan)
endif(BUILD_RL_PLAN)
add_subdirectory(examples)
if(BUILD_EXTRAS)
add_subdirectory(extras/wrlview)
endif(BUILD_EXTRAS)
if(UNIX)
install(FILES robotics-library.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps COMPONENT demos)
endif(UNIX)
find_package(Doxygen)
find_package(LATEX)
if(DOXYGEN_FOUND)
option(BUILD_DOCUMENTATION "Build documentation" FALSE)
configure_file(${rl_SOURCE_DIR}/Doxyfile.in ${rl_BINARY_DIR}/Doxyfile)
if(BUILD_DOCUMENTATION)
add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${rl_BINARY_DIR}/Doxyfile)
else(BUILD_DOCUMENTATION)
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${rl_BINARY_DIR}/Doxyfile)
endif(BUILD_DOCUMENTATION)
file(MAKE_DIRECTORY ${rl_BINARY_DIR}/doc)
install(DIRECTORY ${rl_BINARY_DIR}/doc/ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT documentation)
endif(DOXYGEN_FOUND)
set(CPACK_COMPONENT_DEMOS_DEPENDS examples libraries)
set(CPACK_COMPONENT_DEMOS_DISPLAY_NAME "Demos")
set(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
set(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples")
set(CPACK_COMPONENT_EXTRAS_DISPLAY_NAME "Extras")
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Headers")
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENTS_ALL demos documentation examples extras headers libraries)
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.roboticslibrary.org/")
set(CPACK_DEBIAN_PACKAGE_NAME "librl")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(
CPACK_NSIS_MENU_LINKS
"http://www.roboticslibrary.org/" "RL"
"https://github.com/roboticslibrary" "RL on GitHub"
"https://launchpad.net/roblib" "RL on Launchpad"
"http://sourceforge.net/projects/roblib" "RL on SourceForge"
"http://www.youtube.com/roboticslibrary" "RL on YouTube"
)
set(CPACK_NSIS_PACKAGE_NAME "Robotics Library ${VERSION}")
set(CPACK_NSIS_URL_INFO_ABOUT ${CPACK_DEBIAN_PACKAGE_HOMEPAGE})
set(CPACK_PACKAGE_CONTACT "Robotics Library Team <roblib-developers@lists.sourceforge.net>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Robotics Library is a self-contained C++ library for robot kinematics, visualization, motion planning, and control.")
set(CPACK_PACKAGE_DISPLAY_NAME "Robotics Library ${VERSION}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "rl-${VERSION}")
set(CPACK_PACKAGE_NAME "rl")
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_demos_PACKAGE_REQUIRES "rl-examples")
set(CPACK_RPM_headers_PACKAGE_SUGGESTS "rl-documentation rl-libraries")
set(CPACK_RPM_libraries_PACKAGE_SUGGESTS "rl-demos rl-examples")
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
set(CPACK_RPM_PACKAGE_LICENSE "BSD")
set(CPACK_RPM_PACKAGE_NAME "rl")
set(CPACK_RPM_PACKAGE_SUMMARY "Robotics Library")
set(CPACK_RPM_PACKAGE_URL ${CPACK_DEBIAN_PACKAGE_HOMEPAGE})
if(WIN32)
if(CMAKE_CL_64)
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") # http://public.kitware.com/Bug/view.php?id=14211
endif()
endif()
string(REPLACE ";" "
" CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}")
string(REPLACE ";" "
" CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}")
include(CPack)
include(CMakePackageConfigHelpers)
set(RL_LIBRARIES ${TARGETS})
set(INTERFACE_INCLUDE_DIRECTORIES ${rl_SOURCE_DIR}/src)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/rl-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/rl-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/rl
)
export(TARGETS ${TARGETS} FILE ${CMAKE_CURRENT_BINARY_DIR}/rl-export.cmake)
set(INTERFACE_INCLUDE_DIRECTORIES \${PACKAGE_PREFIX_DIR}/include)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/rl-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/rl-config-install.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/rl
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/rl-config-install.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/rl
RENAME rl-config.cmake
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/rl-config-version.cmake
VERSION ${VERSION}
COMPATIBILITY ExactVersion
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/rl-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/rl
)
if(DEFINED TARGETS)
install(
EXPORT rl
DESTINATION ${CMAKE_INSTALL_LIBDIR}/rl
FILE rl-export.cmake
)
endif()