forked from ros2/message_filters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
149 lines (119 loc) · 5.05 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
146
147
148
149
cmake_minimum_required(VERSION 3.5)
project(message_filters_humble)
# Declare carma package and check ROS version
find_package(carma_cmake_common REQUIRED)
carma_check_ros_version(2)
carma_package()
# 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()
find_package(ament_cmake_python REQUIRED)
find_package(ament_cmake_ros REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rcutils REQUIRED)
add_library(${PROJECT_NAME} src/connection.cpp)
if(WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE "MESSAGE_FILTERS_BUILDING_DLL")
endif()
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>"
"$<INSTALL_INTERFACE:include/>")
ament_target_dependencies(${PROJECT_NAME}
"rclcpp"
"rcutils"
)
install(
TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(
DIRECTORY "include/message_filters/"
DESTINATION include/${PROJECT_NAME}
)
ament_python_install_package(${PROJECT_NAME}
PACKAGE_DIR src/${PROJECT_NAME})
# Export old-style CMake variables
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME})
# Export modern CMake targets
ament_export_targets(${PROJECT_NAME})
ament_export_dependencies(rclcpp rcutils)
if(BUILD_TESTING)
find_package(sensor_msgs REQUIRED)
find_package(ament_lint_auto REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
ament_lint_auto_find_test_dependencies()
find_package(ament_cmake_gtest)
ament_add_gtest(${PROJECT_NAME}-test_simple test/test_simple.cpp)
if(TARGET ${PROJECT_NAME}-test_simple)
target_link_libraries(${PROJECT_NAME}-test_simple ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-msg_cache_unittest test/msg_cache_unittest.cpp)
if(TARGET ${PROJECT_NAME}-msg_cache_unittest)
target_link_libraries(${PROJECT_NAME}-msg_cache_unittest ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-test_chain test/test_chain.cpp)
if(TARGET ${PROJECT_NAME}-test_chain)
target_link_libraries(${PROJECT_NAME}-test_chain ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-test_time_sequencer test/time_sequencer_unittest.cpp)
if(TARGET ${PROJECT_NAME}-test_time_sequencer)
target_link_libraries(${PROJECT_NAME}-test_time_sequencer ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-test_subscriber test/test_subscriber.cpp)
if(TARGET ${PROJECT_NAME}-test_subscriber)
target_link_libraries(${PROJECT_NAME}-test_subscriber ${PROJECT_NAME})
ament_target_dependencies(${PROJECT_NAME}-test_subscriber "rclcpp" "rclcpp_lifecycle" "sensor_msgs")
endif()
ament_add_gtest(${PROJECT_NAME}-test_synchronizer test/test_synchronizer.cpp)
if(TARGET ${PROJECT_NAME}-test_synchronizer)
target_link_libraries(${PROJECT_NAME}-test_synchronizer ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-time_synchronizer_unittest test/time_synchronizer_unittest.cpp)
if(TARGET ${PROJECT_NAME}-time_synchronizer_unittest)
target_link_libraries(${PROJECT_NAME}-time_synchronizer_unittest ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-test_exact_time_policy test/test_exact_time_policy.cpp)
if(TARGET ${PROJECT_NAME}-test_exact_time_policy)
target_link_libraries(${PROJECT_NAME}-test_exact_time_policy ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-test_approximate_time_policy test/test_approximate_time_policy.cpp)
if(TARGET ${PROJECT_NAME}-test_approximate_time_policy)
target_link_libraries(${PROJECT_NAME}-test_approximate_time_policy ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-test_fuzz test/test_fuzz.cpp SKIP_TEST)
if(TARGET ${PROJECT_NAME}-test_fuzz)
target_link_libraries(${PROJECT_NAME}-test_fuzz ${PROJECT_NAME})
ament_target_dependencies(${PROJECT_NAME}-test_fuzz "rclcpp" "sensor_msgs")
endif()
ament_add_gtest(${PROJECT_NAME}-test_message_traits test/test_message_traits.cpp)
if(TARGET ${PROJECT_NAME}-test_message_traits)
target_link_libraries(${PROJECT_NAME}-test_message_traits ${PROJECT_NAME})
ament_target_dependencies(${PROJECT_NAME}-test_message_traits "rclcpp" "std_msgs")
endif()
# Provides PYTHON_EXECUTABLE_DEBUG
find_package(python_cmake_module REQUIRED)
find_package(PythonExtra REQUIRED)
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
if(WIN32)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
endif()
endif()
# python tests with python interfaces of message filters
find_package(ament_cmake_pytest REQUIRED)
ament_add_pytest_test(directed.py "test/directed.py"
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}")
ament_add_pytest_test(test_approxsync.py "test/test_approxsync.py"
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}")
ament_add_pytest_test(test_message_filters_cache.py "test/test_message_filters_cache.py"
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}")
endif()
ament_package()