CMakeLists.txt 3.91 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
2

Guilhem Saurel's avatar
Guilhem Saurel committed
3
# Project properties
4
SET(PROJECT_ORG loco-3d)
Steve T's avatar
Steve T committed
5
SET(PROJECT_NAME ndcurves)
Guilhem Saurel's avatar
Guilhem Saurel committed
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
Guilhem Saurel's avatar
Guilhem Saurel committed
19

Guilhem Saurel's avatar
Guilhem Saurel committed
20
# JRL-cmakemodule setup
Guilhem Saurel's avatar
Guilhem Saurel committed
21
22
23
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/python.cmake)
24

Guilhem Saurel's avatar
Guilhem Saurel committed
25
# Project definition
Guilhem Saurel's avatar
Guilhem Saurel committed
26
27
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
28
CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
29

Guilhem Saurel's avatar
Guilhem Saurel committed
30
31
# Project dependencies
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
32
ADD_PROJECT_DEPENDENCY(pinocchio QUIET)
33
OPTION(CURVES_WITH_PINOCCHIO_SUPPORT "Build with pinocchio support" ${pinocchio_FOUND})
34
IF(CURVES_WITH_PINOCCHIO_SUPPORT)
35
  IF(NOT pinocchio_FOUND)
36
    MESSAGE(FATAL_ERROR "CURVES_WITH_PINOCCHIO_SUPPORT selected, but pinocchio has not been found")
37
  ENDIF(NOT pinocchio_FOUND)
38
  PKG_CONFIG_APPEND_CFLAGS("-DCURVES_WITH_PINOCCHIO_SUPPORT")
39
ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
40
SET(PACKAGE_EXTRA_MACROS "SET(CURVES_WITH_PINOCCHIO_SUPPORT ${CURVES_WITH_PINOCCHIO_SUPPORT})")
41

42
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS serialization)
Guilhem Saurel's avatar
Guilhem Saurel committed
43

44
IF(BUILD_PYTHON_INTERFACE)
Guilhem Saurel's avatar
Guilhem Saurel committed
45
  FINDPYTHON()
46
  SEARCH_FOR_BOOST_PYTHON(REQUIRED)
Guilhem Saurel's avatar
Guilhem Saurel committed
47
  ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES "eigenpy >= 1.6.8")
48
49
ENDIF(BUILD_PYTHON_INTERFACE)

Guilhem Saurel's avatar
Guilhem Saurel committed
50
51
52
53
# Main Library
SET(${PROJECT_NAME}_HEADERS
  include/${PROJECT_NAME}/bernstein.h
  include/${PROJECT_NAME}/bezier_curve.h
Guilhem Saurel's avatar
Guilhem Saurel committed
54
55
  include/${PROJECT_NAME}/constant_curve.h
  include/${PROJECT_NAME}/cross_implementation.h
Guilhem Saurel's avatar
Guilhem Saurel committed
56
  include/${PROJECT_NAME}/cubic_hermite_spline.h
Guilhem Saurel's avatar
Guilhem Saurel committed
57
58
59
60
  include/${PROJECT_NAME}/curve_abc.h
  include/${PROJECT_NAME}/curve_constraint.h
  include/${PROJECT_NAME}/curve_conversion.h
  include/${PROJECT_NAME}/exact_cubic.h
Guilhem Saurel's avatar
Guilhem Saurel committed
61
62
63
  include/${PROJECT_NAME}/fwd.h
  include/${PROJECT_NAME}/helpers/effector_spline.h
  include/${PROJECT_NAME}/helpers/effector_spline_rotation.h
Guilhem Saurel's avatar
Guilhem Saurel committed
64
65
  include/${PROJECT_NAME}/linear_variable.h
  include/${PROJECT_NAME}/MathDefs.h
Guilhem Saurel's avatar
Guilhem Saurel committed
66
67
68
  include/${PROJECT_NAME}/optimization/definitions.h
  include/${PROJECT_NAME}/optimization/details.h
  include/${PROJECT_NAME}/optimization/integral_cost.h
Guilhem Saurel's avatar
Guilhem Saurel committed
69
70
71
  include/${PROJECT_NAME}/optimization/quadratic_problem.h
  include/${PROJECT_NAME}/piecewise_curve.h
  include/${PROJECT_NAME}/polynomial.h
Guilhem Saurel's avatar
Guilhem Saurel committed
72
  include/${PROJECT_NAME}/python/python_definitions.h
Guilhem Saurel's avatar
Guilhem Saurel committed
73
74
  include/${PROJECT_NAME}/quadratic_variable.h
  include/${PROJECT_NAME}/se3_curve.h
Guilhem Saurel's avatar
Guilhem Saurel committed
75
  include/${PROJECT_NAME}/serialization/archive.hpp
76
  include/${PROJECT_NAME}/serialization/curves.hpp
Guilhem Saurel's avatar
Guilhem Saurel committed
77
78
79
80
  include/${PROJECT_NAME}/serialization/eigen-matrix.hpp
  include/${PROJECT_NAME}/serialization/registeration.hpp
  include/${PROJECT_NAME}/sinusoidal.h
  include/${PROJECT_NAME}/so3_linear.h
Guilhem Saurel's avatar
Guilhem Saurel committed
81
82
83
  )

ADD_LIBRARY(${PROJECT_NAME} INTERFACE)
84
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM INTERFACE ${EIGEN3_INCLUDE_DIR})
Guilhem Saurel's avatar
Guilhem Saurel committed
85
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
86
TARGET_LINK_LIBRARIES(${PROJECT_NAME} INTERFACE Boost::serialization)
Guilhem Saurel's avatar
Guilhem Saurel committed
87
IF(CURVES_WITH_PINOCCHIO_SUPPORT)
88
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} INTERFACE pinocchio::pinocchio)
89
  TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} INTERFACE -DCURVES_WITH_PINOCCHIO_SUPPORT)
Guilhem Saurel's avatar
Guilhem Saurel committed
90
ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
91

92
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Guilhem Saurel's avatar
Guilhem Saurel committed
93
  INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
Guilhem Saurel's avatar
Guilhem Saurel committed
94
  INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
95
96
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)

Guilhem Saurel's avatar
Guilhem Saurel committed
97
98
99
100
IF(BUILD_PYTHON_INTERFACE)
  ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)

101
ADD_SUBDIRECTORY(tests)