@@ -37,28 +37,41 @@ set(CXX_DISABLE_WERROR TRUE)
37
37
38
38
set (PROJECT_NAME coal)
39
39
set (PROJECT_ORG "coal-library" )
40
- set (PROJECT_DESCRIPTION
40
+ set (
41
+ PROJECT_DESCRIPTION
41
42
"Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library"
42
- )
43
+ )
43
44
set (PROJECT_URL "https://github.com/coal-library/coal" )
44
- SET (PROJECT_USE_CMAKE_EXPORT TRUE )
45
- SET (PROJECT_COMPATIBILITY_VERSION AnyNewerVersion)
45
+ set (PROJECT_USE_CMAKE_EXPORT TRUE )
46
+ set (PROJECT_COMPATIBILITY_VERSION AnyNewerVersion)
46
47
# To enable jrl-cmakemodules compatibility with workspace we must define the two
47
48
# following lines
48
49
set (PROJECT_AUTO_RUN_FINALIZE FALSE )
49
50
set (PROJECT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} )
50
51
51
- SET (PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE )
52
- SET (DOXYGEN_USE_TEMPLATE_CSS TRUE )
52
+ set (PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE )
53
+ set (DOXYGEN_USE_TEMPLATE_CSS TRUE )
53
54
54
55
# ----------------------------------------------------
55
56
# --- OPTIONS ---------------------------------------
56
57
# Need to be set before including base.cmake
57
58
# ----------------------------------------------------
58
59
option (INSTALL_DOCUMENTATION "Generate and install the documentation" OFF )
59
- option (COAL_TURN_ASSERT_INTO_EXCEPTION "Turn some critical Coal asserts to exception." FALSE )
60
- option (COAL_ENABLE_LOGGING "Activate logging for warnings or error messages. Turned on by default in Debug." FALSE )
61
- option (COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL "Make Coal retro-compatible with HPP-FCL." FALSE )
60
+ option (
61
+ COAL_TURN_ASSERT_INTO_EXCEPTION
62
+ "Turn some critical Coal asserts to exception."
63
+ FALSE
64
+ )
65
+ option (
66
+ COAL_ENABLE_LOGGING
67
+ "Activate logging for warnings or error messages. Turned on by default in Debug."
68
+ FALSE
69
+ )
70
+ option (
71
+ COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL
72
+ "Make Coal retro-compatible with HPP-FCL."
73
+ FALSE
74
+ )
62
75
63
76
# Check if the submodule cmake have been initialized
64
77
set (JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR} /cmake" )
@@ -70,22 +83,24 @@ else()
70
83
get_property (
71
84
JRL_CMAKE_MODULES
72
85
TARGET jrl-cmakemodules::jrl-cmakemodules
73
- PROPERTY INTERFACE_INCLUDE_DIRECTORIES )
86
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES
87
+ )
74
88
message (STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES} " )
75
89
elseif (${CMAKE_VERSION} VERSION_LESS "3.14.0" )
76
90
message (
77
91
FATAL_ERROR
78
- "\n Can't find jrl-cmakemodules. Please either:\n "
79
- " - use git submodule: 'git submodule update --init'\n "
80
- " - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n "
81
- " - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n "
92
+ "\n Can't find jrl-cmakemodules. Please either:\n "
93
+ " - use git submodule: 'git submodule update --init'\n "
94
+ " - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n "
95
+ " - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n "
82
96
)
83
97
else ()
84
98
message (STATUS "JRL cmakemodules not found. Let's fetch it." )
85
99
include (FetchContent)
86
100
FetchContent_Declare(
87
101
"jrl-cmakemodules"
88
- GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git" )
102
+ GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git"
103
+ )
89
104
FetchContent_MakeAvailable("jrl-cmakemodules" )
90
105
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
91
106
endif ()
@@ -94,60 +109,76 @@ endif()
94
109
# Use BoostConfig module distributed by boost library instead of using FindBoost module distributed
95
110
# by CMake.
96
111
# There is one unresolved issue with FindBoost and clang-cl so we deactivate it in this case.
97
- IF (NOT WIN32 OR NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" )
98
- IF (POLICY CMP0167)
99
- CMAKE_POLICY (SET CMP0167 NEW)
112
+ if (NOT WIN32 OR NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" )
113
+ if (POLICY CMP0167)
114
+ cmake_policy (SET CMP0167 NEW)
100
115
# Set a default value to this policy to avoid issue with find_dependency
101
116
# macro redefinition with different policy in some modules.
102
- SET (CMAKE_POLICY_DEFAULT_CMP0167 NEW)
103
- ENDIF ()
104
- ENDIF ()
117
+ set (CMAKE_POLICY_DEFAULT_CMP0167 NEW)
118
+ endif ()
119
+ endif ()
105
120
106
121
include ("${JRL_CMAKE_MODULES} /base.cmake" )
107
122
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
108
- PROJECT (${PROJECT_NAME} ${PROJECT_ARGS} )
123
+ project (${PROJECT_NAME} ${PROJECT_ARGS} )
109
124
110
125
include ("${JRL_CMAKE_MODULES} /boost.cmake" )
111
126
include ("${JRL_CMAKE_MODULES} /python.cmake" )
112
127
include ("${JRL_CMAKE_MODULES} /apple.cmake" )
113
128
include ("${JRL_CMAKE_MODULES} /ide.cmake" )
114
129
include (CMakeDependentOption)
115
130
116
- SET (CMAKE_MODULE_PATH
131
+ set (
132
+ CMAKE_MODULE_PATH
117
133
${JRL_CMAKE_MODULES} /find -external/assimp/
118
- ${CMAKE_MODULE_PATH} )
134
+ ${CMAKE_MODULE_PATH}
135
+ )
119
136
120
- FUNCTION (set_standard_output_directory target )
121
- SET_TARGET_PROPERTIES (
137
+ function (set_standard_output_directory target )
138
+ set_target_properties (
122
139
${target}
123
140
PROPERTIES
124
141
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} /bin
125
142
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} /lib
126
143
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} /lib
127
144
)
128
- ENDFUNCTION ()
145
+ endfunction ()
129
146
130
- set_default_cmake_build_type ("RelWithDebInfo" )
147
+ SET_DEFAULT_CMAKE_BUILD_TYPE ("RelWithDebInfo" )
131
148
132
149
# If needed, fix CMake policy for APPLE systems
133
150
APPLY_DEFAULT_APPLE_CONFIGURATION()
134
151
135
- OPTION (BUILD_PYTHON_INTERFACE "Build the python bindings" ON )
136
- CMAKE_DEPENDENT_OPTION(GENERATE_PYTHON_STUBS "Generate the Python stubs associated to the Python library" OFF BUILD_PYTHON_INTERFACE OFF )
152
+ option (BUILD_PYTHON_INTERFACE "Build the python bindings" ON )
153
+ cmake_dependent_option(
154
+ GENERATE_PYTHON_STUBS
155
+ "Generate the Python stubs associated to the Python library"
156
+ OFF
157
+ BUILD_PYTHON_INTERFACE
158
+ OFF
159
+ )
137
160
138
161
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.0" )
139
162
140
163
if (BUILD_PYTHON_INTERFACE)
141
- SET (PYTHON_COMPONENTS Interpreter Development NumPy)
164
+ set (PYTHON_COMPONENTS Interpreter Development NumPy)
142
165
FINDPYTHON(REQUIRED)
143
166
ADD_PROJECT_PRIVATE_DEPENDENCY(eigenpy 2.9.2 REQUIRED)
144
167
endif ()
145
168
146
169
# Required dependencies
147
170
SET_BOOST_DEFAULT_OPTIONS()
148
171
EXPORT_BOOST_DEFAULT_OPTIONS()
149
- ADD_PROJECT_DEPENDENCY(Boost REQUIRED chrono thread date_time serialization filesystem)
150
- if (COAL_ENABLE_LOGGING)
172
+ ADD_PROJECT_DEPENDENCY(
173
+ Boost
174
+ REQUIRED
175
+ chrono
176
+ thread
177
+ date_time
178
+ serialization
179
+ filesystem
180
+ )
181
+ if (COAL_ENABLE_LOGGING)
151
182
ADD_PROJECT_DEPENDENCY(Boost REQUIRED log )
152
183
endif ()
153
184
if (BUILD_PYTHON_INTERFACE)
@@ -165,14 +196,14 @@ endif()
165
196
# Optional dependencies
166
197
ADD_PROJECT_DEPENDENCY(octomap PKG_CONFIG_REQUIRES "octomap >= 1.6" )
167
198
if (octomap_FOUND)
168
- SET (COAL_HAS_OCTOMAP TRUE )
199
+ set (COAL_HAS_OCTOMAP TRUE )
169
200
string (REPLACE "." ";" VERSION_LIST ${octomap_VERSION} )
170
201
list (GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION)
171
202
list (GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION)
172
203
list (GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION)
173
204
message (STATUS "COAL uses Octomap" )
174
205
else ()
175
- SET (COAL_HAS_OCTOMAP FALSE )
206
+ set (COAL_HAS_OCTOMAP FALSE )
176
207
message (STATUS "COAL does not use Octomap" )
177
208
endif ()
178
209
@@ -183,30 +214,37 @@ if(COAL_HAS_QHULL)
183
214
set (COAL_USE_SYSTEM_QHULL TRUE )
184
215
message (STATUS "COAL uses system Qhull" )
185
216
else ()
186
- message (STATUS "Qhullcpp not found: it will be build from sources, if Qhull_r is found" )
217
+ message (
218
+ STATUS
219
+ "Qhullcpp not found: it will be build from sources, if Qhull_r is found"
220
+ )
187
221
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /third-parties)
188
- execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink
189
- ${PROJECT_SOURCE_DIR} /third-parties/qhull/src/libqhullcpp
190
- ${PROJECT_BINARY_DIR} /third-parties/libqhullcpp
191
- )
222
+ execute_process (
223
+ COMMAND
224
+ ${CMAKE_COMMAND} -E create_symlink
225
+ ${PROJECT_SOURCE_DIR} /third-parties/qhull/src/libqhullcpp
226
+ ${PROJECT_BINARY_DIR} /third-parties/libqhullcpp
227
+ )
192
228
set (Qhullcpp_PREFIX ${PROJECT_BINARY_DIR} /third-parties)
193
- find_path (Qhull_r_INCLUDE_DIR
229
+ find_path (
230
+ Qhull_r_INCLUDE_DIR
194
231
NAMES libqhull_r/libqhull_r.h
195
232
PATHS ${Qhull_PREFIX}
196
- )
197
- find_library (Qhull_r_LIBRARY
198
- NAMES libqhull_r.so
199
- PATHS ${Qhull_PREFIX}
200
- )
233
+ )
234
+ find_library (Qhull_r_LIBRARY NAMES libqhull_r.so PATHS ${Qhull_PREFIX} )
201
235
if (NOT Qhull_r_LIBRARY)
202
- message (FATAL_ERROR "Qhull_r not found, please install it or turn COAL_HAS_QHULL OFF" )
236
+ message (
237
+ FATAL_ERROR
238
+ "Qhull_r not found, please install it or turn COAL_HAS_QHULL OFF"
239
+ )
203
240
endif ()
204
241
endif ()
205
242
endif ()
206
243
207
- FIND_PACKAGE (assimp REQUIRED)
244
+ find_package (assimp REQUIRED)
208
245
209
- SET (${PROJECT_NAME} _HEADERS
246
+ set (
247
+ ${PROJECT_NAME} _HEADERS
210
248
include /coal/collision_data.h
211
249
include /coal/BV/kIOS.h
212
250
include /coal/BV/BV.h
@@ -325,10 +363,11 @@ SET(${PROJECT_NAME}_HEADERS
325
363
include /coal/serialization/quadrilateral.h
326
364
include /coal/serialization/triangle.h
327
365
include /coal/timings.h
328
- )
366
+ )
329
367
330
368
if (COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL)
331
- SET (HPP_FCL_BACKWARD_COMPATIBILITY_HEADERS
369
+ set (
370
+ HPP_FCL_BACKWARD_COMPATIBILITY_HEADERS
332
371
include /hpp/fcl/broadphase/broadphase_bruteforce.h
333
372
include /hpp/fcl/broadphase/broadphase_callbacks.h
334
373
include /hpp/fcl/broadphase/broadphase_collision_manager.h
@@ -454,48 +493,60 @@ if(COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL)
454
493
include /hpp/fcl/shape/geometric_shape_to_BVH_model.h
455
494
include /hpp/fcl/timings.h
456
495
include /hpp/fcl/warning.hh
457
- )
458
- LIST (APPEND ${PROJECT_NAME} _HEADERS ${HPP_FCL_BACKWARD_COMPATIBILITY_HEADERS} )
459
- HEADER_INSTALL(COMPONENT hpp-fcl-compatibility ${HPP_FCL_BACKWARD_COMPATIBILITY_HEADERS} )
496
+ )
497
+ list (APPEND ${PROJECT_NAME} _HEADERS ${HPP_FCL_BACKWARD_COMPATIBILITY_HEADERS} )
498
+ HEADER_INSTALL(
499
+ COMPONENT hpp-fcl-compatibility
500
+ ${HPP_FCL_BACKWARD_COMPATIBILITY_HEADERS}
501
+ )
460
502
endif ()
461
503
462
- IF (COAL_HAS_OCTOMAP)
463
- LIST (APPEND ${PROJECT_NAME} _HEADERS
504
+ if (COAL_HAS_OCTOMAP)
505
+ list (
506
+ APPEND
507
+ ${PROJECT_NAME} _HEADERS
464
508
include /coal/octree.h
465
509
include /coal/serialization/octree.h
466
510
include /coal/internal /traversal_node_octree.h
467
511
)
468
- ENDIF (COAL_HAS_OCTOMAP)
512
+ endif (COAL_HAS_OCTOMAP)
469
513
470
514
add_subdirectory (doc )
471
515
add_subdirectory (src)
472
- if (BUILD_PYTHON_INTERFACE)
516
+ if (BUILD_PYTHON_INTERFACE)
473
517
add_subdirectory (python)
474
- endif ()
518
+ endif ()
475
519
if (BUILD_TESTING)
476
520
add_subdirectory (test )
477
521
endif (BUILD_TESTING)
478
522
479
- pkg_config_append_libs ("coal" )
480
- IF (COAL_HAS_OCTOMAP)
523
+ PKG_CONFIG_APPEND_LIBS ("coal" )
524
+ if (COAL_HAS_OCTOMAP)
481
525
# FCL_HAVE_OCTOMAP kept for backward compatibility reasons.
482
526
PKG_CONFIG_APPEND_CFLAGS(
483
- "-DCOAL_HAS_OCTOMAP -DCOAL_HAVE_OCTOMAP -DFCL_HAVE_OCTOMAP -DOCTOMAP_MAJOR_VERSION=${OCTOMAP_MAJOR_VERSION} -DOCTOMAP_MINOR_VERSION=${OCTOMAP_MINOR_VERSION} -DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION} " )
484
- ENDIF (COAL_HAS_OCTOMAP)
527
+ "-DCOAL_HAS_OCTOMAP -DCOAL_HAVE_OCTOMAP -DFCL_HAVE_OCTOMAP -DOCTOMAP_MAJOR_VERSION=${OCTOMAP_MAJOR_VERSION} -DOCTOMAP_MINOR_VERSION=${OCTOMAP_MINOR_VERSION} -DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION} "
528
+ )
529
+ endif (COAL_HAS_OCTOMAP)
485
530
486
531
# Install catkin package.xml
487
- INSTALL (FILES package.xml DESTINATION share/${PROJECT_NAME} )
532
+ install (FILES package.xml DESTINATION share/${PROJECT_NAME} )
488
533
489
534
if (COAL_BACKWARD_COMPATIBILITY_WITH_HPP_FCL)
490
535
include (CMakePackageConfigHelpers)
491
- write_basic_package_version_file(hpp-fclConfigVersion.cmake
492
- VERSION 3.0.0
493
- COMPATIBILITY AnyNewerVersion)
494
- install (FILES hpp-fclConfig.cmake ${CMAKE_CURRENT_BINARY_DIR} /hpp-fclConfigVersion.cmake
495
- DESTINATION lib/cmake/hpp-fcl
496
- COMPONENT hpp-fcl-compatibility)
536
+ write_basic_package_version_file(
537
+ hpp-fclConfigVersion.cmake
538
+ VERSION 3.0.0
539
+ COMPATIBILITY AnyNewerVersion
540
+ )
541
+ install (
542
+ FILES
543
+ hpp-fclConfig.cmake
544
+ ${CMAKE_CURRENT_BINARY_DIR} /hpp-fclConfigVersion.cmake
545
+ DESTINATION lib/cmake/hpp-fcl
546
+ COMPONENT hpp-fcl-compatibility
547
+ )
497
548
include ("${JRL_CMAKE_MODULES} /install-helpers.cmake" )
498
- add_install_target (NAME hpp-fcl-compatibility COMPONENT hpp-fcl-compatibility)
549
+ ADD_INSTALL_TARGET (NAME hpp-fcl-compatibility COMPONENT hpp-fcl-compatibility)
499
550
endif ()
500
551
501
- setup_project_finalize ()
552
+ SETUP_PROJECT_FINALIZE ()
0 commit comments