fix: support ROS 2 message exports for MKMini build
This commit is contained in:
@@ -2,10 +2,8 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
project(vanjee_lidar_sdk)
|
project(vanjee_lidar_sdk)
|
||||||
|
|
||||||
#=======================================
|
# Colcon packages must use the same configuration as generated ROS message
|
||||||
# Compile Type (Release, Debug)
|
# targets. Forcing Release here makes vanjee_lidar_msg exports incompatible.
|
||||||
#=======================================
|
|
||||||
set(CMAKE_BUILD_TYPE "Release")
|
|
||||||
|
|
||||||
#=======================================
|
#=======================================
|
||||||
# Custom Point Type (XYZI, XYZIRT)
|
# Custom Point Type (XYZI, XYZIRT)
|
||||||
@@ -105,8 +103,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
|||||||
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
message("buile type: Debug")
|
message("buile type: Debug")
|
||||||
else ()
|
else ()
|
||||||
set(CMAKE_BUILD_TYPE "Release")
|
message("buile type: Default")
|
||||||
message("buile type: Release")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if($ENV{ROS_DISTRO} STREQUAL "humble") # the ros2 humble requires c++17
|
if($ENV{ROS_DISTRO} STREQUAL "humble") # the ros2 humble requires c++17
|
||||||
@@ -203,9 +200,21 @@ if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON")
|
|||||||
|
|
||||||
find_package(ament_cmake REQUIRED)
|
find_package(ament_cmake REQUIRED)
|
||||||
find_package(sensor_msgs REQUIRED)
|
find_package(sensor_msgs REQUIRED)
|
||||||
find_package(vanjee_lidar_msg REQUIRED)
|
|
||||||
find_package(std_msgs REQUIRED)
|
find_package(std_msgs REQUIRED)
|
||||||
|
|
||||||
|
# The vendor package exports only NOCONFIG imported targets, which breaks
|
||||||
|
# find_package() when its nested driver selects Release. Use its generated
|
||||||
|
# message header and C++ typesupport library directly instead.
|
||||||
|
find_path(VANJEE_LIDAR_MSG_INCLUDE_DIR
|
||||||
|
NAMES vanjee_lidar_msg/msg/device_ctrl.hpp
|
||||||
|
PATH_SUFFIXES include/vanjee_lidar_msg)
|
||||||
|
find_library(VANJEE_LIDAR_MSG_TYPESUPPORT_CPP
|
||||||
|
NAMES vanjee_lidar_msg__rosidl_typesupport_cpp)
|
||||||
|
if(NOT VANJEE_LIDAR_MSG_INCLUDE_DIR OR NOT VANJEE_LIDAR_MSG_TYPESUPPORT_CPP)
|
||||||
|
message(FATAL_ERROR "vanjee_lidar_msg generated headers or typesupport library were not found")
|
||||||
|
endif()
|
||||||
|
include_directories(${VANJEE_LIDAR_MSG_INCLUDE_DIR})
|
||||||
|
|
||||||
else(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON")
|
else(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON")
|
||||||
|
|
||||||
message(=============================================================)
|
message(=============================================================)
|
||||||
@@ -236,7 +245,8 @@ add_executable(vanjee_lidar_sdk_node
|
|||||||
|
|
||||||
target_link_libraries(vanjee_lidar_sdk_node
|
target_link_libraries(vanjee_lidar_sdk_node
|
||||||
${YAML_CPP_LIBRARIES}
|
${YAML_CPP_LIBRARIES}
|
||||||
${vanjee_driver_LIBRARIES})
|
${vanjee_driver_LIBRARIES}
|
||||||
|
${VANJEE_LIDAR_MSG_TYPESUPPORT_CPP})
|
||||||
|
|
||||||
if(${ENABLE_TBB})
|
if(${ENABLE_TBB})
|
||||||
target_link_libraries(vanjee_lidar_sdk_node
|
target_link_libraries(vanjee_lidar_sdk_node
|
||||||
@@ -281,8 +291,7 @@ if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON")
|
|||||||
ament_target_dependencies(vanjee_lidar_sdk_node
|
ament_target_dependencies(vanjee_lidar_sdk_node
|
||||||
rclcpp
|
rclcpp
|
||||||
std_msgs
|
std_msgs
|
||||||
sensor_msgs
|
sensor_msgs)
|
||||||
vanjee_lidar_msg)
|
|
||||||
|
|
||||||
install(TARGETS
|
install(TARGETS
|
||||||
vanjee_lidar_sdk_node
|
vanjee_lidar_sdk_node
|
||||||
@@ -298,6 +307,3 @@ if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON")
|
|||||||
ament_package()
|
ament_package()
|
||||||
|
|
||||||
endif(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON")
|
endif(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,18 @@ find_package(nav2_msgs REQUIRED)
|
|||||||
find_package(tf2_msgs REQUIRED)
|
find_package(tf2_msgs REQUIRED)
|
||||||
find_package(tf2_ros REQUIRED)
|
find_package(tf2_ros REQUIRED)
|
||||||
find_package(sensor_msgs REQUIRED)
|
find_package(sensor_msgs REQUIRED)
|
||||||
find_package(yhs_can_interfaces REQUIRED)
|
|
||||||
|
# yhs_can_interfaces is generated in the same isolated colcon workspace.
|
||||||
|
# Its vendor export exposes only NOCONFIG imported targets, so use the
|
||||||
|
# generated headers and C++ typesupport library directly.
|
||||||
|
find_path(YHS_CAN_INTERFACES_INCLUDE_DIR
|
||||||
|
NAMES yhs_can_interfaces/msg/io_cmd.hpp
|
||||||
|
PATH_SUFFIXES include/yhs_can_interfaces)
|
||||||
|
find_library(YHS_CAN_INTERFACES_TYPESUPPORT_CPP
|
||||||
|
NAMES yhs_can_interfaces__rosidl_typesupport_cpp)
|
||||||
|
if(NOT YHS_CAN_INTERFACES_INCLUDE_DIR OR NOT YHS_CAN_INTERFACES_TYPESUPPORT_CPP)
|
||||||
|
message(FATAL_ERROR "yhs_can_interfaces generated headers or typesupport library were not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# 1. YHS Control Node (기존 드라이버)
|
# 1. YHS Control Node (기존 드라이버)
|
||||||
@@ -23,7 +34,8 @@ add_executable(yhs_can_control_node src/yhs_can_control_node.cpp)
|
|||||||
|
|
||||||
target_include_directories(yhs_can_control_node PUBLIC
|
target_include_directories(yhs_can_control_node PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:include>)
|
$<INSTALL_INTERFACE:include>
|
||||||
|
${YHS_CAN_INTERFACES_INCLUDE_DIR})
|
||||||
|
|
||||||
target_compile_features(yhs_can_control_node PUBLIC c_std_99 cxx_std_17)
|
target_compile_features(yhs_can_control_node PUBLIC c_std_99 cxx_std_17)
|
||||||
|
|
||||||
@@ -35,9 +47,11 @@ ament_target_dependencies(yhs_can_control_node
|
|||||||
tf2_msgs
|
tf2_msgs
|
||||||
tf2_ros
|
tf2_ros
|
||||||
sensor_msgs
|
sensor_msgs
|
||||||
yhs_can_interfaces
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(yhs_can_control_node
|
||||||
|
${YHS_CAN_INTERFACES_TYPESUPPORT_CPP})
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# 2. Mini Bridge Node (추가된 Translator)
|
# 2. Mini Bridge Node (추가된 Translator)
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user