-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
239 lines (201 loc) · 7.87 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Copyright 2021 Institute of Industrial and Control Engineering (IOC)
# Universitat Politecnica de Catalunya
# BarcelonaTech
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Author: Leopold Palomo-Avellaneda 2014-2019
project(kautham)
cmake_minimum_required(VERSION 3.1.3)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-Wall -Wextra -Wpedantic -fPIC)#-Werror)
set( KAUTHAM_VERSION 4.4.4 )
STRING( REGEX MATCHALL "[0-9]+" KAUTHAM_VERSIONS ${KAUTHAM_VERSION} )
LIST( GET KAUTHAM_VERSIONS 0 KAUTHAM_VERSION_MAJOR)
LIST( GET KAUTHAM_VERSIONS 1 KAUTHAM_VERSION_MINOR)
LIST( GET KAUTHAM_VERSIONS 2 KAUTHAM_VERSION_PATCH)
message( "Kautham version ${VERSION} (${KAUTHAM_VERSION_MAJOR}.${KAUTHAM_VERSION_MINOR}.${KAUTHAM_VERSION_PATCH})" )
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
########### Options ####################
option( KAUTHAM_FCL "Use FCL" ON )
option( KAUTHAM_OMPL "Use OMPL planners" ON )
option( KAUTHAM_IOC "Use IOC planners" ON )
option( KAUTHAM_OPENDE "Use Open Dynamic Engine" OFF)
option( KAUTHAM_GUI "Build the gui version" ON )
option( KAUTHAM_CONSOLE "Build the console version" ON )
option( KAUTHAM_ROS "Build the ROS version" OFF )
option( KAUTHAM_DOCUMENTATION_API "Create and install the HTML based API documentation (requires Doxygen)" OFF)
########### Set flags ####################
message( STATUS "Using this flags ........")
message( STATUS "Building the GUI version: ${KAUTHAM_GUI}")
message( STATUS "Building the console version: ${KAUTHAM_CONSOLE}")
message( STATUS "Building the ROS version: ${KAUTHAM_ROS}")
message( STATUS "Using OMPL planners: ${KAUTHAM_OMPL}")
message( STATUS "Using IOC planners: ${KAUTHAM_IOC}")
message( STATUS "Using Open Dynamic Engine: ${KAUTHAM_OPENDE}")
message( STATUS "Using FCL: ${KAUTHAM_FCL}")
message( STATUS "Creating the HTML based API documentation: ${KAUTHAM_DOCUMENTATION}")
########### Modules path and system options ###############
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
##############################################################################
##################### ROS-catkin ####################################
if( KAUTHAM_ROS )
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
trajectory_msgs
message_generation
roslib
rospy
geometry_msgs
visualization_msgs
tf2
tf2_ros
)
include_directories(${catkin_INCLUDE_DIRS} include)
add_service_files(
DIRECTORY apps/ros/srv
FILES
AddObstacle.srv
DetachObstacle.srv
SetDefaultRobControls.srv
SetObsControlsStream.srv
SetQuery.srv
AddRobot.srv
GetPath.srv
SetFixedObsControls.srv
SetObstaclesConfig.srv
SetRobControls.srv
SetRobControlsNoQuery.srv
AttachObstacle2RobotLink.srv
OpenProblem.srv
OpenProblemStream.srv
SetGoal.srv
SetPlannerByName.srv
SetRobControlsStream.srv
CheckCollision.srv
ProblemOpened.srv
SetInitObs.srv
SetPlannerParameter.srv
SetRobotsConfig.srv
ClearSampleSet.srv
RemoveObstacle.srv
SetInit.srv
SetPlanner.srv
Solve.srv
CloseProblem.srv
RemoveRobot.srv
SetObsControls.srv
SetPlannerStream.srv
Connect.srv
GetLastPlanComputationTime.srv
GetNumEdges.srv
GetNumVertices.srv
ObsPos.srv
RobPos.srv
FindIK.srv
LoadRobots.srv
VisualizeScene.srv
LoadObstacles.srv
GetObstaclesNames.srv
PathDofNames.srv
)
add_message_files(
DIRECTORY apps/ros/msg
FILES
fVector.msg
robconf.msg
)
catkin_python_setup()
generate_messages(DEPENDENCIES roscpp std_msgs trajectory_msgs visualization_msgs )
catkin_package(
INCLUDE_DIRS include
#LIBRARIES libkautham
CATKIN_DEPENDS roscpp visualization_msgs trajectory_msgs std_msgs geometry_msgs tf2 tf2_ros
)
endif( KAUTHAM_ROS )
include_directories(${catkin_INCLUDE_DIRS})
##################### Qt-Creator ####################################
FILE(GLOB_RECURSE LibFiles include/*.h src/external/*.h src/external/gdiam/*.h src/external/pqp/*.h src/external/pugixml/*.h)
add_custom_target(headers SOURCES ${LibFiles})
#### Boost package ###############
set(Boost_USE_MULTITHREADED ON)
find_package( Boost COMPONENTS system serialization thread REQUIRED )
if(Boost_FOUND)
message(STATUS "Boost library found at first attempt.")
message(STATUS "Using Boost linking against ${Boost_LIBRARIES}")
set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES})
else(Boost_FOUND)
set( BOOST_ROOT $ENV{BOOSTDIR})
message(STATUS "Boost library NOT found at first attempt. Setting BOOST_ROOT to" $ENV{BOOSTDIR})
find_package( Boost COMPONENTS system serialization thread REQUIRED )
if(Boost_FOUND)
message(STATUS "Boost library found in " ${BOOST_ROOT})
include_directories(${Boost_INCLUDE_DIRS})
set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES})
link_directories( ${Boost_LIBRARY_DIRS} )
else(Boost_FOUND)
message(STATUS "Boost library not found. Boost-dependent headers will NOT be available")
endif(Boost_FOUND)
endif(Boost_FOUND)
#### MT ###############
set(mt_DIR include/kautham/util/libmt)
message (STATUS "Adding libmt directory ${mt_DIR}")
include_directories( ${mt_DIR} )
### Eigen3 ############
find_package(Eigen3 REQUIRED NO_MODULE)
include_directories(${EIGEN3_INCLUDE_DIR})
#### ompl ######
# since noetic, ros provides ompl library version.
# but we prefer the Debian version
set(CMAKE_FIND_ROOT_PATH /usr/share;${CMAKE_FIND_ROOT_PATH})
find_package(ompl 1.5)
if( OMPL_FOUND )
if(OMPL_VERSION VERSION_LESS 1.3.0)
message(ERROR "OMPL Package FOUND version ${OMPL_VERSION} and Kautham need at least 1.3")
else(OMPL_VERSION VERSION_LESS 1.3.0)
message( STATUS "OMPL Package FOUND version ${OMPL_VERSION} : setting -DKAUTHAM_USE_OMPL flag")
message( STATUS "OMPL lib is: " ${OMPL_LIBRARIES})
endif(OMPL_VERSION VERSION_LESS 1.3.0)
message( STATUS "OMPL include is: " ${OMPL_INCLUDE_DIRS})
include_directories(${OMPL_INCLUDE_DIRS})
set(EXTRA_LIBS ${EXTRA_LIBS} ${OMPL_LIBRARIES})
add_definitions( -DKAUTHAM_USE_OMPL )
endif()
##################### ROS-catkin ####################################
include_directories( include )
include_directories( ${CMAKE_BINARY_DIR}/include/)
include_directories( src ) # for external
# Building librarires
add_subdirectory ( include )
add_subdirectory ( src )
add_subdirectory ( apps )
add_subdirectory ( doc )
#########################################################
# Copy Help file
# install(DIRECTORY include/kautham DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY demos DESTINATION share/kautham)