Commit 01752677 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #333 from jcarpent/topic/packaging

Improve packaging
parents d0de7c25 e30eb220
......@@ -21,6 +21,7 @@ INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(CMakeDependentOption)
SET(PROJECT_NAME pinocchio)
SET(PROJECT_DESCRIPTION "Rigid multi body dynamics algorithms")
......@@ -41,6 +42,16 @@ IF(APPLE)
endif("${isSystemDir}" STREQUAL "-1")
ENDIF(APPLE)
# This should go to jrl-cmakemodules if accepted - Similar to ADD_DOC_DEPENDENC but with a requiered option
# This macro is for requiered components which must not appear as a dependence of the main library
MACRO(ADD_SEPARATE_DEPENDENCY PKG_CONFIG_STRING)
SET(PKG_CONFIG_DEBUG_STRING "")
FOREACH(ARG ${ARGN})
SET(PKG_CONFIG_DEBUG_STRING ${ARG})
ENDFOREACH()
ADD_DEPENDENCY(0 1 ${PKG_CONFIG_STRING} "${PKG_CONFIG_DEBUG_STRING}")
ENDMACRO(ADD_SEPARATE_DEPENDENCY)
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
SET(CMAKE_VERBOSE_MAKEFILE True)
......@@ -60,12 +71,17 @@ OPTION (BUILD_UTILS "Build the utils" OFF)
OPTION (INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
OPTION (BUILD_TESTS_WITH_HPP "Build geom tests and benchmarks with hpp to do comparisons" OFF)
OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
CMAKE_DEPENDENT_OPTION(BUILD_PYTHON_PARSER "Build pinocchio with the Python parser" ON "BUILD_PYTHON_INTERFACE" ON)
IF (INITIALIZE_WITH_NAN)
MESSAGE (STATUS "Initialize with NaN all the Eigen entries.")
ADD_DEFINITIONS(-DEIGEN_INITIALIZE_MATRICES_BY_NAN)
ENDIF (INITIALIZE_WITH_NAN)
IF(BUILD_PYTHON_PARSER)
SET(BUILD_PYTHON_INTERFACE ON)
ENDIF(BUILD_PYTHON_PARSER)
# ----------------------------------------------------
# --- DEPENDANCIES -----------------------------------
# ----------------------------------------------------
......@@ -93,15 +109,19 @@ IF(URDFDOM_FOUND)
ENDIF(${URDFDOM_VERSION} VERSION_LESS "0.3.0")
ENDIF(URDFDOM_FOUND)
SET(BOOST_COMPONENTS filesystem unit_test_framework system)
SET(BOOST_REQUIERED_COMPONENTS filesystem system)
SET(BOOST_BUILD_COMPONENTS unit_test_framework)
SET(BOOST_OPTIONAL_COMPONENTS "")
IF(BUILD_PYTHON_INTERFACE)
ADD_REQUIRED_DEPENDENCY("eigenpy >= 1.3.0")
SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
ADD_SEPARATE_DEPENDENCY("eigenpy >= 1.3.0")
SET(BOOST_OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS} python)
FINDPYTHON(2.7 EXACT REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ENDIF(BUILD_PYTHON_INTERFACE)
SET(BOOST_COMPONENTS ${BOOST_REQUIERED_COMPONENTS} ${BOOST_OPTIONAL_COMPONENTS} ${BOOST_BUILD_COMPONENTS})
SEARCH_FOR_BOOST()
# Variable containing all the cflags definition relative to optional dependencies
......@@ -204,11 +224,11 @@ SET(${PROJECT_NAME}_PARSERS_HEADERS
parsers/srdf.hpp
)
IF(BUILD_PYTHON_INTERFACE)
IF(BUILD_PYTHON_PARSER)
LIST(APPEND ${PROJECT_NAME}_PARSERS_HEADERS
parsers/python.hpp
)
ENDIF(BUILD_PYTHON_INTERFACE)
ENDIF(BUILD_PYTHON_PARSER)
IF(URDFDOM_FOUND)
LIST(APPEND ${PROJECT_NAME}_PARSERS_HEADERS
......@@ -301,7 +321,10 @@ ADD_SUBDIRECTORY(benchmark)
# --- PACKAGING ----------------------------------------------------------------
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_COMPONENTS})
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_REQUIERED_COMPONENTS})
IF(BUILD_PYTHON_PARSER)
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_OPTIONAL_COMPONENTS})
ENDIF(BUILD_PYTHON_PARSER)
IF(EIGEN3_FUTURE)
PKG_CONFIG_APPEND_CFLAGS("-DEIGEN3_FUTURE")
......
......@@ -132,7 +132,7 @@ IF(BUILD_PYTHON_INTERFACE)
PKG_CONFIG_USE_DEPENDENCY(${PYWRAP} lua5.1)
ENDIF(LUA5_1_FOUND)
TARGET_LINK_LIBRARIES(${PYWRAP} ${PROJECT_NAME} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(${PYWRAP} ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${PYWRAP})
IF(APPLE)
......
......@@ -51,11 +51,11 @@ SET(${PROJECT_NAME}_PARSERS_SOURCES
parsers/sample-models.cpp
)
IF(BUILD_PYTHON_INTERFACE)
IF(BUILD_PYTHON_PARSER)
LIST(APPEND ${PROJECT_NAME}_PARSERS_SOURCES
parsers/python.cpp
)
ENDIF(BUILD_PYTHON_INTERFACE)
ENDIF(BUILD_PYTHON_PARSER)
IF(URDFDOM_FOUND)
LIST(APPEND ${PROJECT_NAME}_PARSERS_SOURCES
......@@ -84,11 +84,11 @@ IF(UNIX)
ADD_LIBRARY ( ${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES} )
SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
IF(BUILD_PYTHON_INTERFACE)
IF(BUILD_PYTHON_PARSER)
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME})
ENDIF(BUILD_PYTHON_INTERFACE)
ENDIF(BUILD_PYTHON_PARSER)
IF(URDFDOM_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} urdfdom)
......
......@@ -34,6 +34,7 @@ MACRO(ADD_UNIT_TEST NAME PKGS)
ENDIF(HPP_FCL_FOUND)
TARGET_LINK_LIBRARIES(${NAME} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
IF(BUILD_PYTHON_INTERFACE)
TARGET_LINK_BOOST_PYTHON(${NAME})
......
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