CMakeLists.txt 7.91 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
6
7
8
9
10
11
12
13
14
15
16
# This file is part of Pinocchio
# hpp-core is free software: you can redistribute it
# 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.
# hpp-core is distributed in the hope that it will be
# 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
# hpp-core If not, see
# <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
61
62
63
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
ADD_OPTIONAL_DEPENDENCY("eigenpy >= 1.2.0")
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 system)
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/matrix-comparison.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
100
  )

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

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

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

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

144
145
146
SET(${PROJECT_NAME}_SIMULATION_HEADERS
  simulation/compute-all-terms.hpp
  )
147
148

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

166
167
168
169
170
171
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
172

173
IF(URDFDOM_FOUND)
174
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
175
    multibody/parser/urdf.hpp
176
    multibody/parser/urdf.hxx
177
    )
178
179
  
  IF(HPP_FCL_FOUND )
180
181
182
    LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
      multibody/parser/from-collada-to-fcl.hpp
      multibody/parser/urdf-with-geometry.hpp
183
      multibody/parser/urdf-with-geometry.hxx
184
      )
185
186
  ENDIF(HPP_FCL_FOUND)

187
  ADD_DEFINITIONS(-DWITH_URDFDOM)
188
189
ENDIF(URDFDOM_FOUND)

190
IF(HPP_FCL_FOUND)
191
  LIST(APPEND ${PROJECT_NAME}_SPATIAL_HEADERS
192
193
    spatial/fcl-pinocchio-conversions.hpp
    )
194
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_HEADERS
195
    multibody/geometry.hpp
196
    multibody/geometry.hxx
197
    )
198
199
200
  LIST(APPEND ${PROJECT_NAME}_ALGORITHM_HEADERS
    algorithm/collisions.hpp
    )
201
202
ENDIF(HPP_FCL_FOUND)

jcarpent's avatar
jcarpent committed
203
IF(LUA5_1_FOUND)
204
  LIST(APPEND ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS
jcarpent's avatar
jcarpent committed
205
206
207
208
    multibody/parser/lua.hpp
    multibody/parser/lua/lua_tables.hpp
    )

209
  ADD_DEFINITIONS(-DWITH_LUA)
jcarpent's avatar
jcarpent committed
210
211
ENDIF(LUA5_1_FOUND)

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

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)

228
229
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})

Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
230
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio")
231
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/math")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
232
233
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/spatial")
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody")
234
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/joint")
235
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser")
jcarpent's avatar
jcarpent committed
236
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/multibody/parser/lua")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
237
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/tools")
238
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/algorithm")
239
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/simulation")
Nicolas Mansard's avatar
Nicolas Mansard committed
240
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pinocchio/python")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
241

242

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

254
ADD_SUBDIRECTORY(src)
255
256
257
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
# --- EXECUTABLES --------------------------------------------------------------
258
259
ADD_SUBDIRECTORY(unittest)
IF (BUILD_BENCHMARK)
260
  ADD_SUBDIRECTORY (benchmark)
261
ENDIF (BUILD_BENCHMARK)
262
263
264
IF (BUILD_UTILS)
  ADD_SUBDIRECTORY (utils)
ENDIF (BUILD_UTILS)
Nicolas Mansard's avatar
Nicolas Mansard committed
265

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