-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathCMakeLists.txt
97 lines (79 loc) · 2.71 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
# Copyright 2018 Apex.AI, Inc.
# 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.
# Co-developed by Tier IV, Inc. and Apex.AI, Inc.
# Maintained by LeoDrive, 2021
cmake_minimum_required(VERSION 3.14.4)
project(udp_driver)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
## dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
find_package(asio_cmake_module REQUIRED)
find_package(ASIO REQUIRED)
ament_auto_add_library(${PROJECT_NAME} SHARED
src/udp_socket.cpp
src/udp_driver.cpp
)
ament_target_dependencies(${PROJECT_NAME} "ASIO")
ament_auto_add_library(${PROJECT_NAME}_nodes SHARED
src/udp_receiver_node.cpp
src/udp_sender_node.cpp
)
ament_target_dependencies(${PROJECT_NAME}_nodes "ASIO")
target_link_libraries(${PROJECT_NAME}_nodes ${PROJECT_NAME})
rclcpp_components_register_node(${PROJECT_NAME}_nodes
PLUGIN "drivers::udp_driver::UdpReceiverNode"
EXECUTABLE udp_receiver_node_exe
)
rclcpp_components_register_node(${PROJECT_NAME}_nodes
PLUGIN "drivers::udp_driver::UdpSenderNode"
EXECUTABLE udp_sender_node_exe
)
ament_auto_add_executable(udp_bridge_node_exe
src/udp_bridge_node.cpp
)
target_link_libraries(udp_bridge_node_exe ${PROJECT_NAME} ${PROJECT_NAME}_nodes)
ament_target_dependencies(udp_bridge_node_exe ASIO)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
set(TEST_FILES
test_udp_socket.cpp
test_udp_data.cpp
test_udp_driver.cpp
test_udp_driver_nodes.cpp)
foreach(file ${TEST_FILES})
get_filename_component(name "${file}" NAME_WE)
set(TEST_UDP_DRIVER_EXE ${name})
ament_add_gtest(${TEST_UDP_DRIVER_EXE}
test/${name}.cpp)
ament_target_dependencies(${TEST_UDP_DRIVER_EXE}
rclcpp
std_msgs
udp_msgs
lifecycle_msgs
ASIO)
target_include_directories(${TEST_UDP_DRIVER_EXE} PRIVATE include)
target_link_libraries(${TEST_UDP_DRIVER_EXE} ${PROJECT_NAME} ${PROJECT_NAME}_nodes)
endforeach()
endif()
ament_auto_package(
CONFIG_EXTRAS_POST "udp_driver-extras.cmake"
)