CMakeLists.txt 6.49 KB
Newer Older
1
2
3
4
#
# Software License Agreement (BSD License)
#
#  Copyright (c) 2014 CNRS-LAAS
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

35
36
37
cmake_minimum_required(VERSION 2.8)
set(CXX_DISABLE_WERROR TRUE)
include(cmake/base.cmake)
38
include(cmake/eigen.cmake)
39
40
include(cmake/boost.cmake)

41
set(PROJECT_NAME hpp-fcl)
42
43
44
set(PROJECT_DESCRIPTION
  "FCL -- The Flexible Collision Library"
  )
jcarpent's avatar
jcarpent committed
45
set(PROJECT_URL "http://github.com/humanoid-path-planner/hpp-fcl")
46

47
48
49
50
51
52
53
54
55
56
57
58
59
IF(APPLE)
  SET(CMAKE_MACOSX_RPATH TRUE)
  SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
  SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

  set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
  if("${isSystemDir}" STREQUAL "-1")
     set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  endif("${isSystemDir}" STREQUAL "-1")
ENDIF(APPLE)

60
61
setup_project()

62
63
add_required_dependency("eigen3 >= 3.0.0")
include_directories(${EIGEN3_INCLUDE_DIRS})
64

65
66
67
# Add a cache variable to allow not compiling and running tests
set (RUN_TESTS TRUE CACHE BOOL "compile and run unit tests")

68
# Required dependencies
69
70
71
72
73
74
if (RUN_TESTS)
  set(BOOST_COMPONENTS thread date_time filesystem system unit_test_framework)
else ()
  set(BOOST_COMPONENTS thread date_time system)
endif ()

75
76
77
search_for_boost()
# Optional dependencies
add_optional_dependency("octomap >= 1.6")
Steve Tonneau's avatar
Steve Tonneau committed
78
if (OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS)
79
80
81
82
  include_directories(${OCTOMAP_INCLUDE_DIRS})
  link_directories(${OCTOMAP_LIBRARY_DIRS})
  SET(HPP_FCL_HAVE_OCTOMAP TRUE)
  add_definitions (-DHPP_FCL_HAVE_OCTOMAP)
83
84
85
86
87
88
89
  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)
  add_definitions (-DOCTOMAP_MAJOR_VERSION=${OCTOMAP_MAJOR_VERSION}
                   -DOCTOMAP_MINOR_VERSION=${OCTOMAP_MINOR_VERSION}
                   -DOCTOMAP_PATCH_VERSION=${OCTOMAP_PATCH_VERSION})
90
  message(STATUS "FCL uses Octomap")
Steve Tonneau's avatar
Steve Tonneau committed
91
else()
92
93
  SET(HPP_FCL_HAVE_OCTOMAP FALSE)
  message(STATUS "FCL does not use Octomap")
Steve Tonneau's avatar
Steve Tonneau committed
94
endif()
95

96
97
98
ADD_REQUIRED_DEPENDENCY("assimp >= 2.0")
if(ASSIMP_FOUND)
  if (NOT ${ASSIMP_VERSION} VERSION_LESS "2.0.1150")
99
100
    add_definitions(-DHPP_FCL_USE_ASSIMP_UNIFIED_HEADER_NAMES)
    SET(HPP_FCL_USE_ASSIMP_UNIFIED_HEADER_NAMES TRUE)
101
102
    message(STATUS "Assimp version has unified headers")
  else()
103
    SET(HPP_FCL_USE_ASSIMP_UNIFIED_HEADER_NAMES FALSE)
104
105
106
    message(STATUS "Assimp version does not have unified headers")
  endif()
endif()
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
129
130
  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_shapes_utility.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_node.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
131
  include/hpp/fcl/math/tools.h
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
  include/hpp/fcl/math/transform.h
  include/hpp/fcl/traversal/traversal_node_shapes.h
  include/hpp/fcl/traversal/traversal_node_setup.h
  include/hpp/fcl/traversal/traversal_recurse.h
  include/hpp/fcl/traversal/traversal_node_octree.h
  include/hpp/fcl/traversal/traversal_node_bvhs.h
  include/hpp/fcl/traversal/traversal_node_bvh_shape.h
  include/hpp/fcl/traversal/traversal_node_base.h
  include/hpp/fcl/data_types.h
  include/hpp/fcl/BVH/BV_splitter.h
  include/hpp/fcl/BVH/BVH_internal.h
  include/hpp/fcl/BVH/BVH_model.h
  include/hpp/fcl/BVH/BV_fitter.h
  include/hpp/fcl/BVH/BVH_front.h
  include/hpp/fcl/BVH/BVH_utility.h
  include/hpp/fcl/intersect.h
  include/hpp/fcl/collision_object.h
149
  include/hpp/fcl/collision_utility.h
150
151
  include/hpp/fcl/octree.h
  include/hpp/fcl/fwd.hh
152
  include/hpp/fcl/mesh_loader/assimp.h
153
  include/hpp/fcl/mesh_loader/loader.h
154
155
  )

isucan's avatar
isucan committed
156
add_subdirectory(src)
157
158
159
if (RUN_TESTS)
  add_subdirectory(test)
endif ()
160

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

173
setup_project_finalize()