CMakeLists.txt 3.58 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)
5
SET(PROJECT_NAME curves)
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

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

Guilhem Saurel's avatar
Guilhem Saurel committed
41
SET(BOOST_COMPONENTS unit_test_framework serialization)
Guilhem Saurel's avatar
Guilhem Saurel committed
42

43
IF(BUILD_PYTHON_INTERFACE)
Guilhem Saurel's avatar
Guilhem Saurel committed
44
  FINDPYTHON()
Guilhem Saurel's avatar
Guilhem Saurel committed
45
  ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES "eigenpy >= 1.6.8")
Guilhem Saurel's avatar
Guilhem Saurel committed
46
  SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
47
48
ENDIF(BUILD_PYTHON_INTERFACE)

Guilhem Saurel's avatar
Guilhem Saurel committed
49
SEARCH_FOR_BOOST()
50

Guilhem Saurel's avatar
Guilhem Saurel committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 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
80
  include/${PROJECT_NAME}/serialization/curves.hpp
Guilhem Saurel's avatar
Guilhem Saurel committed
81
82
83
84
85
86
87
88
  )

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)
89

90
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Guilhem Saurel's avatar
Guilhem Saurel committed
91
  INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
92
93
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)

Guilhem Saurel's avatar
Guilhem Saurel committed
94
95
96
97
IF(BUILD_PYTHON_INTERFACE)
  ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)

98
ADD_SUBDIRECTORY(tests)