Skip to content

Commit

Permalink
Merge pull request #2288 from jorisv/topic/simplify_hpp_fcl_bindings
Browse files Browse the repository at this point in the history
Always suppose hpp-fcl Python binding are present when hpp-fcl C++ library is found
  • Loading branch information
jorisv committed Jun 18, 2024
2 parents 03976d2 + 814c506 commit df3aa95
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix compilation issue for Boost 1.85 ([#2255](https://github.com/stack-of-tasks/pinocchio/pull/2255))
- Fix python bindings of `contactInverseDynamics` ([#2263](https://github.com/stack-of-tasks/pinocchio/pull/2263))
- Deactivate `BUILD_WITH_LIBPYTHON` when building with PyPy ([#2274](https://github.com/stack-of-tasks/pinocchio/pull/2274))
- Fix Python bindings cross building with `hpp-fcl` ([#2288](https://github.com/stack-of-tasks/pinocchio/pull/2288))

### Added

Expand Down
17 changes: 1 addition & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,22 +296,7 @@ if(BUILD_WITH_HPP_FCL_SUPPORT)
list(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_HPP_FCL")
list(APPEND LIBRARIES_DEPENDENCIES "hpp-fcl")
add_project_dependency(hpp-fcl 2.1.2 REQUIRED PKG_CONFIG_REQUIRES "hpp-fcl >= 2.1.2")
# Check whether hpp-fcl python bindings are available.
set(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS FALSE)
if(BUILD_PYTHON_INTERFACE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import hppfcl"
RESULT_VARIABLE _hpp_fcl_python_bindings_not_found
OUTPUT_QUIET ERROR_QUIET)
if(_hpp_fcl_python_bindings_not_found EQUAL 0)
set(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS TRUE)
message(STATUS "Found hpp-fcl Python bindings.")
else()
message(STATUS "hpp-fcl Python bindings NOT found.")
endif()
unset(_hpp_fcl_python_bindings_not_found)
endif(BUILD_PYTHON_INTERFACE)
endif(BUILD_WITH_HPP_FCL_SUPPORT)
endif()

if(BUILD_WITH_ACCELERATE_SUPPORT)
if(NOT ${Eigen3_VERSION} VERSION_GREATER_EQUAL "3.4.90")
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ function(PINOCCHIO_PYTHON_BINDINGS_SPECIFIC_TYPE scalar_name)
# console_bridge::setLogLevel function.
target_link_libraries(${PYTHON_LIB_NAME} PUBLIC console_bridge::console_bridge)
endif()
if(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS)
if(BUILD_WITH_HPP_FCL_SUPPORT)
target_compile_definitions(${PYTHON_LIB_NAME}
PRIVATE -DPINOCCHIO_PYTHON_INTERFACE_WITH_HPP_FCL_PYTHON_BINDINGS)
endif(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS)
endif()
if(WIN32)
target_link_libraries(${PYTHON_LIB_NAME} PUBLIC ${PYTHON_LIBRARY})
endif(WIN32)
endif()

set(${PYWRAP}_INSTALL_DIR ${ABSOLUTE_PYTHON_SITELIB}/${PROJECT_NAME})

Expand Down
8 changes: 3 additions & 5 deletions unittest/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ set(${PROJECT_NAME}_PYTHON_TESTS
bindings_std_vector
bindings_std_map)

if(hpp-fcl_FOUND)
if(BUILD_WITH_HPP_FCL_SUPPORT)
set(${PROJECT_NAME}_PYTHON_TESTS ${${PROJECT_NAME}_PYTHON_TESTS} bindings_geometry_object)
if(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS)
set(${PROJECT_NAME}_PYTHON_TESTS ${${PROJECT_NAME}_PYTHON_TESTS} bindings_fcl_transform)
endif(BUILD_WITH_HPP_FCL_PYTHON_BINDINGS)
endif(hpp-fcl_FOUND)
set(${PROJECT_NAME}_PYTHON_TESTS ${${PROJECT_NAME}_PYTHON_TESTS} bindings_fcl_transform)
endif()

if(urdfdom_FOUND)
set(${PROJECT_NAME}_PYTHON_TESTS ${${PROJECT_NAME}_PYTHON_TESTS} bindings_urdf
Expand Down

0 comments on commit df3aa95

Please sign in to comment.