CMakeLists.txt 7.4 KB
Newer Older
jcarpent's avatar
jcarpent committed
1
#
2
# Copyright (c) 2017-2018 CNRS
jcarpent's avatar
jcarpent committed
3
#
jcarpent's avatar
jcarpent committed
4
# This file is part of tsid
ggory15's avatar
ggory15 committed
5
# tsid is free software: you can redistribute it
jcarpent's avatar
jcarpent committed
6
7
8
# 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.
ggory15's avatar
ggory15 committed
9
# tsid is distributed in the hope that it will be
jcarpent's avatar
jcarpent committed
10
11
12
13
# 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
ggory15's avatar
ggory15 committed
14
# tsid If not, see
jcarpent's avatar
jcarpent committed
15
16
17
18
19
20
21
22
# <http://www.gnu.org/licenses/>.

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/python.cmake)
23
INCLUDE(cmake/ide.cmake)
24
INCLUDE(cmake/apple.cmake)
jcarpent's avatar
jcarpent committed
25

jcarpent's avatar
jcarpent committed
26
SET(PROJECT_NAME tsid)
jcarpent's avatar
jcarpent committed
27
28
SET(PROJECT_DESCRIPTION "Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio")
SET(PROJECT_URL "http://github.com/stack-of-tasks/tsid")
29
OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" OFF)
jcarpent's avatar
jcarpent committed
30
31
32

SET(DOXYGEN_USE_MATHJAX YES)

33
# Handle APPLE Cmake policy
jcarpent's avatar
jcarpent committed
34
IF(APPLE)
35
  APPLY_DEFAULT_APPLE_CONFIGURATION()
jcarpent's avatar
jcarpent committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
ENDIF(APPLE)

# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
SET(CMAKE_VERBOSE_MAKEFILE True)

SETUP_PROJECT()

IF(WIN32)
  SET(LINK copy_if_different)
ELSE(WIN32)
  SET(LINK create_symlink)
ENDIF(WIN32)

# --- OPTIONS ----------------------------------------
ggory15's avatar
ggory15 committed
51
OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
jcarpent's avatar
jcarpent committed
52
OPTION (BUILD_UNIT_TESTS "Build the unitary tests" ON)
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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)

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)
jcarpent's avatar
jcarpent committed
71
72

# ----------------------------------------------------
Wolfgang Merkt's avatar
Typo    
Wolfgang Merkt committed
73
# --- DEPENDENCIES -----------------------------------
jcarpent's avatar
jcarpent committed
74
# ----------------------------------------------------
75
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.2.0") # Eigen::Ref appeared from 3.2.0
76
77
78
79

# Fail-safe support for catkin-ized pinocchio:
#  - If catkin-based pinocchio is installed it runs the CFG_EXTRAS to set up the Pinocchio preprocessor directives
#  - If it isn't, nothing happens and the subsequent pkg-config check takes care of everything.
80
#find_package(catkin QUIET COMPONENTS pinocchio)
81

82
ADD_REQUIRED_DEPENDENCY("pinocchio >= 2.0.0")
jcarpent's avatar
jcarpent committed
83

ggory15's avatar
ggory15 committed
84
85
86
SET(BOOST_REQUIERED_COMPONENTS filesystem system)
SET(BOOST_BUILD_COMPONENTS unit_test_framework)
SET(BOOST_OPTIONAL_COMPONENTS "")
jcarpent's avatar
jcarpent committed
87
88

IF(BUILD_PYTHON_INTERFACE)
ggory15's avatar
ggory15 committed
89
90
  SET(BOOST_OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS} python)
  FINDPYTHON()
91
  INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
92
  ADD_REQUIRED_DEPENDENCY("eigenpy >= 1.4.0")
jcarpent's avatar
jcarpent committed
93
94
ENDIF(BUILD_PYTHON_INTERFACE)

ggory15's avatar
ggory15 committed
95
SET(BOOST_COMPONENTS ${BOOST_REQUIERED_COMPONENTS} ${BOOST_OPTIONAL_COMPONENTS} ${BOOST_BUILD_COMPONENTS})
jcarpent's avatar
jcarpent committed
96
SEARCH_FOR_BOOST()
ggory15's avatar
ggory15 committed
97

jcarpent's avatar
jcarpent committed
98
99
100
101
102
103
104
# Path to boost headers
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------

SET(${PROJECT_NAME}_MATH_HEADERS
jcarpent's avatar
jcarpent committed
105
106
107
108
109
110
    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
jcarpent's avatar
jcarpent committed
111
112
113
  )

SET(${PROJECT_NAME}_TASKS_HEADERS
jcarpent's avatar
jcarpent committed
114
115
116
117
118
119
120
121
122
123
124
125
    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-actuation-equality.hpp
    include/tsid/tasks/task-actuation-bounds.hpp
    include/tsid/tasks/task-joint-bounds.hpp
    include/tsid/tasks/task-joint-posture.hpp
126
127
128
  )

SET(${PROJECT_NAME}_CONTACTS_HEADERS
jcarpent's avatar
jcarpent committed
129
130
131
    include/tsid/contacts/fwd.hpp
    include/tsid/contacts/contact-base.hpp
    include/tsid/contacts/contact-6d.hpp
132
    include/tsid/contacts/contact-point.hpp
133
134
135
  )

SET(${PROJECT_NAME}_TRAJECTORIES_HEADERS
jcarpent's avatar
jcarpent committed
136
137
138
139
    include/tsid/trajectories/fwd.hpp
    include/tsid/trajectories/trajectory-base.hpp
    include/tsid/trajectories/trajectory-se3.hpp
    include/tsid/trajectories/trajectory-euclidian.hpp
jcarpent's avatar
jcarpent committed
140
141
142
  )

SET(${PROJECT_NAME}_SOLVERS_HEADERS
jcarpent's avatar
jcarpent committed
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
    include/tsid/solvers/eiquadprog_2011.hpp
    include/tsid/solvers/eiquadprog-rt.hpp
    include/tsid/solvers/eiquadprog-rt.hxx
    include/tsid/solvers/eiquadprog-fast.hpp
    include/tsid/solvers/fwd.hpp
    include/tsid/solvers/utils.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
jcarpent's avatar
jcarpent committed
158
159
  )

160
SET(${PROJECT_NAME}_ROBOTS_HEADERS
jcarpent's avatar
jcarpent committed
161
162
    include/tsid/robots/fwd.hpp
    include/tsid/robots/robot-wrapper.hpp
163
164
165
  )

SET(${PROJECT_NAME}_FORMULATIONS_HEADERS
jcarpent's avatar
jcarpent committed
166
167
    include/tsid/formulations/inverse-dynamics-formulation-base.hpp
    include/tsid/formulations/inverse-dynamics-formulation-acc-force.hpp
168
169
  )

jcarpent's avatar
jcarpent committed
170
SET(HEADERS
jcarpent's avatar
jcarpent committed
171
    include/tsid/config.hpp
Andrea Del Prete's avatar
Andrea Del Prete committed
172
    include/tsid/deprecation.hpp
jcarpent's avatar
jcarpent committed
173
174
175
    include/tsid/utils/statistics.hpp
    include/tsid/utils/stop-watch.hpp
    include/tsid/utils/Stdafx.hh
jcarpent's avatar
jcarpent committed
176
177
    ${${PROJECT_NAME}_MATH_HEADERS}
    ${${PROJECT_NAME}_TASKS_HEADERS}
178
    ${${PROJECT_NAME}_CONTACTS_HEADERS}
179
    ${${PROJECT_NAME}_TRAJECTORIES_HEADERS}
jcarpent's avatar
jcarpent committed
180
    ${${PROJECT_NAME}_SOLVERS_HEADERS}
181
182
    ${${PROJECT_NAME}_ROBOTS_HEADERS}
    ${${PROJECT_NAME}_FORMULATIONS_HEADERS}
jcarpent's avatar
jcarpent committed
183
184
185
186
187
188
 )

LIST(REMOVE_DUPLICATES HEADERS)

SET(HEADERS_FULL_PATH "")
FOREACH(header ${HEADERS})
189
  LIST(APPEND HEADERS_FULL_PATH "${CMAKE_SOURCE_DIR}/${header}")
jcarpent's avatar
jcarpent committed
190
191
192
193
194
195
196
197
198
199
200
  GET_FILENAME_COMPONENT(headerName ${header} NAME)
  GET_FILENAME_COMPONENT(headerPath ${header} PATH)
  INSTALL(FILES ${${PROJECT_NAME}_SOURCE_DIR}/${header}
    DESTINATION ${CMAKE_INSTALL_PREFIX}/${headerPath}
          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
ENDFOREACH(header ${HEADERS})

# --- MAIN LIBRARY -------------------------------------------------------------
ADD_SUBDIRECTORY(src)

# --- BINDINGS ----------------------------------------------------------------
201
202
203
204
IF(BUILD_PYTHON_INTERFACE)
  SET(PYWRAP ${PROJECT_NAME}_pywrap)
  ADD_SUBDIRECTORY(bindings)
ENDIF(BUILD_PYTHON_INTERFACE)
jcarpent's avatar
jcarpent committed
205
# --- UNIT TESTS ---------------------------------------------------------------
206
ADD_SUBDIRECTORY(unittest)
jcarpent's avatar
jcarpent committed
207
208
209
210
211

# --- PACKAGING ----------------------------------------------------------------
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})

SETUP_PROJECT_FINALIZE()