CMakeLists.txt 3.76 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
  IF(NOT pinocchio_FOUND)
35
    MESSAGE(FATAL_ERROR "CURVES_WITH_PINOCCHIO_SUPPORT selected, but pinocchio has not been found")
36
  ENDIF(NOT pinocchio_FOUND)
37
  ADD_DEFINITIONS(-DCURVES_WITH_PINOCCHIO_SUPPORT)
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

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

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

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

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

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)
90
  TARGET_LINK_LIBRARIES(${PROJECT_NAME} INTERFACE pinocchio::pinocchio)
Guilhem Saurel's avatar
Guilhem Saurel committed
91
ENDIF(CURVES_WITH_PINOCCHIO_SUPPORT)
92

93
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Guilhem Saurel's avatar
Guilhem Saurel committed
94
  INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
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)