CMakeLists.txt 7.69 KB
Newer Older
Olivier Stasse's avatar
Olivier Stasse committed
1
2
# Copyright 2010, 2019 JRL, CNRS/AIST, LAAS CNRS
# See LICENSE file.
Francois Bleibel's avatar
Francois Bleibel committed
3

Guilhem Saurel's avatar
Guilhem Saurel committed
4
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
Francois Bleibel's avatar
Francois Bleibel committed
5

6
# Project properties
Olivier Stasse's avatar
Olivier Stasse committed
7
8
9
SET(PROJECT_ORG stack-of-tasks)
SET(PROJECT_NAME sot-core)
SET(PROJECT_DESCRIPTION "Hierarchical task solver plug-in for dynamic-graph.")
10
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
Olivier Stasse's avatar
Olivier Stasse committed
11

12
13
14
15
# 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)
16

17
# Project configuration
Guilhem Saurel's avatar
Guilhem Saurel committed
18
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
19
  SET(PROJECT_USE_CMAKE_EXPORT TRUE)
20
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
21
22
23
SET(CUSTOM_HEADER_DIR "sot/core")
SET(CXX_DISABLE_WERROR TRUE)
SET(DOXYGEN_USE_MATHJAX YES)
24
SET(DOXYGEN_USE_TEMPLATE_CSS YES)
Olivier Stasse's avatar
Olivier Stasse committed
25

26
# JRL-cmakemodule setup
Thomas Moulard's avatar
Thomas Moulard committed
27
INCLUDE(cmake/base.cmake)
Guilhem Saurel's avatar
Guilhem Saurel committed
28
INCLUDE(cmake/boost.cmake)
29
30
INCLUDE(cmake/python.cmake)
INCLUDE(cmake/sphinx.cmake)
Francois Bleibel's avatar
Francois Bleibel committed
31

32
# Project definition
33
34
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
35
CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
Francois Bleibel's avatar
Francois Bleibel committed
36

37
38
39
# Project dependencies
ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED PKG_CONFIG_REQUIRES dynamic-graph)
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED PKG_CONFIG_REQUIRES pinocchio)
40
41
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS regex)
IF(BUILD_TESTING)
42
  ADD_PROJECT_DEPENDENCY(example-robot-data)
43
44
  FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework program_options)
ENDIF()
45

46
47
48
49
50
51
IF(Boost_VERSION GREATER 107299 OR Boost_VERSION_MACRO GREATER 107299)
  # Silence a warning about a deprecated use of boost bind by boost >= 1.73
  # without dropping support for boost < 1.73
  ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
ENDIF()

52
53
IF(BUILD_PYTHON_INTERFACE)
  FINDPYTHON()
54
  STRING(REGEX REPLACE "-" "_" PYTHON_DIR ${CUSTOM_HEADER_DIR})
55
  ADD_PROJECT_DEPENDENCY(dynamic-graph-python 4.0.0 REQUIRED
56
    PKG_CONFIG_REQUIRES dynamic-graph-python)
Joseph Mirabel's avatar
Joseph Mirabel committed
57
  ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES eigenpy)
58
  SEARCH_FOR_BOOST_PYTHON(REQUIRED)
59
60
ENDIF(BUILD_PYTHON_INTERFACE)

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Verbosity level
IF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
  ADD_DEFINITIONS(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG)
ENDIF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))

# Main Library
SET(${PROJECT_NAME}_HEADERS
  include/${CUSTOM_HEADER_DIR}/abstract-sot-external-interface.hh
  include/${CUSTOM_HEADER_DIR}/additional-functions.hh
  include/${CUSTOM_HEADER_DIR}/api.hh
  include/${CUSTOM_HEADER_DIR}/binary-int-to-uint.hh
  include/${CUSTOM_HEADER_DIR}/binary-op.hh
  include/${CUSTOM_HEADER_DIR}/causal-filter.hh
  include/${CUSTOM_HEADER_DIR}/clamp-workspace.hh
  include/${CUSTOM_HEADER_DIR}/com-freezer.hh
  include/${CUSTOM_HEADER_DIR}/contiifstream.hh
  include/${CUSTOM_HEADER_DIR}/debug.hh
  include/${CUSTOM_HEADER_DIR}/derivator.hh
  include/${CUSTOM_HEADER_DIR}/device.hh
  include/${CUSTOM_HEADER_DIR}/double-constant.hh
  include/${CUSTOM_HEADER_DIR}/event.hh
  include/${CUSTOM_HEADER_DIR}/exception-abstract.hh
  include/${CUSTOM_HEADER_DIR}/exception-dynamic.hh
  include/${CUSTOM_HEADER_DIR}/exception-factory.hh
  include/${CUSTOM_HEADER_DIR}/exception-feature.hh
  include/${CUSTOM_HEADER_DIR}/exception-signal.hh
  include/${CUSTOM_HEADER_DIR}/exception-task.hh
  include/${CUSTOM_HEADER_DIR}/exception-tools.hh
  include/${CUSTOM_HEADER_DIR}/exp-moving-avg.hh
  include/${CUSTOM_HEADER_DIR}/factory.hh
  include/${CUSTOM_HEADER_DIR}/feature-1d.hh
  include/${CUSTOM_HEADER_DIR}/feature-abstract.hh
  include/${CUSTOM_HEADER_DIR}/feature-generic.hh
  include/${CUSTOM_HEADER_DIR}/feature-joint-limits.hh
  include/${CUSTOM_HEADER_DIR}/feature-line-distance.hh
  include/${CUSTOM_HEADER_DIR}/feature-point6d-relative.hh
  include/${CUSTOM_HEADER_DIR}/feature-point6d.hh
  include/${CUSTOM_HEADER_DIR}/feature-pose.hh
  include/${CUSTOM_HEADER_DIR}/feature-posture.hh
  include/${CUSTOM_HEADER_DIR}/feature-task.hh
  include/${CUSTOM_HEADER_DIR}/feature-vector3.hh
  include/${CUSTOM_HEADER_DIR}/feature-visual-point.hh
  include/${CUSTOM_HEADER_DIR}/filter-differentiator.hh
  include/${CUSTOM_HEADER_DIR}/fir-filter.hh
  include/${CUSTOM_HEADER_DIR}/flags.hh
  include/${CUSTOM_HEADER_DIR}/gain-adaptive.hh
  include/${CUSTOM_HEADER_DIR}/gain-hyperbolic.hh
  include/${CUSTOM_HEADER_DIR}/gripper-control.hh
  include/${CUSTOM_HEADER_DIR}/integrator-abstract.hh
  include/${CUSTOM_HEADER_DIR}/integrator-euler.hh
  include/${CUSTOM_HEADER_DIR}/joint-limitator.hh
  include/${CUSTOM_HEADER_DIR}/kalman.hh
  include/${CUSTOM_HEADER_DIR}/latch.hh
  include/${CUSTOM_HEADER_DIR}/macros-signal.hh
  include/${CUSTOM_HEADER_DIR}/mailbox-vector.hh
  include/${CUSTOM_HEADER_DIR}/mailbox.hh
  include/${CUSTOM_HEADER_DIR}/mailbox.hxx
  include/${CUSTOM_HEADER_DIR}/matrix-constant.hh
  include/${CUSTOM_HEADER_DIR}/matrix-geometry.hh
  include/${CUSTOM_HEADER_DIR}/matrix-svd.hh
  include/${CUSTOM_HEADER_DIR}/memory-task-sot.hh
  include/${CUSTOM_HEADER_DIR}/motion-period.hh
  include/${CUSTOM_HEADER_DIR}/multi-bound.hh
  include/${CUSTOM_HEADER_DIR}/neck-limitation.hh
  include/${CUSTOM_HEADER_DIR}/op-point-modifier.hh
  include/${CUSTOM_HEADER_DIR}/parameter-server.hh
  include/${CUSTOM_HEADER_DIR}/periodic-call.hh
  include/${CUSTOM_HEADER_DIR}/periodic-call-entity.hh
  include/${CUSTOM_HEADER_DIR}/pool.hh
  include/${CUSTOM_HEADER_DIR}/reader.hh
  include/${CUSTOM_HEADER_DIR}/robot-simu.hh
  include/${CUSTOM_HEADER_DIR}/robot-utils.hh
  include/${CUSTOM_HEADER_DIR}/sot.hh
  include/${CUSTOM_HEADER_DIR}/stop-watch.hh
  include/${CUSTOM_HEADER_DIR}/switch.hh
  include/${CUSTOM_HEADER_DIR}/task.hh
  include/${CUSTOM_HEADER_DIR}/task-abstract.hh
  include/${CUSTOM_HEADER_DIR}/task-conti.hh
  include/${CUSTOM_HEADER_DIR}/task-pd.hh
  include/${CUSTOM_HEADER_DIR}/task-unilateral.hh
  include/${CUSTOM_HEADER_DIR}/time-stamp.hh
  include/${CUSTOM_HEADER_DIR}/timer.hh
  include/${CUSTOM_HEADER_DIR}/trajectory.hh
  include/${CUSTOM_HEADER_DIR}/unary-op.hh
  include/${CUSTOM_HEADER_DIR}/utils-windows.hh
  include/${CUSTOM_HEADER_DIR}/variadic-op.hh
  include/${CUSTOM_HEADER_DIR}/vector-constant.hh
  include/${CUSTOM_HEADER_DIR}/vector-to-rotation.hh
  include/${CUSTOM_HEADER_DIR}/visual-point-projecter.hh
  )
Francois Bleibel's avatar
Francois Bleibel committed
151

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
SET(${PROJECT_NAME}_SOURCES
  src/debug/debug.cpp
  src/debug/contiifstream.cpp
  src/exception/exception-abstract.cpp
  src/exception/exception-dynamic.cpp
  src/exception/exception-factory.cpp
  src/exception/exception-feature.cpp
  src/exception/exception-signal.cpp
  src/exception/exception-task.cpp
  src/exception/exception-tools.cpp
  src/signal/signal-cast.cpp
  src/feature/feature-abstract.cpp
  src/task/task-abstract.cpp
  src/task/multi-bound.cpp
  src/sot/flags.cpp
  src/sot/memory-task-sot.cpp
  src/factory/pool.cpp
  src/tools/utils-windows
  src/tools/periodic-call
  src/tools/device
  src/tools/trajectory
  src/tools/robot-utils
  src/matrix/matrix-svd
  src/filters/causal-filter
  src/utils/stop-watch
Thomas Moulard's avatar
Thomas Moulard committed
177
  )
Francois Bleibel's avatar
Francois Bleibel committed
178

179
180
181
ADD_LIBRARY(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
182
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Boost::regex
183
184
185
186
187
  dynamic-graph::dynamic-graph pinocchio::pinocchio)

IF(SUFFIX_SO_VERSION)
  SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
188

Guilhem Saurel's avatar
Guilhem Saurel committed
189
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
190
  INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
Guilhem Saurel's avatar
Guilhem Saurel committed
191
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Olivier Stasse's avatar
Olivier Stasse committed
192

Thomas Moulard's avatar
Thomas Moulard committed
193
ADD_SUBDIRECTORY(src)
194
195
196
IF(BUILD_TESTING)
  ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTING)
197
ADD_SUBDIRECTORY(doc)
Francois Bleibel's avatar
Francois Bleibel committed
198

199
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
Guilhem Saurel's avatar
Guilhem Saurel committed
200
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
201
  INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
202
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)