-
Notifications
You must be signed in to change notification settings - Fork 66
/
CMakeLists.txt
147 lines (117 loc) · 5.24 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
cmake_minimum_required(VERSION 3.5)
project(message_filters)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
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)
find_package(std_msgs 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/${PROJECT_NAME}>")
target_link_libraries(${PROJECT_NAME} PUBLIC
rclcpp::rclcpp
rcutils::rcutils
${std_msgs_TARGETS}
)
install(
TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(
DIRECTORY "include/"
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 std_msgs)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_cppcheck_LANGUAGE "c++")
find_package(rclcpp_lifecycle REQUIRED)
find_package(sensor_msgs 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} rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle ${sensor_msgs_TARGETS})
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_approximate_epsilon_time_policy test/test_approximate_epsilon_time_policy.cpp)
if(TARGET ${PROJECT_NAME}-test_approximate_epsilon_time_policy)
target_link_libraries(${PROJECT_NAME}-test_approximate_epsilon_time_policy ${PROJECT_NAME})
endif()
ament_add_gtest(${PROJECT_NAME}-test_latest_time_policy test/test_latest_time_policy.cpp)
if(TARGET ${PROJECT_NAME}-test_latest_time_policy)
target_link_libraries(${PROJECT_NAME}-test_latest_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} rclcpp::rclcpp ${sensor_msgs_TARGETS})
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} rclcpp::rclcpp ${std_msgs_TARGETS})
endif()
ament_add_gtest(${PROJECT_NAME}-test_input_aligner test/test_input_aligner.cpp)
if(TARGET ${PROJECT_NAME}-test_input_aligner)
target_link_libraries(${PROJECT_NAME}-test_input_aligner ${PROJECT_NAME})
endif()
# python tests with python interfaces of message filters
find_package(ament_cmake_pytest REQUIRED)
ament_add_pytest_test(directed.py "test/directed.py")
ament_add_pytest_test(test_approxsync.py "test/test_approxsync.py")
ament_add_pytest_test(test_message_filters_cache.py "test/test_message_filters_cache.py")
endif()
ament_package()