CMakeLists.txt 8.27 KB
Newer Older
1
2
3
#
# Software License Agreement (BSD License)
#
4
#  Copyright (c) 2014-2020 CNRS-LAAS, INRIA
5
#  Author: Florent Lamiraux, Joseph Mirabel
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions
#  are met:
#
#   * Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#   * Redistributions in binary form must reproduce the above
#     copyright notice, this list of conditions and the following
#     disclaimer in the documentation and/or other materials provided
#     with the distribution.
#   * Neither the name of CNRS-LAAS. nor the names of its
#     contributors may be used to endorse or promote products derived
#     from this software without specific prior written permission.
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
#  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
#  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
#  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
#  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
#  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
#  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#  POSSIBILITY OF SUCH DAMAGE.
isucan's avatar
isucan committed
34

Guilhem Saurel's avatar
Guilhem Saurel committed
35
cmake_minimum_required(VERSION 3.1)
36
37
set(CXX_DISABLE_WERROR TRUE)

38
set(PROJECT_NAME hpp-fcl)
39
set(PROJECT_DESCRIPTION
40
  "HPP fork of FCL -- The Flexible Collision Library"
41
  )
Joseph Mirabel's avatar
Joseph Mirabel committed
42
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
43

44
45
46
# Do not support CMake older than 2.8.12
CMAKE_POLICY(SET CMP0022 NEW)
SET(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)
47
SET(DOXYGEN_USE_TEMPLATE_CSS TRUE)
48

49
50
51
52
53
# Check if the submodule cmake have been initialized
IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
  MESSAGE(FATAL_ERROR "\nPlease run the following command first:\ngit submodule update --init\n")
ENDIF()

54
55
56
include(cmake/boost.cmake)
include(cmake/python.cmake)
include(cmake/hpp.cmake)
57
include(cmake/apple.cmake)
58
include(cmake/ide.cmake)
Justin Carpentier's avatar
Justin Carpentier committed
59
include(CMakeDependentOption)
60

61
62
63
64
SET(CMAKE_MODULE_PATH
  ${CMAKE_SOURCE_DIR}/cmake-modules/
  ${CMAKE_MODULE_PATH})

65
66
# If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION()
67

68
69
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
70

Justin Carpentier's avatar
Justin Carpentier committed
71
72
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
CMAKE_DEPENDENT_OPTION(GENERATE_PYTHON_STUBS "Generate the Python stubs associated to the Python library" OFF BUILD_PYTHON_INTERFACE OFF)
73

Justin Carpentier's avatar
debug    
Justin Carpentier committed
74
75
76
77
78
79
80
81
82
83
84
85
#IF(WIN32)
#  # Set default Windows build paths
#  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
#    ${PROJECT_BINARY_DIR}/Bin
#    CACHE PATH "Single directory for all libraries")
#  SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
#    ${PROJECT_BINARY_DIR}/Bin
#    CACHE PATH "Single directory for all executables")
#  SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
#    ${PROJECT_BINARY_DIR}/Bin
#    CACHE PATH "Sing$le directory for all archives")
#ENDIF(WIN32)
86

87
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.0")
88

89
if(BUILD_PYTHON_INTERFACE)
Justin Carpentier's avatar
Justin Carpentier committed
90
91
  FIND_PACKAGE(eigenpy 2.2 REQUIRED)
endif()
92

93
# Required dependencies
94
95
SET_BOOST_DEFAULT_OPTIONS()
EXPORT_BOOST_DEFAULT_OPTIONS()
96
IF(WIN32)
97
  ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS chrono thread date_time serialization)
98
ELSE(WIN32)
Justin Carpentier's avatar
Justin Carpentier committed
99
  ADD_PROJECT_DEPENDENCY(Boost REQUIRED chrono serialization)
100
ENDIF(WIN32)
101
if(BUILD_PYTHON_INTERFACE)
Joseph Mirabel's avatar
Joseph Mirabel committed
102
  FINDPYTHON()
103
  search_for_boost_python(REQUIRED)
Justin Carpentier's avatar
Justin Carpentier committed
104
  find_package(Boost REQUIRED COMPONENTS system)
105
endif(BUILD_PYTHON_INTERFACE)
106

107
# Optional dependencies
108
ADD_PROJECT_DEPENDENCY(octomap PKG_CONFIG_REQUIRES "octomap >= 1.6")
Justin Carpentier's avatar
Justin Carpentier committed
109
if(octomap_FOUND)
110
  SET(HPP_FCL_HAS_OCTOMAP TRUE)
Justin Carpentier's avatar
Justin Carpentier committed
111
  string(REPLACE "." ";" VERSION_LIST ${octomap_VERSION})
112
113
114
  list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION)
  list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION)
  list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION)
115
  message(STATUS "FCL uses Octomap")
Steve Tonneau's avatar
Steve Tonneau committed
116
else()
117
  SET(HPP_FCL_HAS_OCTOMAP FALSE)
118
  message(STATUS "FCL does not use Octomap")
Steve Tonneau's avatar
Steve Tonneau committed
119
endif()
120

121
122
option(HPP_FCL_HAS_QHULL "use qhull library to compute convex hulls." FALSE)
if(HPP_FCL_HAS_QHULL)
Justin Carpentier's avatar
Justin Carpentier committed
123
  CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
Justin Carpentier's avatar
Justin Carpentier committed
124
  ADD_PROJECT_DEPENDENCY(Qhull COMPONENTS qhull_r qhullcpp PKG_CONFIG_REQUIRES "qhull_r, qhuppcpp")
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  if(Qhull_FOUND)
    set(HPP_FCL_USE_SYSTEM_QHULL TRUE)
  else()
    message(STATUS "Qhullcpp not found: it will be build from sources, if Qhull_r is found")
    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third-parties)
    execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
      ${CMAKE_SOURCE_DIR}/third-parties/qhull/src/libqhullcpp
      ${CMAKE_CURRENT_BINARY_DIR}/third-parties/libqhullcpp
      )
    set(Qhullcpp_PREFIX ${CMAKE_BINARY_DIR}/third-parties)
    find_path(Qhull_r_INCLUDE_DIR
      NAMES libqhull_r/libqhull_r.h
      PATHS ${Qhull_PREFIX}
      )
    find_library(Qhull_r_LIBRARY
      NAMES libqhull_r.so
      PATHS ${Qhull_PREFIX}
      )
    if(NOT Qhull_r_LIBRARY)
      message(FATAL_ERROR "Qhull_r not found, please install it or turn HPP_FCL_HAS_QHULL OFF")
    endif()
  endif()
147
148
endif()

149
FIND_PACKAGE(assimp REQUIRED)
panjia1983's avatar
panjia1983 committed
150

151
SET(${PROJECT_NAME}_HEADERS
152
153
154
155
156
157
158
159
160
161
162
  include/hpp/fcl/collision_data.h
  include/hpp/fcl/BV/kIOS.h
  include/hpp/fcl/BV/BV.h
  include/hpp/fcl/BV/RSS.h
  include/hpp/fcl/BV/OBBRSS.h
  include/hpp/fcl/BV/BV_node.h
  include/hpp/fcl/BV/AABB.h
  include/hpp/fcl/BV/OBB.h
  include/hpp/fcl/BV/kDOP.h
  include/hpp/fcl/narrowphase/narrowphase.h
  include/hpp/fcl/narrowphase/gjk.h
163
164
  include/hpp/fcl/shape/convex.h
  include/hpp/fcl/shape/details/convex.hxx
165
166
  include/hpp/fcl/shape/geometric_shape_to_BVH_model.h
  include/hpp/fcl/shape/geometric_shapes.h
167
  include/hpp/fcl/shape/geometric_shapes_utility.h
168
169
170
171
172
173
  include/hpp/fcl/distance_func_matrix.h
  include/hpp/fcl/collision.h
  include/hpp/fcl/collision_func_matrix.h
  include/hpp/fcl/distance.h
  include/hpp/fcl/math/matrix_3f.h
  include/hpp/fcl/math/vec_3f.h
174
  include/hpp/fcl/math/types.h
175
176
177
178
179
180
181
  include/hpp/fcl/math/transform.h
  include/hpp/fcl/data_types.h
  include/hpp/fcl/BVH/BVH_internal.h
  include/hpp/fcl/BVH/BVH_model.h
  include/hpp/fcl/BVH/BVH_front.h
  include/hpp/fcl/BVH/BVH_utility.h
  include/hpp/fcl/collision_object.h
182
  include/hpp/fcl/collision_utility.h
183
184
  include/hpp/fcl/octree.h
  include/hpp/fcl/fwd.hh
185
  include/hpp/fcl/mesh_loader/assimp.h
186
  include/hpp/fcl/mesh_loader/loader.h
Justin Carpentier's avatar
Justin Carpentier committed
187
  include/hpp/fcl/internal/BV_fitter.h
188
189
190
191
192
193
194
195
196
197
198
  include/hpp/fcl/internal/BV_splitter.h
  include/hpp/fcl/internal/intersect.h
  include/hpp/fcl/internal/tools.h
  include/hpp/fcl/internal/traversal_node_base.h
  include/hpp/fcl/internal/traversal_node_bvh_shape.h
  include/hpp/fcl/internal/traversal_node_bvhs.h
  include/hpp/fcl/internal/traversal_node_octree.h
  include/hpp/fcl/internal/traversal_node_setup.h
  include/hpp/fcl/internal/traversal_node_shapes.h
  include/hpp/fcl/internal/traversal_recurse.h
  include/hpp/fcl/internal/traversal.h
199
200
  include/hpp/fcl/serialization/fwd.h
  include/hpp/fcl/serialization/AABB.h
201
202
203
  include/hpp/fcl/serialization/BV_node.h
  include/hpp/fcl/serialization/BV_splitter.h
  include/hpp/fcl/serialization/BVH_model.h
204
  include/hpp/fcl/serialization/collision_data.h
205
  include/hpp/fcl/serialization/collision_object.h
206
  include/hpp/fcl/serialization/eigen.h
207
208
  include/hpp/fcl/serialization/geometric_shapes.h
  include/hpp/fcl/serialization/memory.h
209
210
211
  include/hpp/fcl/serialization/OBB.h
  include/hpp/fcl/serialization/RSS.h
  include/hpp/fcl/serialization/OBBRSS.h
Justin Carpentier's avatar
Justin Carpentier committed
212
  include/hpp/fcl/timings.h
213
214
  )

215
add_subdirectory(doc)
isucan's avatar
isucan committed
216
add_subdirectory(src)
Joseph Mirabel's avatar
Joseph Mirabel committed
217
218
219
if (BUILD_PYTHON_INTERFACE)
  add_subdirectory(python)
endif ()
220
add_subdirectory(test)
221

Joseph Mirabel's avatar
Joseph Mirabel committed
222
pkg_config_append_libs("hpp-fcl")
223
IF(HPP_FCL_HAS_OCTOMAP)
224
  # FCL_HAVE_OCTOMAP kept for backward compatibility reasons.
225
  PKG_CONFIG_APPEND_CFLAGS(
Justin Carpentier's avatar
Justin Carpentier committed
226
    "-DHPP_FCL_HAS_OCTOMAP -DHPP_FCL_HAVE_OCTOMAP -DFCL_HAVE_OCTOMAP -DOCTOMAP_MAJOR_VERSION=${OCTOMAP_MAJOR_VERSION} -DOCTOMAP_MINOR_VERSION=${OCTOMAP_MINOR_VERSION} -DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION}")
227
ENDIF(HPP_FCL_HAS_OCTOMAP)
Justin Carpentier's avatar
Justin Carpentier committed
228
229
230

# Install catkin package.xml
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})