-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (54 loc) · 1.75 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
cmake_minimum_required(VERSION 3.10)
project(snapshotter)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
add_compile_options(-Wall -Wextra -Werror)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rosbag2_cpp REQUIRED)
find_package(rosbag2_compression REQUIRED)
find_package(rosbag2_transport REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
rosidl_generate_interfaces(
${PROJECT_NAME}
srv/TakeSnapshot.srv
DEPENDENCIES
std_msgs)
rosidl_get_typesupport_target(cpp_typesupport_target ${PROJECT_NAME} "rosidl_typesupport_cpp")
add_library(${PROJECT_NAME}_lib OBJECT
src/Snapshotter.cpp
src/Snapshotter.hpp
src/MessageRingBuffer.hpp
src/MessageRingBuffer.cpp
src/TopicFilter.cpp
src/TopicFilter.hpp
src/SingleMessageBuffer.hpp
src/SingleMessageBuffer.cpp
)
target_link_libraries(
${PROJECT_NAME}_lib
PUBLIC ${cpp_typesupport_target} rclcpp::rclcpp rosbag2_cpp::rosbag2_cpp rosbag2_compression::rosbag2_compression rosbag2_transport::rosbag2_transport
)
add_executable(${PROJECT_NAME}_node src/main.cpp)
target_link_libraries(${PROJECT_NAME}_node
${PROJECT_NAME}_lib
${cpp_typesupport_target}
)
#############
## Install ##
#############
install(TARGETS ${PROJECT_NAME}_node RUNTIME DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY config DESTINATION share/${PROJECT_NAME})
#############
## Testing ##
#############
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
ament_add_gtest(utest test/test.test test/test_node.cpp)
target_include_directories(utest PRIVATE src)
target_link_libraries(utest ${PROJECT_NAME}_lib)
endif()
ament_package()