forked from ros-navigation/navigation2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
164 lines (140 loc) · 4.16 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
cmake_minimum_required(VERSION 3.5)
project(nav2_smac_planner)
set(CMAKE_BUILD_TYPE Release) #Debug, Release
find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(std_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(nav2_util REQUIRED)
find_package(nav2_core REQUIRED)
find_package(nav2_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(pluginlib REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(angles REQUIRED)
find_package(ompl REQUIRED)
find_package(OpenMP REQUIRED)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
if(MSVC)
add_compile_definitions(_USE_MATH_DEFINES)
else()
add_compile_options(-O3 -Wextra -Wdeprecated -fPIC)
endif()
include_directories(
include
${OMPL_INCLUDE_DIRS}
${OpenMP_INCLUDE_DIRS}
)
find_package(OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
set(library_name nav2_smac_planner)
set(dependencies
rclcpp
rclcpp_action
rclcpp_lifecycle
std_msgs
visualization_msgs
nav2_util
nav2_msgs
nav_msgs
geometry_msgs
builtin_interfaces
tf2_ros
nav2_costmap_2d
nav2_core
pluginlib
angles
eigen3_cmake_module
)
# Hybrid plugin
add_library(${library_name} SHARED
src/smac_planner_hybrid.cpp
src/a_star.cpp
src/collision_checker.cpp
src/smoother.cpp
src/analytic_expansion.cpp
src/node_hybrid.cpp
src/node_lattice.cpp
src/costmap_downsampler.cpp
src/node_2d.cpp
src/node_basic.cpp
)
target_link_libraries(${library_name} ${OMPL_LIBRARIES} ${OpenMP_LIBRARIES} OpenMP::OpenMP_CXX)
target_include_directories(${library_name} PUBLIC ${Eigen3_INCLUDE_DIRS})
ament_target_dependencies(${library_name}
${dependencies}
)
# 2D plugin
add_library(${library_name}_2d SHARED
src/smac_planner_2d.cpp
src/a_star.cpp
src/smoother.cpp
src/collision_checker.cpp
src/analytic_expansion.cpp
src/node_hybrid.cpp
src/node_lattice.cpp
src/costmap_downsampler.cpp
src/node_2d.cpp
src/node_basic.cpp
)
target_link_libraries(${library_name}_2d ${OMPL_LIBRARIES})
target_include_directories(${library_name}_2d PUBLIC ${Eigen3_INCLUDE_DIRS})
ament_target_dependencies(${library_name}_2d
${dependencies}
)
# Lattice plugin
add_library(${library_name}_lattice SHARED
src/smac_planner_lattice.cpp
src/a_star.cpp
src/smoother.cpp
src/collision_checker.cpp
src/analytic_expansion.cpp
src/node_hybrid.cpp
src/node_lattice.cpp
src/costmap_downsampler.cpp
src/node_2d.cpp
src/node_basic.cpp
)
target_link_libraries(${library_name}_lattice ${OMPL_LIBRARIES})
target_include_directories(${library_name}_lattice PUBLIC ${Eigen3_INCLUDE_DIRS})
ament_target_dependencies(${library_name}_lattice
${dependencies}
)
pluginlib_export_plugin_description_file(nav2_core smac_plugin_hybrid.xml)
pluginlib_export_plugin_description_file(nav2_core smac_plugin_2d.xml)
pluginlib_export_plugin_description_file(nav2_core smac_plugin_lattice.xml)
install(TARGETS ${library_name} ${library_name}_2d ${library_name}_lattice
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY include/
DESTINATION include/
)
install(DIRECTORY lattice_primitives/sample_primitives DESTINATION share/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(AMENT_LINT_AUTO_FILE_EXCLUDE include/nav2_smac_planner/thirdparty/robin_hood.h)
ament_lint_auto_find_test_dependencies()
find_package(ament_cmake_gtest REQUIRED)
add_subdirectory(test)
endif()
ament_export_include_directories(include ${OMPL_INCLUDE_DIRS})
ament_export_libraries(${library_name} ${library_name}_2d ${library_name}_lattice)
ament_export_dependencies(${dependencies})
ament_package()