forked from berndpfrommer/rosbag2_composable_recorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
106 lines (84 loc) · 2.87 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
#
# Copyright 2021 Bernd Pfrommer <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.16)
project(rosbag2_composable_recorder)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_auto REQUIRED)
set(ROS2_DEPENDENCIES
"rclcpp"
"rclcpp_components"
"std_srvs"
"rosbag2_transport"
)
foreach(pkg ${ROS2_DEPENDENCIES})
find_package(${pkg} REQUIRED)
endforeach()
if(${rosbag2_transport_VERSION} VERSION_GREATER_EQUAL 0.25.0)
add_definitions(-DUSE_ALL_TOPICS)
endif()
if(${rosbag2_transport_VERSION} VERSION_GREATER_EQUAL 0.22.6)
add_definitions(-DUSE_GET_STORAGE_OPTIONS)
add_definitions(-DUSE_GET_RECORD_OPTIONS)
add_definitions(-DUSE_STOP_DISCOVERY)
endif()
ament_auto_find_build_dependencies(REQUIRED ${ROS2_DEPENDENCIES})
#
# --------- recorder (composable component and node) -------------
ament_auto_add_library(composable_recorder SHARED
src/composable_recorder.cpp)
target_include_directories(composable_recorder PRIVATE include)
rclcpp_components_register_nodes(composable_recorder "rosbag2_composable_recorder::ComposableRecorder")
ament_auto_add_executable(composable_recorder_node
src/composable_recorder_node.cpp)
install(TARGETS
composable_recorder
DESTINATION lib)
install(TARGETS
composable_recorder_node
DESTINATION lib/${PROJECT_NAME}/)
install(PROGRAMS
src/start_recording.py
DESTINATION lib/${PROJECT_NAME}/)
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/
FILES_MATCHING PATTERN "*.py")
if(BUILD_TESTING)
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_copyright REQUIRED)
find_package(ament_cmake_cppcheck REQUIRED)
find_package(ament_cmake_cpplint REQUIRED)
find_package(ament_cmake_lint_cmake REQUIRED)
find_package(ament_cmake_clang_format REQUIRED)
find_package(ament_cmake_xmllint REQUIRED)
ament_copyright()
ament_cppcheck(LANGUAGE c++)
ament_cpplint(FILTERS "-build/include,-runtime/indentation_namespace")
ament_lint_cmake()
ament_clang_format()
ament_xmllint()
endif()
ament_package()