-
Notifications
You must be signed in to change notification settings - Fork 279
/
CMakeLists.txt
153 lines (130 loc) · 3.74 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
150
151
152
153
cmake_minimum_required(VERSION 3.0.2)
project(tf2_ros)
if(NOT ANDROID)
set(TF2_PY tf2_py)
endif()
find_package(catkin REQUIRED COMPONENTS
actionlib
actionlib_msgs
geometry_msgs
message_filters
roscpp
rosgraph
rospy
tf2
tf2_msgs
${TF2_PY}
)
find_package(Boost REQUIRED COMPONENTS thread)
catkin_python_setup()
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS
actionlib
actionlib_msgs
geometry_msgs
message_filters
roscpp
rosgraph
tf2
tf2_msgs
${TF2_PY}
)
include_directories(include ${catkin_INCLUDE_DIRS})
# tf2_ros library
add_library(${PROJECT_NAME}
src/buffer.cpp
src/transform_listener.cpp
src/buffer_client.cpp
src/buffer_server.cpp
src/transform_broadcaster.cpp
src/static_transform_broadcaster.cpp
)
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
# buffer_server executable
add_executable(${PROJECT_NAME}_buffer_server src/buffer_server_main.cpp)
add_dependencies(${PROJECT_NAME}_buffer_server ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_buffer_server
${PROJECT_NAME}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
set_target_properties(${PROJECT_NAME}_buffer_server
PROPERTIES OUTPUT_NAME buffer_server
)
# static_transform_publisher
add_executable(${PROJECT_NAME}_static_transform_publisher
src/static_transform_broadcaster_program.cpp
)
add_dependencies(${PROJECT_NAME}_static_transform_publisher ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_static_transform_publisher
${PROJECT_NAME}
${catkin_LIBRARIES}
)
set_target_properties(${PROJECT_NAME}_static_transform_publisher
PROPERTIES OUTPUT_NAME static_transform_publisher
)
# Install library
install(TARGETS
${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
# Install executable
install(TARGETS
${PROJECT_NAME}_buffer_server ${PROJECT_NAME}_static_transform_publisher
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
# Tests
if(CATKIN_ENABLE_TESTING)
# new requirements for testing
find_package(catkin REQUIRED COMPONENTS
actionlib
actionlib_msgs
geometry_msgs
message_filters
roscpp
rosgraph
rospy
rostest
tf2
tf2_msgs
${TF2_PY}
)
# tf2_ros_test_listener
add_executable(${PROJECT_NAME}_test_listener EXCLUDE_FROM_ALL test/listener_unittest.cpp)
add_dependencies(${PROJECT_NAME}_test_listener ${catkin_EXPORTED_TARGETS})
add_executable(${PROJECT_NAME}_test_time_reset EXCLUDE_FROM_ALL test/time_reset_test.cpp)
add_dependencies(${PROJECT_NAME}_test_time_reset ${catkin_EXPORTED_TARGETS})
add_executable(${PROJECT_NAME}_test_message_filter EXCLUDE_FROM_ALL test/message_filter_test.cpp)
add_dependencies(${PROJECT_NAME}_test_message_filter ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}_test_listener
${PROJECT_NAME}
${catkin_LIBRARIES}
${GTEST_LIBRARIES}
)
target_link_libraries(${PROJECT_NAME}_test_time_reset
${PROJECT_NAME}
${catkin_LIBRARIES}
${GTEST_LIBRARIES}
)
target_link_libraries(${PROJECT_NAME}_test_message_filter
${PROJECT_NAME}
${catkin_LIBRARIES}
${GTEST_LIBRARIES}
)
add_dependencies(tests ${PROJECT_NAME}_test_listener)
add_dependencies(tests ${PROJECT_NAME}_test_time_reset)
add_dependencies(tests ${PROJECT_NAME}_test_message_filter)
add_rostest(test/transform_listener_unittest.launch)
add_rostest(test/transform_listener_time_reset_test.launch)
add_rostest(test/message_filter_test.launch)
endif()