Commit 9939b995 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] Exports

parent 513980d2
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
# Project properties
SET(PROJECT_ORG loco-3d)
SET(PROJECT_NAME curves)
SET(PROJECT_DESCRIPTION
"template based classes for creating and manipulating spline and bezier curves. Comes with extra options specific to end-effector trajectories in robotics."
)
SET(PROJECT_URL "http://gepgitlab.laas.fr/${PROJECT_NAMESPACE}/${PROJECT_NAME}")
SET(PROJECT_DESCRIPTION "creatie and manipulate spline and bezier curves.")
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
# Project options
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
OPTION(INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python bindings" OFF)
OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
# Project configuration
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
SET(CXX_DISABLE_WERROR TRUE)
# JRL-cmakemodule setup
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/test.cmake)
INCLUDE(cmake/python.cmake)
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
ADD_REQUIRED_DEPENDENCY(eigen3)
ADD_OPTIONAL_DEPENDENCY(pinocchio)
# Project dependencies
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
ADD_PROJECT_DEPENDENCY(pinocchio)
OPTION(CURVES_WITH_PINOCCHIO_SUPPORT "Build with pinocchio support" ${PINOCCHIO_FOUND})
IF(CURVES_WITH_PINOCCHIO_SUPPORT)
IF(NOT PINOCCHIO_FOUND)
......@@ -31,31 +40,59 @@ ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
SET(BOOST_COMPONENTS unit_test_framework serialization)
OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
OPTION (INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python bindings" OFF)
IF(BUILD_PYTHON_INTERFACE)
FINDPYTHON()
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
ADD_REQUIRED_DEPENDENCY("eigenpy >= 1.6.8")
ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES "eigenpy >= 1.6.8")
SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
ENDIF(BUILD_PYTHON_INTERFACE)
#find_package(Boost 1.58 REQUIRED unit_test_framework system serialization)
#SET(BOOST_COMPONENTS unit_test_framework serialization)
SEARCH_FOR_BOOST()
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
IF(BUILD_PYTHON_INTERFACE)
ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)
# Main Library
SET(${PROJECT_NAME}_HEADERS
include/${PROJECT_NAME}/bernstein.h
include/${PROJECT_NAME}/curve_conversion.h
include/${PROJECT_NAME}/curve_abc.h
include/${PROJECT_NAME}/exact_cubic.h
include/${PROJECT_NAME}/MathDefs.h
include/${PROJECT_NAME}/polynomial.h
include/${PROJECT_NAME}/bezier_curve.h
include/${PROJECT_NAME}/cubic_spline.h
include/${PROJECT_NAME}/curve_constraint.h
include/${PROJECT_NAME}/quintic_spline.h
include/${PROJECT_NAME}/linear_variable.h
include/${PROJECT_NAME}/quadratic_variable.h
include/${PROJECT_NAME}/cubic_hermite_spline.h
include/${PROJECT_NAME}/piecewise_curve.h
include/${PROJECT_NAME}/so3_linear.h
include/${PROJECT_NAME}/se3_curve.h
include/${PROJECT_NAME}/fwd.h
include/${PROJECT_NAME}/helpers/effector_spline.h
include/${PROJECT_NAME}/helpers/effector_spline_rotation.h
include/${PROJECT_NAME}/optimization/definitions.h
include/${PROJECT_NAME}/optimization/details.h
include/${PROJECT_NAME}/optimization/quadratic_problem.h
include/${PROJECT_NAME}/optimization/integral_cost.h
include/${PROJECT_NAME}/python/python_definitions.h
include/${PROJECT_NAME}/serialization/archive.hpp
include/${PROJECT_NAME}/serialization/registeration.hpp
include/${PROJECT_NAME}/serialization/eigen-matrix.hpp
include/${PROJECT_NAME}/serialization/fwd.hpp
)
ADD_LIBRARY(${PROJECT_NAME} INTERFACE)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM INTERFACE ${EIGEN3_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
IF(CURVES_WITH_PINOCCHIO_SUPPORT)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} pinocchio::pinocchio)
ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
ADD_SUBDIRECTORY(include/curves)
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
IF(BUILD_PYTHON_INTERFACE)
ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)
ADD_SUBDIRECTORY(tests)
Subproject commit e7892518eb62e1d20823307af48d6041f78a8da4
Subproject commit 4514454f5f9462047b5c29f61b6c3e0db731c416
SET(${PROJECT_NAME}_HEADERS
bernstein.h
curve_conversion.h
curve_abc.h
exact_cubic.h
MathDefs.h
polynomial.h
bezier_curve.h
cubic_spline.h
curve_constraint.h
quintic_spline.h
linear_variable.h
quadratic_variable.h
cubic_hermite_spline.h
piecewise_curve.h
so3_linear.h
se3_curve.h
fwd.h
)
INSTALL(FILES
${${PROJECT_NAME}_HEADERS}
DESTINATION include/${PROJECT_NAME}
)
ADD_SUBDIRECTORY(helpers)
ADD_SUBDIRECTORY(optimization)
ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(serialization)
SET(${PROJECT_NAME}_HELPERS_HEADERS
effector_spline.h
effector_spline_rotation.h
)
INSTALL(FILES
${${PROJECT_NAME}_HELPERS_HEADERS}
DESTINATION include/${PROJECT_NAME}/helpers
)
SET(${PROJECT_NAME}_OPTIMIZATION_HEADERS
definitions.h
details.h
quadratic_problem.h
integral_cost.h
)
INSTALL(FILES
${${PROJECT_NAME}_OPTIMIZATION_HEADERS}
DESTINATION include/${PROJECT_NAME}/optimization
)
SET(${PROJECT_NAME}_PYTHON_HEADERS
python_definitions.h
)
INSTALL(FILES
${${PROJECT_NAME}_PYTHON_HEADERS}
DESTINATION include/${PROJECT_NAME}/python
)
SET(${PROJECT_NAME}_SERIALIZATION_HEADERS
archive.hpp
registeration.hpp
eigen-matrix.hpp
fwd.hpp
)
INSTALL(FILES
${${PROJECT_NAME}_SERIALIZATION_HEADERS}
DESTINATION include/${PROJECT_NAME}/serialization
)
ADD_SUBDIRECTORY(${PY_NAME})
ADD_SUBDIRECTORY(${PROJECT_NAME})
PYTHON_INSTALL_ON_SITE(${PY_NAME} __init__.py)
PYTHON_INSTALL_ON_SITE(${PY_NAME} plot.py)
PYTHON_INSTALL_ON_SITE(${PY_NAME} optimization.py)
PYTHON_INSTALL_ON_SITE(${PROJECT_NAME} __init__.py)
PYTHON_INSTALL_ON_SITE(${PROJECT_NAME} plot.py)
PYTHON_INSTALL_ON_SITE(${PROJECT_NAME} optimization.py)
ADD_PYTHON_UNIT_TEST("python-curves" "python/test/test.py" "python")
ADD_PYTHON_UNIT_TEST("python-optimization" "python/test/optimization.py" "python")
......
SET(${PY_NAME}_BINDINGS_SOURCES
SET(${PROJECT_NAME}_WRAP_SOURCES
curves_python.cpp
optimization_python.cpp
optimization_python.h
......@@ -8,20 +8,18 @@ SET(${PY_NAME}_BINDINGS_SOURCES
namespace.h
)
ADD_LIBRARY(${PY_NAME} SHARED ${${PY_NAME}_BINDINGS_SOURCES})
SET_TARGET_PROPERTIES(${PY_NAME} PROPERTIES PREFIX "")
TARGET_COMPILE_OPTIONS(${PY_NAME} PRIVATE "-Wno-conversion")
PKG_CONFIG_USE_DEPENDENCY(${PY_NAME} eigenpy)
SET(wrap ${PROJECT_NAME}_wrap)
ADD_LIBRARY(${wrap} SHARED ${${PROJECT_NAME}_WRAP_SOURCES})
SET_TARGET_PROPERTIES(${wrap} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} PREFIX "")
TARGET_COMPILE_OPTIONS(${wrap} PRIVATE "-Wno-conversion")
TARGET_LINK_LIBRARIES(${wrap} ${Boost_LIBRARIES} eigenpy::eigenpy)
IF(CURVES_WITH_PINOCCHIO_SUPPORT)
PKG_CONFIG_USE_DEPENDENCY(${PY_NAME} pinocchio)
TARGET_LINK_LIBRARIES(${wrap} pinocchio::pinocchio)
ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
TARGET_LINK_LIBRARIES(${PY_NAME} ${Boost_LIBRARIES})
# MESSAGE(WARNING "Boost libraries are : ${Boost_LIBRARIES}")
IF(APPLE)
# We need to change the extension for python bindings
SET_TARGET_PROPERTIES(${PY_NAME} PROPERTIES SUFFIX ".so")
SET_TARGET_PROPERTIES(${wrap} PROPERTIES SUFFIX ".so")
ENDIF(APPLE)
INSTALL(TARGETS ${PY_NAME} DESTINATION ${PYTHON_SITELIB}/${PY_NAME})
INSTALL(TARGETS ${wrap} DESTINATION ${PYTHON_SITELIB}/${PROJECT_NAME})
ADD_UNIT_TEST(
curves_tests Main.cpp
)
PKG_CONFIG_USE_DEPENDENCY(curves_tests eigen3)
TARGET_LINK_LIBRARIES(curves_tests ${Boost_LIBRARIES})
ADD_UNIT_TEST(curves_tests Main.cpp)
TARGET_LINK_LIBRARIES(curves_tests ${PROJECT_NAME} ${Boost_LIBRARIES})
TARGET_COMPILE_DEFINITIONS(curves_tests PRIVATE -DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/data/")
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