-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
145 lines (124 loc) · 3.64 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
cmake_minimum_required(VERSION 3.5)
project(yasmin_demos)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
if(NOT DEFINED ENV{ROS_DISTRO})
message(FATAL_ERROR "ROS_DISTRO is not defined." )
endif()
if("$ENV{ROS_DISTRO}" STREQUAL "foxy")
message(STATUS "Build for ROS 2 Foxy")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFOXY")
elseif("$ENV{ROS_DISTRO}" STREQUAL "galactic")
message(STATUS "Build for ROS 2 Galactic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGALACTIC")
elseif("$ENV{ROS_DISTRO}" STREQUAL "humble")
message(STATUS "Build for ROS 2 Humble")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHUMBLE")
elseif("$ENV{ROS_DISTRO}" STREQUAL "iron")
message(STATUS "Build for ROS 2 Iron")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIRON")
elseif("$ENV{ROS_DISTRO}" STREQUAL "jazzy")
message(STATUS "Build for ROS 2 Jazzy")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJAZZY")
elseif("$ENV{ROS_DISTRO}" STREQUAL "rolling")
message(STATUS "Build for ROS 2 Rolling")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DROLLING")
else()
message(FATAL_ERROR "Unsupported ROS Distribution: " "$ENV{ROS_DISTRO}")
endif()
# Find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclpy REQUIRED)
find_package(yasmin REQUIRED)
find_package(yasmin_ros REQUIRED)
find_package(yasmin_viewer REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(example_interfaces REQUIRED)
# C++
include_directories(include)
include_directories(src)
set(LIB ${CMAKE_PROJECT_NAME}_lib)
set(DEPENDENCIES
rclcpp
rclcpp_action
yasmin
yasmin_ros
yasmin_viewer
nav_msgs
example_interfaces
)
# demo
add_executable(yasmin_demo src/yasmin_demo.cpp)
ament_target_dependencies(yasmin_demo ${DEPENDENCIES})
install(TARGETS
yasmin_demo
DESTINATION lib/${PROJECT_NAME}
)
# monitor demo
add_executable(monitor_demo src/monitor_demo.cpp)
ament_target_dependencies(monitor_demo ${DEPENDENCIES})
install(TARGETS
monitor_demo
DESTINATION lib/${PROJECT_NAME}
)
# service client demo
add_executable(service_client_demo src/service_client_demo.cpp)
ament_target_dependencies(service_client_demo ${DEPENDENCIES})
install(TARGETS
service_client_demo
DESTINATION lib/${PROJECT_NAME}
)
# action client demo
add_executable(action_client_demo src/action_client_demo.cpp)
ament_target_dependencies(action_client_demo ${DEPENDENCIES})
install(TARGETS
action_client_demo
DESTINATION lib/${PROJECT_NAME}
)
# add_two_ints service server
add_executable(add_two_ints_server src/add_two_ints_server.cpp)
ament_target_dependencies(add_two_ints_server ${DEPENDENCIES})
install(TARGETS
add_two_ints_server
DESTINATION lib/${PROJECT_NAME}
)
# fibonacci action server
add_executable(fibonacci_action_server src/fibonacci_action_server.cpp)
ament_target_dependencies(fibonacci_action_server ${DEPENDENCIES})
install(TARGETS
fibonacci_action_server
DESTINATION lib/${PROJECT_NAME}
)
ament_export_include_directories(include)
ament_export_libraries(${LIB})
# Python
ament_python_install_package(${PROJECT_NAME})
install(PROGRAMS
yasmin_demos/yasmin_demo.py
DESTINATION lib/${PROJECT_NAME}
)
install(PROGRAMS
yasmin_demos/monitor_demo.py
DESTINATION lib/${PROJECT_NAME}
)
install(PROGRAMS
yasmin_demos/service_client_demo.py
DESTINATION lib/${PROJECT_NAME}
)
install(PROGRAMS
yasmin_demos/action_client_demo.py
DESTINATION lib/${PROJECT_NAME}
)
install(PROGRAMS
yasmin_demos/nav_demo.py
DESTINATION lib/${PROJECT_NAME}
)
ament_package()