CMakeLists.txt 8.14 KB
Newer Older
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
1
#
2
# Copyright (c) 2015-2016 CNRS
3
# Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
4
#
5
# This file is part of Pinocchio
Florent Lamiraux's avatar
Florent Lamiraux committed
6
# pinocchio is free software: you can redistribute it
7
8
9
# 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.
Florent Lamiraux's avatar
Florent Lamiraux committed
10
# pinocchio is distributed in the hope that it will be
11
12
13
14
# 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
Florent Lamiraux's avatar
Florent Lamiraux committed
15
# pinocchio If not, see
16
# <http://www.gnu.org/licenses/>.
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
17
18
19
20
21
22
23
24
25
26
27
28
29

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/cpack.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/python.cmake)

SET(PROJECT_NAME pinocchio)
SET(PROJECT_DESCRIPTION "Rigid multi body dynamics algorithms")
SET(PROJECT_URL "http://github.com/stac-of-tasks/pinocchio")

30
31
SET(DOXYGEN_USE_MATHJAX YES)

32
33
34
35
IF(APPLE)
  SET(CMAKE_MACOSX_RPATH 1)
ENDIF(APPLE)

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
36
37
38
39
40
41
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
SET(CMAKE_VERBOSE_MAKEFILE True)

SETUP_PROJECT()

42
43
44
45
46
47
IF(WIN32)
  SET(LINK copy_if_different)
ELSE(WIN32)
  SET(LINK create_symlink)
ENDIF(WIN32)

48
49
# --- OPTIONS ----------------------------------------
OPTION (BUILD_BENCHMARK "Build the benchmarks" OFF)
50
OPTION (BUILD_UNIT_TESTS "Build the unitary tests" ON)
51
OPTION (BUILD_UTILS "Build the utils" OFF)
52
OPTION (INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
53
OPTION (BUILD_TESTS_WITH_HPP "Build geom tests and benchmarks with hpp to do comparisons" OFF)
54
55
56
57
58

IF (INITIALIZE_WITH_NAN)
  MESSAGE (STATUS "Initialize with NaN all the Eigen entries")
  ADD_DEFINITIONS(-DEIGEN_INITIALIZE_MATRICES_BY_NAN)
ENDIF (INITIALIZE_WITH_NAN)
59

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
60
61
62
# ----------------------------------------------------
# --- DEPENDANCIES -----------------------------------
# ----------------------------------------------------
63
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
64
ADD_OPTIONAL_DEPENDENCY("eigenpy >= 1.3.0")
65
66
ADD_OPTIONAL_DEPENDENCY("metapod >= 1.0.7")
ADD_OPTIONAL_DEPENDENCY("urdfdom >= 0.2.10")
jcarpent's avatar
jcarpent committed
67
ADD_OPTIONAL_DEPENDENCY("lua5.1")
68
ADD_OPTIONAL_DEPENDENCY("hpp-fcl")
69
IF(HPP_FCL_FOUND AND URDFDOM_FOUND)
70
  ADD_REQUIRED_DEPENDENCY("assimp >= 3.0")
71
ENDIF(HPP_FCL_FOUND AND URDFDOM_FOUND)
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
72

73
SET(BOOST_COMPONENTS filesystem unit_test_framework system)
74
75
76
77
SEARCH_FOR_BOOST()
# Path to boost headers
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
78
79
80
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
81
82
83


SET(${PROJECT_NAME}_MATH_HEADERS
84
  math/fwd.hpp
85
  math/sincos.hpp
86
  math/quaternion.hpp
87
88
89
  )

SET(${PROJECT_NAME}_TOOLS_HEADERS
90
  tools/timer.hpp
91
  tools/string-generator.hpp
92
  tools/file-explorer.hpp
93
94
95
  )

SET(${PROJECT_NAME}_SPATIAL_HEADERS
96
  spatial/symmetric3.hpp
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
97
98
99
100
101
102
  spatial/se3.hpp
  spatial/motion.hpp
  spatial/force.hpp
  spatial/inertia.hpp
  spatial/fwd.hpp
  spatial/skew.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
103
  spatial/act-on-set.hpp
104
  spatial/explog.hpp
105
  spatial/frame.hpp
106
107
  )

108
SET(${PROJECT_NAME}_MULTIBODY_JOINT_HEADERS
109
  multibody/joint/joint-base.hpp
110
  multibody/joint/joint-dense.hpp
111
  multibody/joint/joint-revolute.hpp
112
  multibody/joint/joint-revolute-unaligned.hpp
113
  multibody/joint/joint-spherical.hpp
114
  multibody/joint/joint-spherical-ZYX.hpp
115
  multibody/joint/joint-prismatic.hpp
jcarpent's avatar
jcarpent committed
116
  multibody/joint/joint-prismatic-unaligned.hpp
117
  multibody/joint/joint-planar.hpp
118
  multibody/joint/joint-translation.hpp
119
120
  multibody/joint/joint-free-flyer.hpp
  multibody/joint/joint-variant.hpp
121
  multibody/joint/joint-generic.hpp
122
123
124
125
  ) 

SET(${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
  multibody/parser/sample-models.hpp
126
  multibody/parser/utils.hpp
127
  )
128
129

SET(${PROJECT_NAME}_MULTIBODY_HEADERS
130
  multibody/fwd.hpp
131
132
133
  multibody/constraint.hpp
  multibody/force-set.hpp
  multibody/joint.hpp
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
134
  multibody/model.hpp
135
  multibody/model.hxx
136
  multibody/visitor.hpp
137
  multibody/parser/srdf.hpp
138
139
140
  )

SET(${PROJECT_NAME}_ALGORITHM_HEADERS
jcarpent's avatar
jcarpent committed
141
  algorithm/aba.hpp
142
  algorithm/aba.hxx
143
  algorithm/rnea.hpp
144
  algorithm/crba.hpp
145
  algorithm/crba.hxx
Nicolas Mansard's avatar
Nicolas Mansard committed
146
  algorithm/jacobian.hpp
147
  algorithm/jacobian.hxx
Nicolas Mansard's avatar
Nicolas Mansard committed
148
  algorithm/cholesky.hpp
149
  algorithm/cholesky.hxx
150
  algorithm/kinematics.hpp
151
  algorithm/kinematics.hxx
152
  algorithm/dynamics.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
153
  algorithm/center-of-mass.hpp
154
  algorithm/center-of-mass.hxx
155
  algorithm/non-linear-effects.hpp
156
  algorithm/joint-configuration.hpp
157
  algorithm/energy.hpp
158
  algorithm/operational-frames.hpp
159
  algorithm/compute-all-terms.hpp
160
  )
161
162

SET(${PROJECT_NAME}_PYTHON_HEADERS
163
164
  python/eigen_container.hpp
  python/handler.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
165
166
167
168
169
  python/python.hpp
  python/se3.hpp
  python/force.hpp
  python/motion.hpp
  python/inertia.hpp
170
171
172
  python/joint-dense.hpp
  python/joints-models.hpp
  python/joints-variant.hpp
173
  python/frame.hpp
174
175
  python/model.hpp
  python/data.hpp
176
  python/algorithms.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
177
  python/parsers.hpp
178
  python/explog.hpp
179
180
  )

181
182
183
184
185
186
IF(HPP_FCL_FOUND)
  LIST(APPEND ${PROJECT_NAME}_PYTHON_HEADERS
      python/geometry-model.hpp
      python/geometry-data.hpp
    )
ENDIF(HPP_FCL_FOUND)
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
187

188
IF(URDFDOM_FOUND)
189
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
190
    multibody/parser/urdf.hpp
191
    multibody/parser/urdf.hxx
192
    )
193
194
  
  IF(HPP_FCL_FOUND )
195
196
197
    LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
      multibody/parser/from-collada-to-fcl.hpp
      multibody/parser/urdf-with-geometry.hpp
198
      multibody/parser/urdf-with-geometry.hxx
199
      )
200
201
  ENDIF(HPP_FCL_FOUND)

202
  ADD_DEFINITIONS(-DWITH_URDFDOM)
203
204
ENDIF(URDFDOM_FOUND)

205
IF(HPP_FCL_FOUND)
206
  LIST(APPEND ${PROJECT_NAME}_SPATIAL_HEADERS
207
208
    spatial/fcl-pinocchio-conversions.hpp
    )
209
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_HEADERS
210
    multibody/geometry.hpp
211
    multibody/geometry.hxx
212
    )
213
214
215
  LIST(APPEND ${PROJECT_NAME}_ALGORITHM_HEADERS
    algorithm/collisions.hpp
    )
216
217
ENDIF(HPP_FCL_FOUND)

jcarpent's avatar
jcarpent committed
218
IF(LUA5_1_FOUND)
219
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
jcarpent's avatar
jcarpent committed
220
221
222
223
    multibody/parser/lua.hpp
    multibody/parser/lua/lua_tables.hpp
    )

224
  ADD_DEFINITIONS(-DWITH_LUA)
jcarpent's avatar
jcarpent committed
225
226
ENDIF(LUA5_1_FOUND)

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241

SET(HEADERS
  ${${PROJECT_NAME}_MATH_HEADERS}
  ${${PROJECT_NAME}_TOOLS_HEADERS}
  ${${PROJECT_NAME}_SPATIAL_HEADERS}
  ${${PROJECT_NAME}_MULTIBODY_JOINT_HEADERS}
  ${${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS}
  ${${PROJECT_NAME}_MULTIBODY_HEADERS}
  ${${PROJECT_NAME}_ALGORITHM_HEADERS}
  ${${PROJECT_NAME}_PYTHON_HEADERS}
  exception.hpp
  assert.hpp
 )
LIST(REMOVE_DUPLICATES HEADERS)

242
243
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
244
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio")
245
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/math")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
246
247
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/spatial")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody")
248
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/joint")
249
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser")
jcarpent's avatar
jcarpent committed
250
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser/lua")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
251
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/tools")
252
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/algorithm")
Nicolas Mansard's avatar
Nicolas Mansard committed
253
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/python")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
254

255

256
FOREACH(header ${HEADERS})
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
257
  GET_FILENAME_COMPONENT(headerName ${header} NAME)
258
259
260
261
262
  GET_FILENAME_COMPONENT(headerPath ${header} PATH)
  EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E ${LINK}
    ${${PROJECT_NAME}_SOURCE_DIR}/src/${header}
    ${${PROJECT_NAME}_BINARY_DIR}/include/${PROJECT_NAME}/${header})
  INSTALL(FILES ${${PROJECT_NAME}_SOURCE_DIR}/src/${header}
263
    DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/${headerPath}
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
264
265
266
          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
ENDFOREACH(header)

267
ADD_SUBDIRECTORY(src)
268
269
270
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
271
ADD_SUBDIRECTORY(unittest)
jcarpent's avatar
jcarpent committed
272
273
ADD_SUBDIRECTORY (benchmark)

274
275
276
IF (BUILD_UTILS)
  ADD_SUBDIRECTORY (utils)
ENDIF (BUILD_UTILS)
Nicolas Mansard's avatar
Nicolas Mansard committed
277

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
278
SETUP_PROJECT_FINALIZE()