Skip to content

Commit 524f640

Browse files
committed
Add chimera config for absent of VoxelGridShape of DART
1 parent 403b8f9 commit 524f640

File tree

2 files changed

+1816
-2
lines changed

2 files changed

+1816
-2
lines changed

CMakeLists.txt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ else() # LINUX assumed
3737
endif()
3838
endif()
3939

40-
find_package(DART 6.3.0 REQUIRED
40+
find_package(DART 6.6.1 REQUIRED
4141
COMPONENTS
4242
collision-bullet
4343
# collision-ode
@@ -48,6 +48,25 @@ find_package(DART 6.3.0 REQUIRED
4848
CONFIG
4949
)
5050

51+
# Check if DART is built with octomap so that it supports VoxelGridShape
52+
include(CheckCXXSourceCompiles)
53+
set(CMAKE_REQUIRED_DEFINITIONS "")
54+
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
55+
set(CMAKE_REQUIRED_INCLUDES ${DART_INCLUDE_DIRS})
56+
set(CMAKE_REQUIRED_LIBRARIES ${DART_LIBRARIES})
57+
check_cxx_source_compiles(
58+
"
59+
#include <dart/dart.hpp>
60+
int main()
61+
{
62+
auto voxel = new dart::dynamics::VoxelGridShape();
63+
delete voxel;
64+
return 0;
65+
}
66+
"
67+
DART_HAS_VOXELGRIDSHAPE
68+
)
69+
5170
find_package(PythonLibs ${DARTPY_PYTHON_VERSION} REQUIRED)
5271
find_package(chimera QUIET)
5372

@@ -91,10 +110,15 @@ include_directories(
91110
)
92111

93112
# If chimera is available on this system, create a target to build bindings.
113+
if(DART_HAS_VOXELGRIDSHAPE)
114+
set(CHIMERA_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/chimera/chimera.yml")
115+
else()
116+
set(CHIMERA_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/chimera/chimera_without_voxel.yml")
117+
endif()
94118
if(chimera_FOUND)
95119
add_chimera_binding(TARGET "${PROJECT_NAME}_CHIMERA"
96120
MODULE "${PROJECT_NAME}"
97-
CONFIGURATION "${CMAKE_CURRENT_SOURCE_DIR}/chimera/chimera.yml"
121+
CONFIGURATION "${CHIMERA_CONFIG}"
98122
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/chimera/chimera.cpp"
99123
DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/src/generated"
100124
DEBUG EXCLUDE_FROM_ALL

0 commit comments

Comments
 (0)