CMakeLists.txt 3.82 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
32
# Project dependencies
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
ADD_PROJECT_DEPENDENCY(pinocchio)
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
  ADD_DEFINITIONS(-DCURVES_WITH_PINOCCHIO_SUPPORT)
39
  PKG_CONFIG_APPEND_CFLAGS("-DCURVES_WITH_PINOCCHIO_SUPPORT")
40
ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
41
SET(PACKAGE_EXTRA_MACROS "SET(CURVES_WITH_PINOCCHIO_SUPPORT ${CURVES_WITH_PINOCCHIO_SUPPORT})")
42

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

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

Guilhem Saurel's avatar
Guilhem Saurel committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 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}/curve_constraint.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
Pierre Fernbach's avatar
Pierre Fernbach committed
67
  include/${PROJECT_NAME}/sinusoidal.h
Guilhem Saurel's avatar
Guilhem Saurel committed
68
  include/${PROJECT_NAME}/fwd.h
Pierre Fernbach's avatar
Pierre Fernbach committed
69
  include/${PROJECT_NAME}/constant_curve.h
Guilhem Saurel's avatar
Guilhem Saurel committed
70
71
72
73
74
75
76
77
78
79
  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
80
  include/${PROJECT_NAME}/serialization/curves.hpp
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)
Guilhem Saurel's avatar
Guilhem Saurel committed
89
ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
90

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

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

100
ADD_SUBDIRECTORY(tests)