Commit 125c4666 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] allow multi python setup

parent a834bd2f
......@@ -64,22 +64,20 @@ SET(CMAKE_MODULE_PATH
# If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION()
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
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)
FINDPYTHON()
FIND_PACKAGE(eigenpy 2.4.4 REQUIRED COMPONENTS "eigenpy${PYTHON_EXT_SUFFIX_DASHES}")
endif()
# Required dependencies
ADD_PROJECT_DEPENDENCY(Boost REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem unit_test_framework chrono timer)
if (BUILD_PYTHON_INTERFACE)
FINDPYTHON()
set(BOOST_COMPONENTS system python)
search_for_boost()
endif ()
......@@ -100,9 +98,7 @@ endif()
option(HPP_FCL_HAS_QHULL "use qhull library to compute convex hulls." FALSE)
if(HPP_FCL_HAS_QHULL)
if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD EQUAL 98)
message(FATAL_ERROR "Cannot use qhull library with C++ < 11.\nYou may add -DCMAKE_CXX_STANDARD=11")
endif()
CHECK_MINIMAL_CXX_STANDARD(11 REQUIRED)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third-parties)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_SOURCE_DIR}/third-parties/qhull/src/libqhullcpp
......@@ -186,4 +182,6 @@ IF(HPP_FCL_HAVE_OCTOMAP)
ENDIF(HPP_FCL_HAVE_OCTOMAP)
# 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 89bd42923644d96fbe99d7495d12021d1e885a83
Subproject commit 0fb475530c4d4b97a5a935d820984c42952bb6d6
......@@ -119,21 +119,17 @@ ENDIF()
TARGET_LINK_BOOST_PYTHON(${LIBRARY_NAME} PUBLIC)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} PUBLIC
${PROJECT_NAME}
eigenpy::eigenpy
eigenpy::eigenpy${PYTHON_EXT_SUFFIX_DASHES}
Boost::system)
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES
PREFIX ""
SUFFIX "${PYTHON_EXT_SUFFIX}"
LIBRARY_OUTPUT_NAME ${LIBRARY_NAME}
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python/${LIBRARY_NAME}"
LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_NAME}
)
IF(DEFINED HPP_FCL_SITELIB_ROOT AND HPP_FCL_SITELIB_ROOT)
SET(${LIBRARY_NAME}_INSTALL_DIR ${HPP_FCL_SITELIB_ROOT}/${PYTHON_SITELIB}/${LIBRARY_NAME})
ELSE()
SET(${LIBRARY_NAME}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/${LIBRARY_NAME})
ENDIF()
SET(${LIBRARY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${LIBRARY_NAME})
INSTALL(TARGETS ${LIBRARY_NAME}
DESTINATION ${${LIBRARY_NAME}_INSTALL_DIR})
......@@ -144,8 +140,5 @@ SET(PYTHON_FILES
)
FOREACH(python ${PYTHON_FILES})
PYTHON_BUILD(${LIBRARY_NAME} ${python})
INSTALL(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/${LIBRARY_NAME}/${python}"
DESTINATION ${${LIBRARY_NAME}_INSTALL_DIR})
PYTHON_INSTALL_ON_SITE(${LIBRARY_NAME} ${python})
ENDFOREACH(python)
......@@ -197,10 +197,12 @@ IF(octomap_FOUND)
-DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION})
ENDIF(octomap_FOUND)
install(TARGETS ${LIBRARY_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
install(TARGETS ${LIBRARY_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
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