-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
108 lines (93 loc) · 3.04 KB
/
CMakeLists.txt
1
2
3
4
5
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
cmake_minimum_required(VERSION 2.8.3)
project(or_fcl)
set(USE_CATKIN 1 CACHE BOOL "Build or_fcl as a Catkin package.")
include(FindPkgConfig)
include(CheckCXXSourceCompiles)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CXX11.cmake")
find_package(Boost REQUIRED COMPONENTS system)
find_package(OpenRAVE REQUIRED)
find_package(fcl QUIET)
if (NOT fcl_FOUND)
pkg_check_modules(fcl fcl)
endif()
if (NOT fcl_FOUND)
MESSAGE(FATAL_ERROR "fcl not found (either through cmake or pkg-config)")
endif()
include_directories(SYSTEM
${Boost_INCLUDE_DIRS}
${fcl_INCLUDE_DIRS}
${OpenRAVE_INCLUDE_DIRS}
)
link_directories(
${Boost_LIBRARY_DIRS}
${fcl_LIBRARY_DIRS}
${OpenRAVE_LIBRARY_DIRS}
)
# Enable C++11.
check_for_cxx11_compiler(CXX11_SUPPORTED)
if(CXX11_SUPPORTED)
enable_cxx11()
else()
message(FATAL_ERROR "Compiler does not support C++0x or C++11.")
endif()
# Check for OpenRAVE features.
set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS} ${OpenRAVE_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES} ${OpenRAVE_LIBRARIES})
set(CMAKE_REQUIRED_DEFINITIONS ${OpenRAVE_CXX_FLAGS} ${OpenRAVE_LINK_FLAGS})
set(CMAKE_REQUIRED_FLAGS)
foreach(dir ${OpenRAVE_LIBRARY_DIRS})
list(APPEND CMAKE_REQUIRED_FLAGS "-L${dir}")
endforeach()
check_cxx_source_compiles("
#include <openrave/openrave.h>
int main() {
OpenRAVE::CollisionReport r;
r.vLinkColliding.push_back(std::make_pair(OpenRAVE::KinBody::LinkConstPtr(),OpenRAVE::KinBody::LinkConstPtr()));
}" HAVE_REPORT_VLINKCOLLIDING_PAIR
)
if(HAVE_REPORT_VLINKCOLLIDING_PAIR)
add_definitions(-DHAVE_REPORT_VLINKCOLLIDING_PAIR)
endif ()
# Setup Catkin.
if (${USE_CATKIN})
message(STATUS "Building with Catkin.")
find_package(catkin)
if (NOT "${catkin_FOUND}")
message(FATAL_ERROR "Unable to find Catkin. Did you forget to pass"
" -DUSE_CATKIN=0 to disable Catkin support?")
endif ()
catkin_package()
catkin_add_env_hooks("20.${PROJECT_NAME}"
SHELLS sh
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/catkin-env-hooks"
)
if (CATKIN_ENABLE_TESTING)
catkin_add_nosetests(tests)
endif()
set(OpenRAVE_DEVEL_DIR "${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_SHARE_DESTINATION}/openrave-${OpenRAVE_LIBRARY_SUFFIX}/plugins")
set(OpenRAVE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CATKIN_GLOBAL_SHARE_DESTINATION}/openrave-${OpenRAVE_LIBRARY_SUFFIX}/plugins")
else ()
message(STATUS "Building without Catkin.")
set(OpenRAVE_DEVEL_DIR "")
set(OpenRAVE_INSTALL_DIR "share/openrave-${OpenRAVE_LIBRARY_SUFFIX}/plugins")
endif ()
# Build the plugin.
add_library("${PROJECT_NAME}_plugin" SHARED
src/or_fcl_plugin.cpp
src/FCLCollisionChecker.cpp
src/MarkPairsCollisionChecker.cpp
)
target_link_libraries("${PROJECT_NAME}_plugin"
${Boost_LIBRARIES}
${fcl_LIBRARIES}
${OpenRAVE_LIBRARIES}
)
set_target_properties("${PROJECT_NAME}_plugin" PROPERTIES
PREFIX ""
COMPILE_FLAGS "${OpenRAVE_CXX_FLAGS}"
LINK_FLAGS "${OpenRAVE_LINK_FLAGS}"
LIBRARY_OUTPUT_DIRECTORY "${OpenRAVE_DEVEL_DIR}"
)
install(TARGETS "${PROJECT_NAME}_plugin"
LIBRARY DESTINATION "${OpenRAVE_INSTALL_DIR}"
)