-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
228 lines (196 loc) · 8.88 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
cmake_minimum_required(VERSION 3.10.2)
project(heuristic_planners)
add_compile_options(-std=c++17 -Wall -Werror -Wextra -pedantic )
option(BUILD_DOC "Build documentation " ON)
option(BUILD_ROS_SUPPORT "Build with ROS Support" ON)
option(OPTIMIZE_FLAG "Enable Compiler Optimization for Runtime Performance" ON)
option(BUILD_DEBUG "Build debug features " OFF)
option(BUILD_COMPUTE_STATS "Build Algorithms with statistics" ON)
option(BUILD_VOROCPP "Build voro++ features " OFF)
if(OPTIMIZE_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
else()
add_compile_options(-fsanitize=address,undefined -static-libasan -g3)
endif()
if(BUILD_COMPUTE_STATS)
add_compile_definitions(COMPUTE_STATISTICS)
endif()
if(BUILD_DOC)
# check if Doxygen is installed
find_package(Doxygen)
if (DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
# note the option ALL which allows to build the docs together with the application
add_custom_target( doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
endif()
unset(BUILD_DOC CACHE)
find_package(Boost)
if(BUILD_ROS_SUPPORT)
add_compile_definitions(ROS)
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
std_msgs
geometry_msgs
nav_msgs
visualization_msgs
message_generation
roscpp
pcl_conversions
pcl_ros
octomap_ros
costmap_2d
)
#Eigen is used to calculate metrics parameters
find_package (Eigen3 REQUIRED NO_MODULE)
find_package(OpenSSL REQUIRED)
if(BUILD_DEBUG)
add_definitions(-DPUB_EXPLORED_NODES)
endif()
unset(BUILD_DEBUG CACHE)
################################################
## Declare ROS messages, services and actions ##
################################################
catkin_python_setup()
## Generate services in the 'srv' folder
add_service_files(
FILES
GetPath.srv
SetAlgorithm.srv
)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
geometry_msgs std_msgs
)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
LIBRARIES AlgorithmBase AStar AStarM1 AStarM2 ThetaStar ThetaStarM1 ThetaStarM2 LazyThetaStar LazyThetaStarM1 LazyThetaStarM1Mod LazyThetaStarM2
#
CATKIN_DEPENDS std_msgs visualization_msgs geometry_msgs nav_msgs roscpp message_runtime costmap_2d
# DEPENDS system_lib
)
endif()
###########
## Build ##
###########
include_directories(
include
${catkin_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6
)
if( BUILD_VOROCPP )
list(APPEND VORO_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/voro++.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/cell.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/c_loops.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/common.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/container_prd.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/container.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/pre_container.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/unitcell.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/v_base.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/v_compute.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/voro++-0.4.6/src/wall.cc
)
add_library(Voro++ STATIC ${VORO_SOURCES})
list(APPEND ${PROJECT_NAME}_LIBRARIES Voro++)
list(APPEND ${PROJECT_NAME}_TARGETS voro++)
add_executable(voro++ include/voro++-0.4.6/src/cmd_line.cc)
target_link_libraries(voro++ Voro++)
endif()
##This is True by default but it's good to have it here as a reminder
set(BUILD_SHARED_LIBS TRUE)
list(APPEND ${PROJECT_NAME}_UTILS_SOURCES src/utils/geometry_utils.cpp
src/utils/heuristic.cpp
src/utils/LineOfSight.cpp
src/utils/utils.cpp
src/utils/metrics.cpp
)
if(BUILD_ROS_SUPPORT)
list(APPEND ${PROJECT_NAME}_UTILS_SOURCES src/utils/ros/ROSInterfaces.cpp)
endif()
add_library(AlgorithmBase src/Planners/AlgorithmBase.cpp
${${PROJECT_NAME}_UTILS_SOURCES})
add_library(AStar src/Planners/AStar.cpp
src/Planners/AlgorithmBase.cpp
${${PROJECT_NAME}_UTILS_SOURCES}
)
add_library(AStarM1 src/Planners/AStarM1.cpp )
add_library(AStarM2 src/Planners/AStarM2.cpp )
add_library(ThetaStar src/Planners/ThetaStar.cpp )
add_library(ThetaStarM1 src/Planners/ThetaStarM1.cpp )
add_library(ThetaStarM2 src/Planners/ThetaStarM2.cpp )
add_library(LazyThetaStar src/Planners/LazyThetaStar.cpp )
add_library(LazyThetaStarM1 src/Planners/LazyThetaStarM1.cpp )
add_library(LazyThetaStarM1Mod src/Planners/LazyThetaStarM1Mod.cpp )
add_library(LazyThetaStarM2 src/Planners/LazyThetaStarM2.cpp )
list(APPEND ${PROJECT_NAME}_LIBRARIES AlgorithmBase AStar AStarM1 AStarM2 ThetaStar ThetaStarM1 ThetaStarM2 LazyThetaStar LazyThetaStarM1 LazyThetaStarM1Mod LazyThetaStarM2)
target_link_libraries(${${PROJECT_NAME}_LIBRARIES} ${catkin_LIBRARIES} ${Boost_LIBRARIES})
add_dependencies( ${${PROJECT_NAME}_LIBRARIES} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
list(APPEND ${PROJECT_NAME}_TARGETS ${${PROJECT_NAME}_LIBRARIES})
if(BUILD_ROS_SUPPORT)
add_executable(planner_ros_node src/ROS/planner_ros_node.cpp )
add_dependencies(planner_ros_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} ${${PROJECT_NAME}_LIBRARIES})
target_link_libraries(planner_ros_node ${catkin_LIBRARIES} ${${PROJECT_NAME}_LIBRARIES} -lstdc++fs Eigen3::Eigen -lcrypto -lssl)
list(APPEND ${PROJECT_NAME}_TARGETS planner_ros_node)
#############
## Install ##
#############
## Mark executables and/or libraries for installation
install(TARGETS ${${PROJECT_NAME}_TARGETS}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
catkin_install_python(PROGRAMS scripts/test_algorithms.py
scripts/test_algorithms_compare.py
scripts/test_algorithms_performance.py
scripts/test_algorithms_pseudo_random_paths.py
scripts/compare_trajectories_rviz.py
scripts/plan_caller.py
scripts/generate2d_random_map.py
setup.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY include/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.hpp"
)
## Mark other files for installation (e.g. launch and bag files, etc.)
install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
install(DIRECTORY config/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config)
install(DIRECTORY rviz/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/rviz)
install(DIRECTORY resources/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/resources
PATTERN ".gridm" EXCLUDE)
else()
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
FILES_MATCHING PATTERN "*.hpp"
)
install(TARGETS ${${PROJECT_NAME}_TARGETS}
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
endif()
unset(BUILD_ROS_SUPPORT CACHE)