Commit f23c83da authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] allow multi python setup

parent 0a9d1ff0
Pipeline #11579 failed with stage
in 17 minutes and 48 seconds
...@@ -64,16 +64,10 @@ SET(CMAKE_MODULE_PATH ...@@ -64,16 +64,10 @@ SET(CMAKE_MODULE_PATH
# If needed, fix CMake policy for APPLE systems # If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION() APPLY_DEFAULT_APPLE_CONFIGURATION()
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX) COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS}) PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.0") ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED)
if(BUILD_PYTHON_INTERFACE)
FIND_PACKAGE(eigenpy 2.2 REQUIRED)
endif()
# Required dependencies # Required dependencies
SET_BOOST_DEFAULT_OPTIONS() SET_BOOST_DEFAULT_OPTIONS()
...@@ -83,6 +77,7 @@ if (BUILD_PYTHON_INTERFACE) ...@@ -83,6 +77,7 @@ if (BUILD_PYTHON_INTERFACE)
FINDPYTHON() FINDPYTHON()
search_for_boost_python(REQUIRED) search_for_boost_python(REQUIRED)
find_package(Boost REQUIRED COMPONENTS system) find_package(Boost REQUIRED COMPONENTS system)
find_package(eigenpy 2.5.0 REQUIRED COMPONENTS "eigenpy${PYTHON_EXT_SUFFIX_DASHES}")
endif () endif ()
# Optional dependencies # Optional dependencies
...@@ -101,9 +96,7 @@ endif() ...@@ -101,9 +96,7 @@ endif()
option(HPP_FCL_HAS_QHULL "use qhull library to compute convex hulls." FALSE) option(HPP_FCL_HAS_QHULL "use qhull library to compute convex hulls." FALSE)
if(HPP_FCL_HAS_QHULL) if(HPP_FCL_HAS_QHULL)
if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD EQUAL 98) CHECK_MINIMAL_CXX_STANDARD(11 REQUIRED)
message(FATAL_ERROR "Cannot use qhull library with C++ < 11.\nYou may add -DCMAKE_CXX_STANDARD=11")
endif()
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third-parties) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third-parties)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_SOURCE_DIR}/third-parties/qhull/src/libqhullcpp ${CMAKE_SOURCE_DIR}/third-parties/qhull/src/libqhullcpp
...@@ -187,4 +180,6 @@ IF(HPP_FCL_HAVE_OCTOMAP) ...@@ -187,4 +180,6 @@ IF(HPP_FCL_HAVE_OCTOMAP)
ENDIF(HPP_FCL_HAVE_OCTOMAP) ENDIF(HPP_FCL_HAVE_OCTOMAP)
# Install catkin package.xml # Install catkin package.xml
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME}) if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
endif()
Subproject commit 7520bde0fb45dd9af1110686684e056d92d1fe29 Subproject commit 1a4607de4743f5cf18344235bcd536fdb995ff6c
...@@ -119,14 +119,14 @@ ENDIF() ...@@ -119,14 +119,14 @@ ENDIF()
TARGET_LINK_BOOST_PYTHON(${LIBRARY_NAME} PUBLIC) TARGET_LINK_BOOST_PYTHON(${LIBRARY_NAME} PUBLIC)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} PUBLIC TARGET_LINK_LIBRARIES(${LIBRARY_NAME} PUBLIC
${PROJECT_NAME} ${PROJECT_NAME}
eigenpy::eigenpy eigenpy::eigenpy${PYTHON_EXT_SUFFIX_DASHES}
Boost::system) Boost::system)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES
PREFIX "" PREFIX ""
SUFFIX "${PYTHON_EXT_SUFFIX}" SUFFIX "${PYTHON_EXT_SUFFIX}"
LIBRARY_OUTPUT_NAME ${LIBRARY_NAME} LIBRARY_OUTPUT_NAME ${LIBRARY_NAME}
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python/${LIBRARY_NAME}" LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_NAME}
) )
IF(IS_ABSOLUTE ${PYTHON_SITELIB}) IF(IS_ABSOLUTE ${PYTHON_SITELIB})
...@@ -145,8 +145,5 @@ SET(PYTHON_FILES ...@@ -145,8 +145,5 @@ SET(PYTHON_FILES
) )
FOREACH(python ${PYTHON_FILES}) FOREACH(python ${PYTHON_FILES})
PYTHON_BUILD(${LIBRARY_NAME} ${python}) PYTHON_INSTALL_ON_SITE(${LIBRARY_NAME} ${python})
INSTALL(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/${LIBRARY_NAME}/${python}"
DESTINATION ${${LIBRARY_NAME}_INSTALL_DIR})
ENDFOREACH(python) ENDFOREACH(python)
...@@ -199,10 +199,12 @@ IF(octomap_FOUND) ...@@ -199,10 +199,12 @@ IF(octomap_FOUND)
-DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION}) -DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION})
ENDIF(octomap_FOUND) ENDIF(octomap_FOUND)
install(TARGETS ${LIBRARY_NAME} if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
EXPORT ${TARGETS_EXPORT_NAME} install(TARGETS ${LIBRARY_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} EXPORT ${TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment