forked from ros-navigation/navigation2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
147 lines (120 loc) · 3.32 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
cmake_minimum_required(VERSION 3.5)
project(nav2_collision_monitor)
### Dependencies ###
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(nav2_common REQUIRED)
find_package(nav2_util REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(nav2_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
### Header ###
nav2_package()
### Libraries and executables ###
include_directories(
include
)
set(dependencies
rclcpp
rclcpp_components
sensor_msgs
geometry_msgs
std_msgs
tf2
tf2_ros
tf2_geometry_msgs
nav2_util
nav2_costmap_2d
nav2_msgs
visualization_msgs
)
set(monitor_executable_name collision_monitor)
set(detector_executable_name collision_detector)
set(monitor_library_name ${monitor_executable_name}_core)
set(detector_library_name ${detector_executable_name}_core)
add_library(${monitor_library_name} SHARED
src/collision_monitor_node.cpp
src/polygon.cpp
src/velocity_polygon.cpp
src/circle.cpp
src/source.cpp
src/scan.cpp
src/pointcloud.cpp
src/polygon_source.cpp
src/range.cpp
src/kinematics.cpp
)
add_library(${detector_library_name} SHARED
src/collision_detector_node.cpp
src/polygon.cpp
src/velocity_polygon.cpp
src/circle.cpp
src/source.cpp
src/scan.cpp
src/pointcloud.cpp
src/polygon_source.cpp
src/range.cpp
src/kinematics.cpp
)
add_executable(${monitor_executable_name}
src/collision_monitor_main.cpp
)
add_executable(${detector_executable_name}
src/collision_detector_main.cpp
)
ament_target_dependencies(${monitor_library_name}
${dependencies}
)
ament_target_dependencies(${detector_library_name}
${dependencies}
)
target_link_libraries(${monitor_executable_name}
${monitor_library_name}
)
target_link_libraries(${detector_executable_name}
${detector_library_name}
)
ament_target_dependencies(${monitor_executable_name}
${dependencies}
)
ament_target_dependencies(${detector_executable_name}
${dependencies}
)
rclcpp_components_register_nodes(${monitor_library_name} "nav2_collision_monitor::CollisionMonitor")
rclcpp_components_register_nodes(${detector_library_name} "nav2_collision_monitor::CollisionDetector")
### Install ###
install(TARGETS ${monitor_library_name} ${detector_library_name}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(TARGETS ${monitor_executable_name} ${detector_executable_name}
RUNTIME DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY include/
DESTINATION include/
)
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY params DESTINATION share/${PROJECT_NAME})
### Testing ###
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
find_package(ament_cmake_gtest REQUIRED)
add_subdirectory(test)
endif()
### Ament stuff ###
ament_export_include_directories(include)
ament_export_libraries(${monitor_library_name} ${detector_library_name})
ament_export_dependencies(${dependencies})
ament_package()