1616
1717CMAKE_MINIMUM_REQUIRED (VERSION 3.1)
1818
19- SET (PROJECT_NAMESPACE stack-of-tasks)
19+ # Project properties
20+ SET (PROJECT_ORG stack-of-tasks)
2021SET (PROJECT_NAME tsid)
2122SET (PROJECT_DESCRIPTION "Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio" )
22- SET (PROJECT_URL "http://github.com/${PROJECT_NAMESPACE} /${PROJECT_NAME} " )
23+ SET (PROJECT_URL "https://github.com/${PROJECT_ORG} /${PROJECT_NAME} " )
24+
25+ # Project options
26+ OPTION (BUILD_PYTHON_INTERFACE "Build the python bindings" ON )
27+ OPTION (INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python bindings" OFF )
28+ OPTION (SUFFIX_SO_VERSION "Suffix library name with its version" ON )
29+ OPTION (INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF )
30+ OPTION (EIGEN_RUNTIME_NO_MALLOC "If ON, it can assert in case of runtime allocation" ON )
31+ OPTION (EIGEN_NO_AUTOMATIC_RESIZING "If ON, it forbids automatic resizing of dynamics arrays and matrices" OFF )
32+
33+ # Project configuration
34+ IF (NOT INSTALL_PYTHON_INTERFACE_ONLY)
35+ SET (PROJECT_USE_CMAKE_EXPORT TRUE )
36+ ENDIF (NOT INSTALL_PYTHON_INTERFACE_ONLY)
37+ SET (CXX_DISABLE_WERROR TRUE )
38+ SET (DOXYGEN_USE_MATHJAX YES )
39+ SET (CMAKE_VERBOSE_MAKEFILE TRUE )
2340
41+ # JRL-cmakemodule setup
2442INCLUDE (cmake/base.cmake)
2543INCLUDE (cmake/boost.cmake)
2644INCLUDE (cmake/python.cmake)
2745INCLUDE (cmake/ide.cmake)
2846INCLUDE (cmake/apple .cmake)
29- include (cmake/test .cmake)
30-
31- OPTION (INSTALL_DOCUMENTATION "Generate and install the documentation" OFF )
32-
33- SET (DOXYGEN_USE_MATHJAX YES )
3447
3548# Handle APPLE Cmake policy
3649IF (APPLE )
3750 APPLY_DEFAULT_APPLE_CONFIGURATION()
3851ENDIF (APPLE )
3952
40- # Disable -Werror on Unix for now.
41- SET (CXX_DISABLE_WERROR True )
42- SET (CMAKE_VERBOSE_MAKEFILE True )
43-
53+ # Project definition
4454COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
4555PROJECT (${PROJECT_NAME} ${PROJECT_ARGS} )
4656
47- IF (WIN32 )
48- SET (LINK copy_if_different)
49- ELSE (WIN32 )
50- SET (LINK create_symlink)
51- ENDIF (WIN32 )
52-
53- # --- OPTIONS ----------------------------------------
54- OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON )
55- OPTION (INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF )
56- OPTION (EIGEN_RUNTIME_NO_MALLOC "If ON, it can assert in case of runtime allocation" ON )
57- OPTION (EIGEN_NO_AUTOMATIC_RESIZING "If ON, it forbids automatic resizing of dynamics arrays and matrices" OFF )
58-
5957IF (INITIALIZE_WITH_NAN)
6058 MESSAGE (STATUS "Initialize with NaN all the Eigen entries." )
6159 ADD_DEFINITIONS (-DEIGEN_INITIALIZE_MATRICES_BY_NAN)
@@ -71,142 +69,200 @@ IF(EIGEN_NO_AUTOMATIC_RESIZING)
7169 ADD_DEFINITIONS (-DEIGEN_NO_AUTOMATIC_RESIZING)
7270ENDIF (EIGEN_NO_AUTOMATIC_RESIZING)
7371
74- # ----------------------------------------------------
75- # --- DEPENDENCIES -----------------------------------
76- # ----------------------------------------------------
77- ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.2.0" ) # Eigen::Ref appeared from 3.2.0
78-
79- # Fail-safe support for catkin-ized pinocchio:
80- # - If catkin-based pinocchio is installed it runs the CFG_EXTRAS to set up the Pinocchio preprocessor directives
81- # - If it isn't, nothing happens and the subsequent pkg-config check takes care of everything.
82- # - If catkin is installed but it's python components are not in PYTHONPATH, this will fail, please remove this line
83- find_package (catkin QUIET COMPONENTS pinocchio)
84-
85- ADD_REQUIRED_DEPENDENCY("pinocchio >= 2.2.0" )
72+ # Project dependencies
73+ ADD_PROJECT_DEPENDENCY(pinocchio 2.3.1 REQUIRED PKG_CONFIG_REQUIRES "pinocchio >= 2.3.1" )
8674
87- SET (BOOST_REQUIERED_COMPONENTS filesystem system )
88- SET (BOOST_BUILD_COMPONENTS unit_test_framework)
89- SET (BOOST_OPTIONAL_COMPONENTS "" )
75+ SET (BOOST_COMPONENTS filesystem system unit_test_framework)
9076
9177IF (BUILD_PYTHON_INTERFACE)
92- SET (BOOST_OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS} python)
9378 FINDPYTHON()
94- INCLUDE_DIRECTORIES (SYSTEM ${PYTHON_INCLUDE_DIRS} )
95- ADD_REQUIRED_DEPENDENCY("eigenpy >= 1.4.0" )
79+ SET (PYWRAP ${PROJECT_NAME} _pywrap)
80+ ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES eigenpy)
81+ SET (BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
9682ENDIF (BUILD_PYTHON_INTERFACE)
9783
98- SET (BOOST_COMPONENTS ${BOOST_REQUIERED_COMPONENTS} ${BOOST_OPTIONAL_COMPONENTS} ${BOOST_BUILD_COMPONENTS} )
9984SEARCH_FOR_BOOST()
10085
101- # Path to boost headers
102- INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIRS} )
103- # ----------------------------------------------------
104- # --- INCLUDE ----------------------------------------
105- # ----------------------------------------------------
106-
86+ # Main Library
10787SET (${PROJECT_NAME} _MATH_HEADERS
108- include /tsid/math/fwd.hpp
109- include /tsid/math/utils.hpp
110- include /tsid/math/constraint-base.hpp
111- include /tsid/math/constraint-equality.hpp
112- include /tsid/math/constraint-inequality.hpp
113- include /tsid/math/constraint-bound.hpp
88+ include /tsid/math/fwd.hpp
89+ include /tsid/math/utils.hpp
90+ include /tsid/math/constraint-base.hpp
91+ include /tsid/math/constraint-equality.hpp
92+ include /tsid/math/constraint-inequality.hpp
93+ include /tsid/math/constraint-bound.hpp
11494 )
11595
11696SET (${PROJECT_NAME} _TASKS_HEADERS
117- include /tsid/tasks/fwd.hpp
118- include /tsid/tasks/task-base.hpp
119- include /tsid/tasks/task-motion.hpp
120- include /tsid/tasks/task-actuation.hpp
121- include /tsid/tasks/task-contact-force.hpp
122- include /tsid/tasks/task-com-equality.hpp
123- include /tsid/tasks/task-se3-equality.hpp
124- include /tsid/tasks/task-contact-force-equality.hpp
125- include /tsid/tasks/task-actuation-equality.hpp
126- include /tsid/tasks/task-actuation-bounds.hpp
127- include /tsid/tasks/task-joint-bounds.hpp
128- include /tsid/tasks/task-joint-posture.hpp
129- include /tsid/tasks/task-angular-momentum-equality.hpp
97+ include /tsid/tasks/fwd.hpp
98+ include /tsid/tasks/task-base.hpp
99+ include /tsid/tasks/task-motion.hpp
100+ include /tsid/tasks/task-actuation.hpp
101+ include /tsid/tasks/task-contact-force.hpp
102+ include /tsid/tasks/task-com-equality.hpp
103+ include /tsid/tasks/task-se3-equality.hpp
104+ include /tsid/tasks/task-contact-force-equality.hpp
105+ include /tsid/tasks/task-actuation-equality.hpp
106+ include /tsid/tasks/task-actuation-bounds.hpp
107+ include /tsid/tasks/task-joint-bounds.hpp
108+ include /tsid/tasks/task-joint-posture.hpp
109+ include /tsid/tasks/task-angular-momentum-equality.hpp
130110 )
131111
132112SET (${PROJECT_NAME} _CONTACTS_HEADERS
133- include /tsid/contacts/fwd.hpp
134- include /tsid/contacts/contact-base.hpp
135- include /tsid/contacts/contact-6d.hpp
136- include /tsid/contacts/contact-point.hpp
113+ include /tsid/contacts/fwd.hpp
114+ include /tsid/contacts/contact-base.hpp
115+ include /tsid/contacts/contact-6d.hpp
116+ include /tsid/contacts/contact-point.hpp
137117 )
138118
139119SET (${PROJECT_NAME} _TRAJECTORIES_HEADERS
140- include /tsid/trajectories/fwd.hpp
141- include /tsid/trajectories/trajectory-base.hpp
142- include /tsid/trajectories/trajectory-se3.hpp
143- include /tsid/trajectories/trajectory-euclidian.hpp
120+ include /tsid/trajectories/fwd.hpp
121+ include /tsid/trajectories/trajectory-base.hpp
122+ include /tsid/trajectories/trajectory-se3.hpp
123+ include /tsid/trajectories/trajectory-euclidian.hpp
144124 )
145125
146126SET (${PROJECT_NAME} _SOLVERS_HEADERS
147- include /tsid/solvers/eiquadprog_2011.hpp
148- include /tsid/solvers/eiquadprog-rt.hpp
149- include /tsid/solvers/eiquadprog-rt.hxx
150- include /tsid/solvers/eiquadprog-fast.hpp
151- include /tsid/solvers/fwd.hpp
152- include /tsid/solvers/utils.hpp
153- include /tsid/solvers/solver-HQP-output .hpp
154- include /tsid/solvers/solver-HQP-base.hpp
155- include /tsid/solvers/solver-HQP-factory.hpp
156- include /tsid/solvers/solver-HQP-factory.hxx
157- include /tsid/solvers/solver-HQP-qpoases.hpp
158- include /tsid/solvers/solver-HQP-eiquadprog.hpp
159- include /tsid/solvers/solver-HQP-eiquadprog-rt.hpp
160- include /tsid/solvers/solver-HQP-eiquadprog-rt.hxx
161- include /tsid/solvers/solver-HQP-eiquadprog-fast.hpp
127+ include /tsid/solvers/eiquadprog_2011.hpp
128+ include /tsid/solvers/eiquadprog-rt.hpp
129+ include /tsid/solvers/eiquadprog-rt.hxx
130+ include /tsid/solvers/eiquadprog-fast.hpp
131+ include /tsid/solvers/fwd.hpp
132+ include /tsid/solvers/utils.hpp
133+ include /tsid/solvers/solver-HQP-output .hpp
134+ include /tsid/solvers/solver-HQP-base.hpp
135+ include /tsid/solvers/solver-HQP-factory.hpp
136+ include /tsid/solvers/solver-HQP-factory.hxx
137+ include /tsid/solvers/solver-HQP-qpoases.hpp
138+ include /tsid/solvers/solver-HQP-eiquadprog.hpp
139+ include /tsid/solvers/solver-HQP-eiquadprog-rt.hpp
140+ include /tsid/solvers/solver-HQP-eiquadprog-rt.hxx
141+ include /tsid/solvers/solver-HQP-eiquadprog-fast.hpp
162142 )
163143
164144SET (${PROJECT_NAME} _ROBOTS_HEADERS
165- include /tsid/robots/fwd.hpp
166- include /tsid/robots/robot-wrapper.hpp
145+ include /tsid/robots/fwd.hpp
146+ include /tsid/robots/robot-wrapper.hpp
167147 )
168148
169149SET (${PROJECT_NAME} _FORMULATIONS_HEADERS
170- include /tsid/formulations/inverse-dynamics-formulation-base.hpp
171- include /tsid/formulations/inverse-dynamics-formulation-acc-force.hpp
172- )
173-
174- SET (HEADERS
175- include /tsid/config.hpp
176- include /tsid/deprecation.hpp
177- include /tsid/utils/statistics.hpp
178- include /tsid/utils/stop-watch.hpp
179- include /tsid/utils/Stdafx.hh
180- ${${PROJECT_NAME} _MATH_HEADERS}
181- ${${PROJECT_NAME} _TASKS_HEADERS}
182- ${${PROJECT_NAME} _CONTACTS_HEADERS}
183- ${${PROJECT_NAME} _TRAJECTORIES_HEADERS}
184- ${${PROJECT_NAME} _SOLVERS_HEADERS}
185- ${${PROJECT_NAME} _ROBOTS_HEADERS}
186- ${${PROJECT_NAME} _FORMULATIONS_HEADERS}
187- )
188-
189- LIST (REMOVE_DUPLICATES HEADERS)
190-
191- SET (HEADERS_FULL_PATH "" )
192- FOREACH (header ${HEADERS} )
193- LIST (APPEND HEADERS_FULL_PATH "${CMAKE_SOURCE_DIR} /${header} " )
194- GET_FILENAME_COMPONENT (headerName ${header} NAME )
195- GET_FILENAME_COMPONENT (headerPath ${header} PATH )
196- INSTALL (FILES ${${PROJECT_NAME} _SOURCE_DIR}/${header}
197- DESTINATION ${CMAKE_INSTALL_PREFIX} /${headerPath}
198- PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
199- ENDFOREACH (header ${HEADERS} )
200-
201- # --- MAIN LIBRARY -------------------------------------------------------------
202- ADD_SUBDIRECTORY (src)
203-
204- # --- BINDINGS ----------------------------------------------------------------
205- IF (BUILD_PYTHON_INTERFACE)
206- SET (PYWRAP ${PROJECT_NAME} _pywrap)
207- ADD_SUBDIRECTORY (bindings)
208- ENDIF (BUILD_PYTHON_INTERFACE)
209- # --- UNIT TESTS ---------------------------------------------------------------
150+ include /tsid/formulations/inverse-dynamics-formulation-base.hpp
151+ include /tsid/formulations/inverse-dynamics-formulation-acc-force.hpp
152+ )
153+
154+ FILE (GLOB ${PYWRAP} _HEADERS
155+ include /tsid/bindings/python/constraint/*.hpp
156+ include /tsid/bindings/python/contacts/*.hpp
157+ include /tsid/bindings/python/formulations/*.hpp
158+ include /tsid/bindings/python/robots/*.hpp
159+ include /tsid/bindings/python/solvers/*.hpp
160+ include /tsid/bindings/python/tasks/*.hpp
161+ include /tsid/bindings/python/trajectories/*.hpp
162+ include /tsid/bindings/python/utils/*.hpp
163+ )
164+
165+ SET (${PROJECT_NAME} _HEADERS
166+ include /tsid/config.hpp
167+ include /tsid/deprecation.hpp
168+ include /tsid/utils/statistics.hpp
169+ include /tsid/utils/stop-watch.hpp
170+ include /tsid/utils/Stdafx.hh
171+ ${${PROJECT_NAME} _MATH_HEADERS}
172+ ${${PROJECT_NAME} _TASKS_HEADERS}
173+ ${${PROJECT_NAME} _CONTACTS_HEADERS}
174+ ${${PROJECT_NAME} _TRAJECTORIES_HEADERS}
175+ ${${PROJECT_NAME} _SOLVERS_HEADERS}
176+ ${${PROJECT_NAME} _ROBOTS_HEADERS}
177+ ${${PROJECT_NAME} _FORMULATIONS_HEADERS}
178+ )
179+
180+ LIST (REMOVE_DUPLICATES ${PROJECT_NAME} _HEADERS)
181+
182+ SET (${PROJECT_NAME} _MATH_SOURCES
183+ src/math/constraint-base.cpp
184+ src/math/constraint-equality.cpp
185+ src/math/constraint-inequality.cpp
186+ src/math/constraint-bound.cpp
187+ src/math/utils.cpp
188+ )
189+
190+ SET (${PROJECT_NAME} _TASKS_SOURCES
191+ src/tasks/task-base.cpp
192+ src/tasks/task-actuation-bounds.cpp
193+ src/tasks/task-actuation-equality.cpp
194+ src/tasks/task-actuation.cpp
195+ src/tasks/task-com-equality.cpp
196+ src/tasks/task-contact-force-equality.cpp
197+ src/tasks/task-contact-force.cpp
198+ src/tasks/task-joint-bounds.cpp
199+ src/tasks/task-joint-posture.cpp
200+ src/tasks/task-motion.cpp
201+ src/tasks/task-se3-equality.cpp
202+ src/tasks/task-angular-momentum-equality.cpp
203+ )
204+
205+ SET (${PROJECT_NAME} _CONTACTS_SOURCES
206+ src/contacts/contact-base.cpp
207+ src/contacts/contact-6d.cpp
208+ src/contacts/contact-point.cpp
209+ )
210+
211+ SET (${PROJECT_NAME} _TRAJECTORIES_SOURCES
212+ src/trajectories/trajectory-se3.cpp
213+ src/trajectories/trajectory-euclidian.cpp
214+ )
215+
216+ SET (${PROJECT_NAME} _SOLVERS_SOURCES
217+ src/solvers/eiquadprog-fast.cpp
218+ src/solvers/solver-HQP-base.cpp
219+ src/solvers/solver-HQP-factory.cpp
220+ src/solvers/solver-HQP-eiquadprog.cpp
221+ src/solvers/solver-HQP-eiquadprog-fast.cpp
222+ src/solvers/solver-HQP-qpoases.cpp
223+ src/solvers/utils.cpp
224+ )
225+
226+ SET (${PROJECT_NAME} _ROBOTS_SOURCES
227+ src/robots/robot-wrapper.cpp
228+ )
229+
230+ SET (${PROJECT_NAME} _FORMULATIONS_SOURCES
231+ src/formulations/inverse-dynamics-formulation-base.cpp
232+ src/formulations/inverse-dynamics-formulation-acc-force.cpp
233+ )
234+
235+ SET (${PROJECT_NAME} _SOURCES
236+ src/utils/statistics.cpp
237+ src/utils/stop-watch.cpp
238+ ${${PROJECT_NAME} _MATH_SOURCES}
239+ ${${PROJECT_NAME} _TASKS_SOURCES}
240+ ${${PROJECT_NAME} _CONTACTS_SOURCES}
241+ ${${PROJECT_NAME} _TRAJECTORIES_SOURCES}
242+ ${${PROJECT_NAME} _SOLVERS_SOURCES}
243+ ${${PROJECT_NAME} _ROBOTS_SOURCES}
244+ ${${PROJECT_NAME} _FORMULATIONS_SOURCES}
245+ )
246+
247+ ADD_HEADER_GROUP(${PROJECT_NAME} _HEADERS)
248+ ADD_SOURCE_GROUP(${PROJECT_NAME} _SOURCES)
249+
250+ ADD_LIBRARY (${PROJECT_NAME} SHARED
251+ ${${PROJECT_NAME} _SOURCES} ${${PROJECT_NAME} _HEADERS})
252+ TARGET_INCLUDE_DIRECTORIES (${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include >)
253+ TARGET_LINK_LIBRARIES (${PROJECT_NAME} ${Boost_LIBRARIES}
254+ pinocchio::pinocchio)
255+
256+
257+ IF (SUFFIX_SO_VERSION)
258+ SET_TARGET_PROPERTIES (${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION} )
259+ ENDIF (SUFFIX_SO_VERSION)
260+
261+ IF (NOT INSTALL_PYTHON_INTERFACE_ONLY)
262+ INSTALL (TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
263+ ENDIF (NOT INSTALL_PYTHON_INTERFACE_ONLY)
264+
265+ ADD_SUBDIRECTORY (bindings)
210266ADD_SUBDIRECTORY (unittest)
211267
212268# --- PACKAGING ----------------------------------------------------------------
0 commit comments