Commit c32ecec4 authored by Justin Carpentier's avatar Justin Carpentier

cmake: improve packaging

Almost ready for generating packaging
parent c33d505c
......@@ -20,16 +20,8 @@ SET(CXX_DISABLE_WERROR True)
SET(CMAKE_VERBOSE_MAKEFILE True)
INCLUDE(cmake/base.cmake)
IF(CMAKE_VERSION VERSION_GREATER "3.0.0")
CMAKE_POLICY(SET CMP0048 NEW)
IF(CMAKE_VERSION VERSION_GREATER "3.9.0")
PROJECT(${PROJECT_NAME} VERSION ${PROJECT_VERSION_FULL} LANGUAGES CXX DESCRIPTION ${PROJECT_DESCRIPTION})
ELSE(CMAKE_VERSION VERSION_GREATER "3.9.0")
PROJECT(${PROJECT_NAME} VERSION ${PROJECT_VERSION_FULL} LANGUAGES CXX)
ENDIF(CMAKE_VERSION VERSION_GREATER "3.9.0")
ELSE(CMAKE_VERSION VERSION_GREATER "3.0.0")
PROJECT(${PROJECT_NAME} CXX)
ENDIF(CMAKE_VERSION VERSION_GREATER "3.0.0")
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/python.cmake)
......@@ -60,10 +52,7 @@ ELSE(BUILD_UNIT_TESTS)
ENDIF(BUILD_UNIT_TESTS)
FINDPYTHON()
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
FIND_NUMPY()
INCLUDE_DIRECTORIES(SYSTEM ${NUMPY_INCLUDE_DIRS})
# ----------------------------------------------------
# --- DEPENDENCIES -----------------------------------
......@@ -72,8 +61,6 @@ ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
SET(BOOST_COMPONENTS python)
SEARCH_FOR_BOOST()
# Add Boost path to include directories.
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
......@@ -138,13 +125,14 @@ SET(${PROJECT_NAME}_SOURCES
)
ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${Boost_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIRS})
IF(NOT WIN32)
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj> "-Wno-conversion")
ELSE()
TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>)
ENDIF()
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME} PUBLIC)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3)
INSTALL(TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
......@@ -169,6 +157,8 @@ INSTALL(FILES
# This is a temporary work-around to fix MoveIt until jrl-cmakemodules
# can correctly create non-target CMake configs
install(FILES eigenpyConfig.cmake DESTINATION share/eigenpy/cmake)
# Install package for ROS
install(FILES package.xml DESTINATION share/eigenpy)
# ----------------------------------------------------
......
......@@ -24,8 +24,7 @@ SET(PYWRAP ${PYWRAP} PARENT_SCOPE)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/python/${PROJECT_NAME}")
ADD_LIBRARY(${PYWRAP} SHARED main.cpp)
TARGET_LINK_LIBRARIES(${PYWRAP} ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${PYWRAP})
TARGET_LINK_LIBRARIES(${PYWRAP} PUBLIC ${PROJECT_NAME})
# BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS spews conversion warnings from int to long unsigned int.
# Unfortunately, using literals does not work in a macro. As such, this turns them off for the entire wrapper:
IF(NOT WIN32)
......@@ -40,7 +39,6 @@ ELSE()
SET(${PYWRAP}_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB})
ENDIF()
SET_PROPERTY(TARGET ${PYWRAP} PROPERTY LINKER_LANGUAGE CXX)
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX})
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES
......
......@@ -16,14 +16,10 @@ MACRO(ADD_LIB_UNIT_TEST test PKGS)
PKG_CONFIG_USE_DEPENDENCY(${test} ${PKG})
ENDFOREACH(PKG)
TARGET_LINK_LIBRARIES(${test} ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${test})
TARGET_LINK_LIBRARIES(${test} PUBLIC ${PROJECT_NAME})
SET_TARGET_PROPERTIES(${test} PROPERTIES PREFIX "")
IF(APPLE)
# We need to change the extension for python bindings
SET_TARGET_PROPERTIES(${test} PROPERTIES SUFFIX ".so")
ENDIF(APPLE)
SET_TARGET_PROPERTIES(${test} PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX})
ADD_TEST(NAME ${test} COMMAND ${PYTHON_EXECUTABLE} -c "import ${test}")
......
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