CMakeLists.txt 8.49 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
OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
55
56
57
58
59

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

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

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

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


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

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

SET(${PROJECT_NAME}_SPATIAL_HEADERS
97
  spatial/symmetric3.hpp
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
98
99
100
101
102
103
  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
104
  spatial/act-on-set.hpp
105
  spatial/explog.hpp
106
  spatial/frame.hpp
107
108
  )

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

SET(${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
  multibody/parser/sample-models.hpp
130
  multibody/parser/utils.hpp
131
  )
132
133

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

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

166
IF(${BUILD_PYTHON_INTERFACE} STREQUAL "ON")
167
SET(${PROJECT_NAME}_PYTHON_HEADERS
168
169
  python/eigen_container.hpp
  python/handler.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
170
171
172
173
174
  python/python.hpp
  python/se3.hpp
  python/force.hpp
  python/motion.hpp
  python/inertia.hpp
175
176
177
  python/joint-dense.hpp
  python/joints-models.hpp
  python/joints-variant.hpp
178
  python/frame.hpp
179
180
  python/model.hpp
  python/data.hpp
181
  python/algorithms.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
182
  python/parsers.hpp
183
  python/explog.hpp
184
  )
185
ENDIF(${BUILD_PYTHON_INTERFACE} STREQUAL "ON")
186

187
188
IF(HPP_FCL_FOUND)
  LIST(APPEND ${PROJECT_NAME}_PYTHON_HEADERS
189
      python/geometry-object.hpp
190
191
192
193
      python/geometry-model.hpp
      python/geometry-data.hpp
    )
ENDIF(HPP_FCL_FOUND)
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
194

195
IF(URDFDOM_FOUND)
196
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
197
    multibody/parser/urdf.hpp
198
    multibody/parser/urdf.hxx
199
    )
200
201
  
  IF(HPP_FCL_FOUND )
202
203
204
    LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
      multibody/parser/from-collada-to-fcl.hpp
      multibody/parser/urdf-with-geometry.hpp
205
      multibody/parser/urdf-with-geometry.hxx
206
      )
207
208
  ENDIF(HPP_FCL_FOUND)

209
  ADD_DEFINITIONS(-DWITH_URDFDOM)
210
211
ENDIF(URDFDOM_FOUND)

212
IF(HPP_FCL_FOUND)
213
  LIST(APPEND ${PROJECT_NAME}_SPATIAL_HEADERS
214
215
    spatial/fcl-pinocchio-conversions.hpp
    )
216
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_HEADERS
217
    multibody/geometry.hpp
218
    multibody/geometry.hxx
219
    )
220
221
222
  LIST(APPEND ${PROJECT_NAME}_ALGORITHM_HEADERS
    algorithm/collisions.hpp
    )
223
224
ENDIF(HPP_FCL_FOUND)

jcarpent's avatar
jcarpent committed
225
IF(LUA5_1_FOUND)
226
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
jcarpent's avatar
jcarpent committed
227
228
229
230
    multibody/parser/lua.hpp
    multibody/parser/lua/lua_tables.hpp
    )

231
  ADD_DEFINITIONS(-DWITH_LUA)
jcarpent's avatar
jcarpent committed
232
233
ENDIF(LUA5_1_FOUND)

234
235
236
237
238
239
240
241
242
243
244
245
246
247
248

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)

249
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})
250
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_COMPONENTS})
251

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
252
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio")
253
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/math")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
254
255
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/spatial")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody")
256
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/joint")
257
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser")
jcarpent's avatar
jcarpent committed
258
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser/lua")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
259
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/tools")
260
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/algorithm")
Nicolas Mansard's avatar
Nicolas Mansard committed
261
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/python")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
262

263

264
FOREACH(header ${HEADERS})
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
265
  GET_FILENAME_COMPONENT(headerName ${header} NAME)
266
267
268
269
270
  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}
271
    DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/${headerPath}
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
272
273
274
          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
ENDFOREACH(header)

275
ADD_SUBDIRECTORY(src)
276
277
278
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
279
ADD_SUBDIRECTORY(unittest)
jcarpent's avatar
jcarpent committed
280
281
ADD_SUBDIRECTORY (benchmark)

282
283
284
IF (BUILD_UTILS)
  ADD_SUBDIRECTORY (utils)
ENDIF (BUILD_UTILS)
Nicolas Mansard's avatar
Nicolas Mansard committed
285

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