Verified Commit 15a716df authored by Justin Carpentier's avatar Justin Carpentier
Browse files

cmake: rework flags

parent 4696aa4b
......@@ -61,12 +61,16 @@ OPTION(BUILD_WITH_AUTODIFF_SUPPORT "Build the library with the Automatic Differe
OPTION(BUILD_WITH_CASADI_SUPPORT "Build the library with the CASADI support" OFF)
OPTION(BUILD_WITH_CODEGEN_SUPPORT "Build the library with the Code Generation support" OFF)
OPTION (INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
OPTION(INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
IF (INITIALIZE_WITH_NAN)
SET(BUILD_WITH_HPP_FCL_SUPPORT ${BUILD_WITH_COLLISION_SUPPORT})
SET(BUILD_WITH_CPPAD_SUPPORT ${BUILD_WITH_AUTODIFF_SUPPORT})
SET(BUILD_WITH_CPPAD_CODEGEN_SUPPORT ${BUILD_WITH_CODEGEN_SUPPORT})
IF(INITIALIZE_WITH_NAN)
MESSAGE (STATUS "Initialize with NaN all the Eigen entries.")
ADD_DEFINITIONS(-DEIGEN_INITIALIZE_MATRICES_BY_NAN)
ENDIF (INITIALIZE_WITH_NAN)
ENDIF(INITIALIZE_WITH_NAN)
MACRO(TAG_LIBRARY_VERSION target)
SET_TARGET_PROPERTIES(${target} PROPERTIES SOVERSION ${PROJECT_VERSION})
......@@ -81,17 +85,21 @@ ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
IF(BUILD_WITH_URDF_SUPPORT)
ADD_REQUIRED_DEPENDENCY("urdfdom >= 0.2.0")
ADD_DEFINITIONS(-DPINOCCHIO_WITH_URDFDOM)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_URDFDOM")
ENDIF(BUILD_WITH_URDF_SUPPORT)
IF(BUILD_WITH_COLLISION_SUPPORT)
IF(BUILD_WITH_HPP_FCL_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_HPP_FCL)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_HPP_FCL")
ADD_REQUIRED_DEPENDENCY("hpp-fcl >= 1.0.0")
ENDIF(BUILD_WITH_COLLISION_SUPPORT)
ENDIF(BUILD_WITH_HPP_FCL_SUPPORT)
IF(BUILD_WITH_AUTODIFF_SUPPORT)
ADD_REQUIRED_DEPENDENCY("cppad >= 20180000.0")
ENDIF(BUILD_WITH_AUTODIFF_SUPPORT)
IF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
IF(BUILD_WITH_AUTODIFF_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_CPPAD_SUPPORT)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_WITH_CPPAD_SUPPORT")
IF(NOT ${CPPAD_VERSION} VERSION_GREATER "3.3.0")
......@@ -100,13 +108,13 @@ IF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
ENDIF(NOT ${CPPAD_VERSION} VERSION_GREATER "3.3.0")
IF(BUILD_WITH_CODEGEN_SUPPORT)
ADD_OPTIONAL_DEPENDENCY("cppadcg")
ADD_REQUIRED_DEPENDENCY("cppadcg")
ENDIF(BUILD_WITH_CODEGEN_SUPPORT)
IF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_CPPADCG_SUPPORT)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_WITH_CPPADCG_SUPPORT")
ENDIF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ENDIF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
ENDIF(BUILD_WITH_AUTODIFF_SUPPORT)
IF(BUILD_WITH_CASADI_SUPPORT)
ADD_REQUIRED_DEPENDENCY("casadi >= 3.4.5")
......@@ -118,7 +126,7 @@ IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
ENDIF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
# Special care of urdfdom version
IF(URDFDOM_FOUND AND BUILD_WITH_URDF_SUPPORT)
IF(BUILD_WITH_URDF_SUPPORT)
IF(${URDFDOM_VERSION} VERSION_LESS "0.3.0")
ADD_DEFINITIONS(-DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME")
......@@ -135,7 +143,7 @@ IF(URDFDOM_FOUND AND BUILD_WITH_URDF_SUPPORT)
ADD_DEFINITIONS(-DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR)
PKG_CONFIG_APPEND_CFLAGS("-DPINOCCHIO_URDFDOM_USE_STD_SHARED_PTR")
ENDIF(${URDFDOM_VERSION} VERSION_GREATER "0.4.2")
ENDIF(URDFDOM_FOUND AND BUILD_WITH_URDF_SUPPORT)
ENDIF(BUILD_WITH_URDF_SUPPORT)
SET(BOOST_REQUIRED_COMPONENTS filesystem serialization system)
SET(BOOST_BUILD_COMPONENTS unit_test_framework)
......@@ -144,7 +152,6 @@ SET(BOOST_OPTIONAL_COMPONENTS "")
IF(BUILD_PYTHON_INTERFACE)
SET(BOOST_OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS} python)
FINDPYTHON()
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
ENDIF(BUILD_PYTHON_INTERFACE)
SET(BOOST_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} ${BOOST_OPTIONAL_COMPONENTS} ${BOOST_BUILD_COMPONENTS})
......@@ -170,10 +177,7 @@ FILE(GLOB_RECURSE HEADERS
${PROJECT_SOURCE_DIR}/src/*.hxx
)
IF(URDFDOM_FOUND)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_URDFDOM)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_URDFDOM")
ELSE(URDFDOM_FOUND)
IF(NOT BUILD_WITH_URDF_SUPPORT)
LIST(REMOVE_ITEM HEADERS
${PROJECT_SOURCE_DIR}/src/parsers/urdf.hpp
${PROJECT_SOURCE_DIR}/src/parsers/urdf/model.hxx
......@@ -181,17 +185,13 @@ ELSE(URDFDOM_FOUND)
${PROJECT_SOURCE_DIR}/src/parsers/urdf/utils.hpp
${PROJECT_SOURCE_DIR}/src/parsers/urdf/types.hpp
)
ENDIF(URDFDOM_FOUND)
ENDIF(NOT BUILD_WITH_URDF_SUPPORT)
IF(HPP_FCL_FOUND)
ADD_DEFINITIONS(-DPINOCCHIO_WITH_HPP_FCL)
LIST(APPEND CFLAGS_DEPENDENCIES "-DPINOCCHIO_WITH_HPP_FCL")
ELSE(HPP_FCL_FOUND)
IF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(REMOVE_ITEM HEADERS
${PROJECT_SOURCE_DIR}/src/spatial/fcl-pinocchio-conversions.hpp
)
ENDIF(HPP_FCL_FOUND)
ENDIF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(APPEND HEADERS macros.hpp)
......
......@@ -30,6 +30,7 @@ ENDFUNCTION(REMOVE_PATH_FROM_LIST)
# --- PYTHON TARGET --- #
IF(BUILD_PYTHON_INTERFACE)
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
ADD_CUSTOM_TARGET(python)
SET_TARGET_PROPERTIES(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)
......@@ -76,7 +77,7 @@ REMOVE_PATH_FROM_LIST("${${PROJECT_NAME}_PYTHON_HEADERS}" "${CMAKE_CURRENT_SOURC
REMOVE_PATH_FROM_LIST("${${PROJECT_NAME}_PYTHON_SOURCES}" "${CMAKE_CURRENT_SOURCE_DIR}/" ${PROJECT_NAME}_PYTHON_SOURCES)
# Python exposition of FCL
IF(NOT HPP_FCL_FOUND)
IF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(REMOVE_ITEM ${PROJECT_NAME}_PYTHON_HEADERS
multibody/fcl/contact.hpp
multibody/fcl/collision-result.hpp
......@@ -89,7 +90,7 @@ IF(NOT HPP_FCL_FOUND)
LIST(REMOVE_ITEM ${PROJECT_NAME}_PYTHON_SOURCES
multibody/fcl/expose-fcl.cpp
)
ENDIF(NOT HPP_FCL_FOUND)
ENDIF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
LIST(APPEND HEADERS ${${PROJECT_NAME}_PYTHON_HEADERS})
......@@ -98,9 +99,9 @@ MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python"
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/spatial")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/multibody")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/multibody/joint")
IF(HPP_FCL_FOUND)
IF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/multibody/fcl")
ENDIF(HPP_FCL_FOUND)
ENDIF(NOT BUILD_WITH_HPP_FCL_SUPPORT)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/parsers")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/serialization")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/bindings/python/algorithm")
......
......@@ -76,6 +76,7 @@ ENDIF(URDFDOM_FOUND)
IF(BUILD_PYTHON_INTERFACE)
ADD_PINOCCHIO_UNIT_TEST(python_parser eigenpy)
TARGET_INCLUDE_DIRECTORIES(test-cpp-python_parser SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(test-cpp-python_parser PUBLIC ${PYWRAP})
TARGET_LINK_LIBRARIES(test-cpp-python_parser PUBLIC ${PYTHON_LIBRARIES})
......@@ -124,25 +125,25 @@ ADD_PINOCCHIO_UNIT_TEST(contact-dynamics-derivatives)
ADD_PINOCCHIO_UNIT_TEST(multiprecision)
# Automatic differentiation
IF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
IF(BUILD_WITH_AUTODIFF_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(cppad-basic cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-spatial cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-joints cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-algo cppad)
ADD_PINOCCHIO_UNIT_TEST(cppad-algo-derivatives cppad)
IF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
IF(BUILD_WITH_CODEGEN_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(cppadcg-basic cppadcg)
SET_PROPERTY(TARGET test-cpp-cppadcg-basic PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(test-cpp-cppadcg-basic ${CMAKE_DL_LIBS})
ADD_PINOCCHIO_UNIT_TEST(cppadcg-algo cppadcg)
SET_PROPERTY(TARGET test-cpp-cppadcg-algo PROPERTY CXX_STANDARD 11)
TARGET_LINK_LIBRARIES(test-cpp-cppadcg-algo ${CMAKE_DL_LIBS})
ENDIF(CPPADCG_FOUND AND BUILD_WITH_CODEGEN_SUPPORT)
ENDIF(BUILD_WITH_CODEGEN_SUPPORT)
ENDIF(CPPAD_FOUND AND BUILD_WITH_AUTODIFF_SUPPORT)
ENDIF(BUILD_WITH_AUTODIFF_SUPPORT)
IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
IF(BUILD_WITH_CASADI_SUPPORT)
ADD_PINOCCHIO_UNIT_TEST(casadi-basic casadi)
SET_PROPERTY(TARGET test-cpp-casadi-basic PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-spatial casadi)
......@@ -153,5 +154,5 @@ IF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
SET_PROPERTY(TARGET test-cpp-casadi-algo PROPERTY CXX_STANDARD 11)
ADD_PINOCCHIO_UNIT_TEST(casadi-algo-derivatives casadi)
SET_PROPERTY(TARGET test-cpp-casadi-algo-derivatives PROPERTY CXX_STANDARD 11)
ENDIF(CASADI_FOUND AND BUILD_WITH_CASADI_SUPPORT)
ENDIF(BUILD_WITH_CASADI_SUPPORT)
......@@ -18,6 +18,7 @@ MACRO(ADD_UTIL NAME UTIL_SRC PKGS)
ENDFOREACH(PKG)
TARGET_LINK_LIBRARIES (${NAME} PUBLIC ${PROJECT_NAME})
IF(BUILD_PYTHON_INTERFACE)
TARGET_INCLUDE_DIRECTORIES(${NAME} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
TARGET_LINK_BOOST_PYTHON(${NAME} PUBLIC)
TARGET_LINK_LIBRARIES(${NAME} PUBLIC ${PYTHON_LIBRARIES})
ENDIF(BUILD_PYTHON_INTERFACE)
......
Supports Markdown
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