CMakeLists.txt 7.92 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)
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
135
  algorithm/jacobian.hxx
Nicolas Mansard's avatar
Nicolas Mansard committed
136
  algorithm/cholesky.hpp
137
  algorithm/kinematics.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
138
  algorithm/center-of-mass.hpp
139
  algorithm/center-of-mass.hxx
140
  algorithm/non-linear-effects.hpp
141
  algorithm/joint-limits.hpp
142
  algorithm/energy.hpp
143
144
  )

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

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

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

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

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

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

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

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

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

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)

229
230
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})

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

243

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

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

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