-
Notifications
You must be signed in to change notification settings - Fork 77
/
CMakeLists.txt
365 lines (313 loc) · 12.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
#
# Copyright (c) 2017-2021 CNRS
#
# This file is part of tsid tsid is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. tsid is distributed in the hope that it
# will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Lesser Public License for more details. You should have received a copy of the
# GNU Lesser General Public License along with tsid If not, see
# <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.10)
# Project properties
set(PROJECT_ORG stack-of-tasks)
set(PROJECT_NAME tsid)
set(PROJECT_DESCRIPTION
"Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio"
)
set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
# Project options
option(INSTALL_DOCUMENTATION "Build and install the documentation" OFF)
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)
option(INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
option(EIGEN_RUNTIME_NO_MALLOC
"If ON, it can assert in case of runtime allocation" ON)
option(EIGEN_NO_AUTOMATIC_RESIZING
"If ON, it forbids automatic resizing of dynamics arrays and matrices"
OFF)
option(BUILD_WITH_PROXQP "Support using the proxqp solver" OFF)
option(BUILD_WITH_OSQP "Support using the osqp solver" OFF)
# With pos, vel, acc awaiting renaming (e.g. in trajectory-base), we are
# producing a ton of deprecation warnings. Ignoring them for now; remove this
# once pos, vel, acc are renamed.
add_definitions(-Wno-deprecated-declarations)
# We frequently convert between signed and unsigned integers for Eigen::Index.
# Ignore them for now.
add_definitions(-Wno-sign-conversion)
# 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)
set(DOXYGEN_USE_MATHJAX YES)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
# Check if the submodule cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
else()
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message(
FATAL_ERROR
"\nCan't find jrl-cmakemodules. Please either:\n"
" - use git submodule: 'git submodule update --init'\n"
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
endif()
include("${JRL_CMAKE_MODULES}/base.cmake")
include("${JRL_CMAKE_MODULES}/ide.cmake")
include("${JRL_CMAKE_MODULES}/apple.cmake")
set_default_cmake_build_type("RelWithDebInfo")
# Handle APPLE Cmake policy
if(APPLE)
apply_default_apple_configuration()
endif(APPLE)
# Project definition
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})
if(INITIALIZE_WITH_NAN)
message(STATUS "Initialize with NaN all the Eigen entries.")
add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_NAN)
endif(INITIALIZE_WITH_NAN)
if(EIGEN_RUNTIME_NO_MALLOC)
message(STATUS "Option EIGEN_RUNTIME_NO_MALLOC on.")
add_definitions(-DEIGEN_RUNTIME_NO_MALLOC)
endif(EIGEN_RUNTIME_NO_MALLOC)
if(EIGEN_NO_AUTOMATIC_RESIZING)
message(STATUS "Option EIGEN_NO_AUTOMATIC_RESIZING on.")
add_definitions(-DEIGEN_NO_AUTOMATIC_RESIZING)
endif(EIGEN_NO_AUTOMATIC_RESIZING)
check_minimal_cxx_standard(17 ENFORCE)
# Project dependencies
if(BUILD_PYTHON_INTERFACE)
set(PYWRAP ${PROJECT_NAME}_pywrap)
add_project_dependency(eigenpy 2.7.12 REQUIRED)
endif(BUILD_PYTHON_INTERFACE)
add_project_dependency(pinocchio 2.3.1 REQUIRED)
add_project_dependency(eiquadprog 1.1.3 REQUIRED)
find_package(qpmad QUIET) # optional
if(qpmad_FOUND)
message(STATUS "qpmad found - building with qpmad support")
add_project_dependency(qpmad QUIET)
endif()
if(BUILD_TESTING)
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
endif(BUILD_TESTING)
# Main Library
set(${PROJECT_NAME}_MATH_HEADERS
include/tsid/math/fwd.hpp
include/tsid/math/utils.hpp
include/tsid/math/constraint-base.hpp
include/tsid/math/constraint-equality.hpp
include/tsid/math/constraint-inequality.hpp
include/tsid/math/constraint-bound.hpp)
set(${PROJECT_NAME}_TASKS_HEADERS
include/tsid/tasks/fwd.hpp
include/tsid/tasks/task-base.hpp
include/tsid/tasks/task-motion.hpp
include/tsid/tasks/task-actuation.hpp
include/tsid/tasks/task-contact-force.hpp
include/tsid/tasks/task-com-equality.hpp
include/tsid/tasks/task-se3-equality.hpp
include/tsid/tasks/task-contact-force-equality.hpp
include/tsid/tasks/task-cop-equality.hpp
include/tsid/tasks/task-actuation-equality.hpp
include/tsid/tasks/task-actuation-bounds.hpp
include/tsid/tasks/task-joint-bounds.hpp
include/tsid/tasks/task-joint-posture.hpp
include/tsid/tasks/task-joint-posVelAcc-bounds.hpp
include/tsid/tasks/task-capture-point-inequality.hpp
include/tsid/tasks/task-angular-momentum-equality.hpp
include/tsid/tasks/task-two-frames-equality.hpp)
set(${PROJECT_NAME}_CONTACTS_HEADERS
include/tsid/contacts/fwd.hpp
include/tsid/contacts/contact-base.hpp
include/tsid/contacts/contact-6d.hpp
include/tsid/contacts/contact-point.hpp
include/tsid/contacts/measured-force-base.hpp
include/tsid/contacts/measured-3Dforce.hpp
include/tsid/contacts/measured-6Dwrench.hpp
include/tsid/contacts/contact-two-frame-positions.hpp)
set(${PROJECT_NAME}_TRAJECTORIES_HEADERS
include/tsid/trajectories/fwd.hpp
include/tsid/trajectories/trajectory-base.hpp
include/tsid/trajectories/trajectory-se3.hpp
include/tsid/trajectories/trajectory-euclidian.hpp)
set(${PROJECT_NAME}_SOLVERS_HEADERS
include/tsid/solvers/fwd.hpp
include/tsid/solvers/utils.hpp
include/tsid/solvers/solver-qpData.hpp
include/tsid/solvers/solver-HQP-output.hpp
include/tsid/solvers/solver-HQP-base.hpp
include/tsid/solvers/solver-HQP-factory.hpp
include/tsid/solvers/solver-HQP-factory.hxx
include/tsid/solvers/solver-HQP-qpoases.hpp
include/tsid/solvers/solver-HQP-eiquadprog.hpp
include/tsid/solvers/solver-HQP-eiquadprog-rt.hpp
include/tsid/solvers/solver-HQP-eiquadprog-rt.hxx
include/tsid/solvers/solver-HQP-eiquadprog-fast.hpp)
if(BUILD_WITH_PROXQP)
find_package(proxsuite REQUIRED)
list(APPEND ${PROJECT_NAME}_SOLVERS_HEADERS
include/tsid/solvers/solver-proxqp.hpp)
# Determine whether ot use the default target or the vectorized target, if
# available
set(proxsuite_INTERFACE proxsuite::proxsuite)
if(NOT TARGET proxsuite::proxsuite-vectorized)
message(
STATUS
"proxsuite::proxsuite-vectorized not available - defaulting to non-vectorized ProxQP"
)
else()
set(proxsuite_INTERFACE proxsuite::proxsuite-vectorized)
endif()
endif()
if(BUILD_WITH_OSQP)
find_package(OsqpEigen REQUIRED)
list(APPEND ${PROJECT_NAME}_SOLVERS_HEADERS
include/tsid/solvers/solver-osqp.hpp)
endif()
if(qpmad_FOUND)
list(APPEND ${PROJECT_NAME}_SOLVERS_HEADERS
include/tsid/solvers/solver-HQP-qpmad.hpp)
endif()
set(${PROJECT_NAME}_ROBOTS_HEADERS include/tsid/robots/fwd.hpp
include/tsid/robots/robot-wrapper.hpp)
set(${PROJECT_NAME}_FORMULATIONS_HEADERS
include/tsid/formulations/contact-level.hpp
include/tsid/formulations/inverse-dynamics-formulation-base.hpp
include/tsid/formulations/inverse-dynamics-formulation-acc-force.hpp)
set(${PROJECT_NAME}_HEADERS
include/tsid/macros.hpp
include/tsid/utils/statistics.hpp
include/tsid/utils/stop-watch.hpp
include/tsid/utils/Stdafx.hh
${${PROJECT_NAME}_MATH_HEADERS}
${${PROJECT_NAME}_TASKS_HEADERS}
${${PROJECT_NAME}_CONTACTS_HEADERS}
${${PROJECT_NAME}_TRAJECTORIES_HEADERS}
${${PROJECT_NAME}_SOLVERS_HEADERS}
${${PROJECT_NAME}_ROBOTS_HEADERS}
${${PROJECT_NAME}_FORMULATIONS_HEADERS})
list(REMOVE_DUPLICATES ${PROJECT_NAME}_HEADERS)
set(${PROJECT_NAME}_MATH_SOURCES
src/math/constraint-base.cpp src/math/constraint-equality.cpp
src/math/constraint-inequality.cpp src/math/constraint-bound.cpp
src/math/utils.cpp)
set(${PROJECT_NAME}_TASKS_SOURCES
src/tasks/task-base.cpp
src/tasks/task-actuation-bounds.cpp
src/tasks/task-actuation-equality.cpp
src/tasks/task-actuation.cpp
src/tasks/task-com-equality.cpp
src/tasks/task-contact-force-equality.cpp
src/tasks/task-contact-force.cpp
src/tasks/task-cop-equality.cpp
src/tasks/task-joint-bounds.cpp
src/tasks/task-joint-posture.cpp
src/tasks/task-joint-posVelAcc-bounds.cpp
src/tasks/task-capture-point-inequality.cpp
src/tasks/task-motion.cpp
src/tasks/task-se3-equality.cpp
src/tasks/task-angular-momentum-equality.cpp
src/tasks/task-two-frames-equality.cpp)
set(${PROJECT_NAME}_CONTACTS_SOURCES
src/contacts/contact-base.cpp
src/contacts/contact-6d.cpp
src/contacts/contact-point.cpp
src/contacts/measured-force-base.cpp
src/contacts/measured-3Dforce.cpp
src/contacts/measured-6Dwrench.cpp
src/contacts/contact-two-frame-positions.cpp)
set(${PROJECT_NAME}_TRAJECTORIES_SOURCES
src/trajectories/trajectory-se3.cpp
src/trajectories/trajectory-euclidian.cpp)
set(${PROJECT_NAME}_SOLVERS_SOURCES
src/solvers/solver-HQP-base.cpp
src/solvers/solver-HQP-factory.cpp
src/solvers/solver-HQP-eiquadprog.cpp
src/solvers/solver-HQP-eiquadprog-fast.cpp
src/solvers/solver-HQP-qpoases.cpp
src/solvers/utils.cpp)
if(BUILD_WITH_PROXQP)
list(APPEND ${PROJECT_NAME}_SOLVERS_SOURCES src/solvers/solver-proxqp.cpp)
endif()
if(BUILD_WITH_OSQP)
list(APPEND ${PROJECT_NAME}_SOLVERS_SOURCES src/solvers/solver-osqp.cpp)
endif()
if(qpmad_FOUND)
list(APPEND ${PROJECT_NAME}_SOLVERS_SOURCES src/solvers/solver-HQP-qpmad.cpp)
endif()
set(${PROJECT_NAME}_ROBOTS_SOURCES src/robots/robot-wrapper.cpp)
set(${PROJECT_NAME}_FORMULATIONS_SOURCES
src/formulations/contact-level.cpp
src/formulations/inverse-dynamics-formulation-base.cpp
src/formulations/inverse-dynamics-formulation-acc-force.cpp)
set(${PROJECT_NAME}_SOURCES
src/utils/statistics.cpp
src/utils/stop-watch.cpp
${${PROJECT_NAME}_MATH_SOURCES}
${${PROJECT_NAME}_TASKS_SOURCES}
${${PROJECT_NAME}_CONTACTS_SOURCES}
${${PROJECT_NAME}_TRAJECTORIES_SOURCES}
${${PROJECT_NAME}_SOLVERS_SOURCES}
${${PROJECT_NAME}_ROBOTS_SOURCES}
${${PROJECT_NAME}_FORMULATIONS_SOURCES})
add_header_group(${PROJECT_NAME}_HEADERS)
add_source_group(${PROJECT_NAME}_SOURCES)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
target_include_directories(
${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(${PROJECT_NAME} PUBLIC pinocchio::pinocchio
eiquadprog::eiquadprog)
if(BUILD_WITH_PROXQP)
target_compile_definitions(${PROJECT_NAME} PUBLIC -DTSID_WITH_PROXSUITE)
target_link_libraries(${PROJECT_NAME} PUBLIC proxsuite::proxsuite)
endif()
if(BUILD_WITH_OSQP)
target_link_libraries(${PROJECT_NAME} PUBLIC OsqpEigen::OsqpEigen)
target_compile_definitions(${PROJECT_NAME} PUBLIC -DTSID_WITH_OSQP)
endif()
if(qpmad_FOUND)
target_include_directories(${PROJECT_NAME} PUBLIC ${qpmad_INCLUDE_DIRS})
target_compile_definitions(${PROJECT_NAME} PUBLIC -DTSID_QPMAD_FOUND)
endif()
if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
endif(SUFFIX_SO_VERSION)
if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
endif(NOT INSTALL_PYTHON_INTERFACE_ONLY)
add_subdirectory(bindings)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(BUILD_TESTING)
# --- PACKAGING ----------------------------------------------------------------
if(NOT INSTALL_PYTHON_INTERFACE_ONLY)
install(FILES package.xml DESTINATION share/${PROJECT_NAME})
endif(NOT INSTALL_PYTHON_INTERFACE_ONLY)