Skip to content

Commit 1b8f5cb

Browse files
Fix livox_ros_driver2 Jazzy CMake generation (#7)
* fix: update CMake policies and improve message target linking for ROS2 * Update ROS distribution to include 'jazzy' * Update Docker image from 'jammy' to 'noble' * Fix comment: update ROS distribution from Iron Irwini to Jazzy Jalisco * Add C++ flags to CMake command in CI workflow * Update ros-ci.yml --------- Co-authored-by: Marc Hanheide <marc@hanheide.net>
1 parent 38a04a0 commit 1b8f5cb

2 files changed

Lines changed: 24 additions & 16 deletions

File tree

.github/workflows/ros-ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
ros_distribution:
1717
# - noetic
1818
- humble
19-
# - iron
19+
- jazzy
2020

2121
# Define the Docker image(s) associated with each ROS distribution.
2222
# The include syntax allows additional variables to be defined, like
@@ -37,10 +37,10 @@ jobs:
3737
ros_distribution: humble
3838
ros_version: 2
3939

40-
# Iron Irwini (May 2023 - November 2024)
41-
# - docker_image: ubuntu:jammy
42-
# ros_distribution: iron
43-
# ros_version: 2
40+
# Jazzy Jalisco (May 2024 - May 2029)
41+
- docker_image: ubuntu:noble
42+
ros_distribution: jazzy
43+
ros_version: 2
4444

4545
# # Rolling Ridley (No End-Of-Life)
4646
# - docker_image: ubuntu:jammy
@@ -63,10 +63,10 @@ jobs:
6363
run: |
6464
REPO_DIR="/tmp/livox_sdk2_repo"
6565
mkdir -p "$REPO_DIR"
66-
git clone --branch v1.2.5 --depth 1 https://github.com/Livox-SDK/Livox-SDK2.git "$REPO_DIR/Livox-SDK2"
66+
git clone --branch v0.0.1 --depth 1 https://github.com/LCAS/Livox-SDK2.git "$REPO_DIR/Livox-SDK2"
6767
cd "$REPO_DIR/Livox-SDK2"
6868
mkdir -p build && cd build
69-
cmake ..
69+
cmake -DCMAKE_CXX_FLAGS="-include cstdint" ..
7070
make -j$(nproc)
7171
make install
7272
ldconfig

CMakeLists.txt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ else(ROS_EDITION STREQUAL "ROS2")
210210
# Copyright(c) 2020 livoxtech limited.
211211

212212
cmake_minimum_required(VERSION 3.14)
213+
if(POLICY CMP0144)
214+
cmake_policy(SET CMP0144 NEW)
215+
set(CMAKE_POLICY_DEFAULT_CMP0144 NEW)
216+
endif()
213217
project(livox_ros_driver2)
214218

215219
# Default to C99
@@ -302,23 +306,27 @@ else(ROS_EDITION STREQUAL "ROS2")
302306

303307
target_include_directories(${PROJECT_NAME} PRIVATE ${livox_sdk_INCLUDE_DIRS})
304308

305-
# get include directories of custom msg headers
306-
if(HUMBLE_ROS STREQUAL "humble")
307-
rosidl_get_typesupport_target(cpp_typesupport_target
308-
${LIVOX_INTERFACES} "rosidl_typesupport_cpp")
309-
target_link_libraries(${PROJECT_NAME} "${cpp_typesupport_target}")
309+
# Link the generated custom message target. The generated target carries the
310+
# include directories for livox_ros_driver2/msg/*.hpp on ROS 2 distros such as
311+
# Humble and Jazzy, so do not read INTERFACE_INCLUDE_DIRECTORIES directly.
312+
if(COMMAND rosidl_get_typesupport_target)
313+
rosidl_get_typesupport_target(LIVOX_INTERFACE_TARGET
314+
${LIVOX_INTERFACES} "rosidl_typesupport_cpp")
310315
else()
311316
set(LIVOX_INTERFACE_TARGET "${LIVOX_INTERFACES}__rosidl_typesupport_cpp")
312-
add_dependencies(${PROJECT_NAME} ${LIVOX_INTERFACES})
313-
get_target_property(LIVOX_INTERFACES_INCLUDE_DIRECTORIES ${LIVOX_INTERFACE_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
314317
endif()
315318

319+
if(NOT LIVOX_INTERFACE_TARGET OR NOT TARGET ${LIVOX_INTERFACE_TARGET})
320+
message(FATAL_ERROR "Failed to resolve ${LIVOX_INTERFACES} C++ typesupport target")
321+
endif()
322+
323+
add_dependencies(${PROJECT_NAME} ${LIVOX_INTERFACES})
324+
316325
# include file direcotry
317326
target_include_directories(${PROJECT_NAME} PUBLIC
318327
${PCL_INCLUDE_DIRS}
319328
${APR_INCLUDE_DIRS}
320329
${LIVOX_LIDAR_SDK_INCLUDE_DIR}
321-
${LIVOX_INTERFACES_INCLUDE_DIRECTORIES} # for custom msgs
322330
3rdparty
323331
src
324332
)
@@ -367,4 +375,4 @@ else(ROS_EDITION STREQUAL "ROS2")
367375
launch
368376
)
369377

370-
endif()
378+
endif()

0 commit comments

Comments
 (0)