CMakeLists.txt 7.98 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
32
33
IF(APPLE)
  SET(CMAKE_MACOSX_RPATH 1)
ENDIF(APPLE)

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

SETUP_PROJECT()

40
41
42
43
44
45
IF(WIN32)
  SET(LINK copy_if_different)
ELSE(WIN32)
  SET(LINK create_symlink)
ENDIF(WIN32)

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

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

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

70
SET(BOOST_COMPONENTS filesystem unit_test_framework)
71
72
73
74
SEARCH_FOR_BOOST()
# Path to boost headers
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
75
76
77
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
78
79
80


SET(${PROJECT_NAME}_MATH_HEADERS
81
  math/sincos.hpp
82
83
84
  )

SET(${PROJECT_NAME}_TOOLS_HEADERS
85
  tools/timer.hpp
86
  tools/string-generator.hpp
87
88
89
  )

SET(${PROJECT_NAME}_SPATIAL_HEADERS
90
  spatial/symmetric3.hpp
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
91
92
93
94
95
96
  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
97
  spatial/act-on-set.hpp
98
  spatial/explog.hpp
99
  spatial/frame.hpp
100
101
  )

102
SET(${PROJECT_NAME}_MULTIBODY_JOINT_HEADERS
103
  multibody/joint/joint-base.hpp
104
  multibody/joint/joint-dense.hpp
105
  multibody/joint/joint-revolute.hpp
106
  multibody/joint/joint-revolute-unaligned.hpp
107
  multibody/joint/joint-spherical.hpp
108
  multibody/joint/joint-spherical-ZYX.hpp
109
  multibody/joint/joint-prismatic.hpp
jcarpent's avatar
jcarpent committed
110
  multibody/joint/joint-prismatic-unaligned.hpp
111
  multibody/joint/joint-planar.hpp
112
  multibody/joint/joint-translation.hpp
113
114
  multibody/joint/joint-free-flyer.hpp
  multibody/joint/joint-variant.hpp
115
  multibody/joint/joint-generic.hpp
116
117
118
119
  ) 

SET(${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
  multibody/parser/sample-models.hpp
120
  multibody/parser/utils.hpp
121
  )
122
123
124
125
126

SET(${PROJECT_NAME}_MULTIBODY_HEADERS
  multibody/constraint.hpp
  multibody/force-set.hpp
  multibody/joint.hpp
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
127
  multibody/model.hpp
128
  multibody/model.hxx
129
  multibody/visitor.hpp
130
131
132
  )

SET(${PROJECT_NAME}_ALGORITHM_HEADERS
133
  algorithm/rnea.hpp
134
  algorithm/crba.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
135
  algorithm/jacobian.hpp
136
  algorithm/jacobian.hxx
Nicolas Mansard's avatar
Nicolas Mansard committed
137
  algorithm/cholesky.hpp
138
  algorithm/cholesky.hxx
139
  algorithm/kinematics.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
140
  algorithm/center-of-mass.hpp
141
  algorithm/center-of-mass.hxx
142
  algorithm/non-linear-effects.hpp
143
  algorithm/joint-limits.hpp
144
  algorithm/energy.hpp
145
  algorithm/operational-frames.hpp
146
147
  )

148
149
150
SET(${PROJECT_NAME}_SIMULATION_HEADERS
  simulation/compute-all-terms.hpp
  )
151
152

SET(${PROJECT_NAME}_PYTHON_HEADERS
153
154
  python/eigen_container.hpp
  python/handler.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
155
156
157
158
159
  python/python.hpp
  python/se3.hpp
  python/force.hpp
  python/motion.hpp
  python/inertia.hpp
160
161
162
  python/joint-dense.hpp
  python/joints-models.hpp
  python/joints-variant.hpp
163
  python/frame.hpp
164
165
  python/model.hpp
  python/data.hpp
166
  python/algorithms.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
167
  python/parsers.hpp
168
  python/explog.hpp
169
170
  )

171
172
173
174
175
176
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
177

178
IF(URDFDOM_FOUND)
179
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
180
    multibody/parser/urdf.hpp
181
    multibody/parser/urdf.hxx
182
    )
183
184
  
  IF(HPP_FCL_FOUND )
185
186
187
    LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
      multibody/parser/from-collada-to-fcl.hpp
      multibody/parser/urdf-with-geometry.hpp
188
      multibody/parser/urdf-with-geometry.hxx
189
      )
190
191
  ENDIF(HPP_FCL_FOUND)

192
  ADD_DEFINITIONS(-DWITH_URDFDOM)
193
194
ENDIF(URDFDOM_FOUND)

195
IF(HPP_FCL_FOUND)
196
  LIST(APPEND ${PROJECT_NAME}_SPATIAL_HEADERS
197
198
    spatial/fcl-pinocchio-conversions.hpp
    )
199
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_HEADERS
200
    multibody/geometry.hpp
201
    multibody/geometry.hxx
202
    )
203
204
205
  LIST(APPEND ${PROJECT_NAME}_ALGORITHM_HEADERS
    algorithm/collisions.hpp
    )
206
207
ENDIF(HPP_FCL_FOUND)

jcarpent's avatar
jcarpent committed
208
IF(LUA5_1_FOUND)
209
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
jcarpent's avatar
jcarpent committed
210
211
212
213
    multibody/parser/lua.hpp
    multibody/parser/lua/lua_tables.hpp
    )

214
  ADD_DEFINITIONS(-DWITH_LUA)
jcarpent's avatar
jcarpent committed
215
216
ENDIF(LUA5_1_FOUND)

217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

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}_SIMULATION_HEADERS}
  ${${PROJECT_NAME}_PYTHON_HEADERS}
  exception.hpp
  assert.hpp
 )
LIST(REMOVE_DUPLICATES HEADERS)

233
234
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
235
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio")
236
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/math")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
237
238
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/spatial")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody")
239
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/joint")
240
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser")
jcarpent's avatar
jcarpent committed
241
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser/lua")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
242
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/tools")
243
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/algorithm")
244
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/simulation")
Nicolas Mansard's avatar
Nicolas Mansard committed
245
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/python")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
246

247

248
FOREACH(header ${HEADERS})
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
249
  GET_FILENAME_COMPONENT(headerName ${header} NAME)
250
251
252
253
254
  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}
255
    DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/${headerPath}
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
256
257
258
          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
ENDFOREACH(header)

259
ADD_SUBDIRECTORY(src)
260
261
262
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
263
ADD_SUBDIRECTORY(unittest)
jcarpent's avatar
jcarpent committed
264
265
ADD_SUBDIRECTORY (benchmark)

266
267
268
IF (BUILD_UTILS)
  ADD_SUBDIRECTORY (utils)
ENDIF (BUILD_UTILS)
Nicolas Mansard's avatar
Nicolas Mansard committed
269

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