-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
110 lines (97 loc) · 2.93 KB
/
CMakeLists.txt
File metadata and controls
110 lines (97 loc) · 2.93 KB
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
cmake_minimum_required(VERSION 3.8)
project(lsy_ros_data_utils)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
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(rclcpp_components REQUIRED)
find_package(rosbag2_cpp REQUIRED)
find_package(rosbag2_storage REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(OpenCV REQUIRED)
# general ros messages
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
set(AMENT_DEPENDENCIES_MSG
std_msgs
sensor_msgs
geometry_msgs
nav_msgs
diagnostic_msgs
tf2_msgs
)
# custom ros messages
foreach (msg_pkg IN ITEMS
"livox_ros_driver2"
"septentrio_gnss_driver"
"mavros_msgs"
"zed_msgs"
"gps_msgs"
"rslidar_msg"
)
find_package(${msg_pkg} QUIET)
if (${msg_pkg}_FOUND)
message(STATUS "Message package '${msg_pkg}' found → enabling typed support")
list(APPEND AMENT_DEPENDENCIES_MSG ${msg_pkg})
string(TOUPPER ${msg_pkg} MSG_PKG_UPPER)
add_compile_definitions(HAVE_${MSG_PKG_UPPER}=1)
else ()
message(STATUS "Message package '${msg_pkg}' NOT found → building without typed support")
endif ()
endforeach ()
include_directories(
include
include/${PROJECT_NAME}
)
set(AMENT_DEPENDENCIES_GENERAL
rclcpp
rclcpp_components
rosbag2_cpp
rosbag2_storage
)
add_library(bag_recorder_component SHARED
src/bag_recorder_component.cpp
src/bag_recorder_type_registration.cpp
include/lsy_ros_data_utils/msg_converter.hpp
)
target_link_libraries(bag_recorder_component
yaml-cpp
${OpenCV_LIBS}
)
target_include_directories(bag_recorder_component PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME}
)
target_compile_features(bag_recorder_component PUBLIC cxx_std_20)
ament_target_dependencies(bag_recorder_component
${AMENT_DEPENDENCIES_GENERAL}
${AMENT_DEPENDENCIES_MSG}
)
rclcpp_components_register_nodes(bag_recorder_component "lsy_ros_data_utils::rosbag::BagRecorderComponent")
install(TARGETS bag_recorder_component
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
)
ament_export_include_directories(include)
ament_export_libraries(
bag_recorder_component
)
ament_export_dependencies(${AMENT_DEPENDENCIES_GENERAL}
${AMENT_DEPENDENCIES_MSG})
install(DIRECTORY include/
DESTINATION include
)
install(DIRECTORY config launch
DESTINATION share/${PROJECT_NAME}
)
ament_package()