-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (58 loc) · 1.67 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
cmake_minimum_required(VERSION 3.8)
###############
# project name
project(robocon2024-1)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
###############
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
###############
# Add Serialbridge
set(SERIAL_BRIDGE_DIR "${CMAKE_SOURCE_DIR}/SerialBridge")
find_library(SERIAL_BRIDGE_LIB NAMES SerialBridge PATHS "${SERIAL_BRIDGE_DIR}/bin")
###############
# include custom header files
include_directories(
include
include/${PROJECT_NAME}
)
###############
# Add ROS nodes
set(node_list subscriber_new pan_tilt_node subscriber_new_new subscriber_robo2 subscriber_robo3)
foreach(node ${node_list})
add_executable(${node} src/${node}.cpp)
ament_target_dependencies(${node} rclcpp std_msgs sensor_msgs geometry_msgs)
target_include_directories(${node} PRIVATE
"${SERIAL_BRIDGE_DIR}/src"
"${rclcpp_INCLUDE_DIRS}"
"${std_msgs_INCLUDE_DIRS}"
)
target_link_libraries(${node}
"${SERIAL_BRIDGE_LIB}"
"${rclcpp_LIBRARIES}"
"${std_msgs_LIBRARIES}"
)
endforeach()
###############
# Install launch files
install(DIRECTORY launch/
DESTINATION share/${PROJECT_NAME}/launch
)
###############
install(TARGETS
${node_list}
DESTINATION lib/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()