CMakeLists.txt 5.95 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
IF(NOT DEFINED CMAKE_CXX_STANDARD)
  SET(CMAKE_CXX_STANDARD 98)
ENDIF()
Justin Carpentier's avatar
Justin Carpentier committed
47

48
49
50
# Do not support CMake older than 2.8.12
CMAKE_POLICY(SET CMP0022 NEW)
SET(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)
51
SET(DOXYGEN_USE_TEMPLATE_CSS TRUE)
52

53
54
55
56
57
# 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()

58
59
60
61
include(cmake/eigen.cmake)
include(cmake/boost.cmake)
include(cmake/python.cmake)
include(cmake/hpp.cmake)
62
include(cmake/apple.cmake)
63
include(cmake/ide.cmake)
64
include(cmake/test.cmake)
65

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

69
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
Joseph Mirabel's avatar
Joseph Mirabel committed
70

71
72
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
73

74
add_required_dependency("eigen3 >= 3.0.0")
75

76
if (BUILD_PYTHON_INTERFACE)
77
  ADD_COMPILE_DEPENDENCY("eigenpy >= 2.2")
78
79
endif ()

80
# Add a cache variable to allow not compiling and running tests
81
set (BUILD_TESTING TRUE CACHE BOOL "compile and run unit tests")
82

83
# Required dependencies
Joseph Mirabel's avatar
Joseph Mirabel committed
84
set(BOOST_COMPONENTS thread date_time system)
85
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem unit_test_framework chrono)
Joseph Mirabel's avatar
Joseph Mirabel committed
86
87
88
if (BUILD_PYTHON_INTERFACE)
  FINDPYTHON()
  set(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
89
90
endif ()

91
92
93
search_for_boost()
# Optional dependencies
add_optional_dependency("octomap >= 1.6")
Guilhem Saurel's avatar
Guilhem Saurel committed
94
if (OCTOMAP_FOUND)
95
  SET(HPP_FCL_HAVE_OCTOMAP TRUE)
96
97
98
99
  string(REPLACE "." ";" VERSION_LIST ${OCTOMAP_VERSION})
  list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION)
  list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION)
  list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION)
100
  message(STATUS "FCL uses Octomap")
Steve Tonneau's avatar
Steve Tonneau committed
101
else()
102
103
  SET(HPP_FCL_HAVE_OCTOMAP FALSE)
  message(STATUS "FCL does not use Octomap")
Steve Tonneau's avatar
Steve Tonneau committed
104
endif()
105

106
ADD_REQUIRED_DEPENDENCY("assimp >= 2.0")
panjia1983's avatar
panjia1983 committed
107

108
SET(${PROJECT_NAME}_HEADERS
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  include/hpp/fcl/collision_data.h
  include/hpp/fcl/profile.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
  include/hpp/fcl/shape/geometric_shape_to_BVH_model.h
  include/hpp/fcl/shape/geometric_shapes.h
  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
129
  include/hpp/fcl/math/types.h
130
131
132
133
134
135
136
  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
137
  include/hpp/fcl/collision_utility.h
138
139
  include/hpp/fcl/octree.h
  include/hpp/fcl/fwd.hh
140
  include/hpp/fcl/mesh_loader/assimp.h
141
  include/hpp/fcl/mesh_loader/loader.h
142
143
144
145
146
147
148
149
150
151
152
153
  include/hpp/fcl/internal/BV_fitter.h
  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
154
155
  )

isucan's avatar
isucan committed
156
add_subdirectory(src)
Joseph Mirabel's avatar
Joseph Mirabel committed
157
158
159
if (BUILD_PYTHON_INTERFACE)
  add_subdirectory(python)
endif ()
160
add_subdirectory(test)
161

Joseph Mirabel's avatar
Joseph Mirabel committed
162
pkg_config_append_libs("hpp-fcl")
163
PKG_CONFIG_APPEND_BOOST_LIBS(thread date_time system)
164
165
IF(HPP_FCL_HAVE_OCTOMAP)
  # FCL_HAVE_OCTOMAP kept for backward compatibility reasons.
166
  PKG_CONFIG_APPEND_CFLAGS(
167
168
    "-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}")
ENDIF(HPP_FCL_HAVE_OCTOMAP)
Justin Carpentier's avatar
Justin Carpentier committed
169
170
171

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