From bb28b4399b8ebd40f03e09f139db1869c5497844 Mon Sep 17 00:00:00 2001 From: Yadu Date: Wed, 2 Aug 2023 17:39:42 +0800 Subject: [PATCH] Link rclcpp_action if required (#10) * Link rclcpp_action if required Signed-off-by: Yadunund * Update CI Signed-off-by: Yadunund * Update test dep Signed-off-by: Yadunund * Try upgrading Signed-off-by: Yadunund --------- Signed-off-by: Yadunund --- .github/workflows/ci.yaml | 7 ++++--- src/cpp/CMakeLists.txt.j2 | 5 ++++- tests/cpp/package.xml | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bcdb012..23ae17d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,11 +11,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - docker_image: ['ros:humble-ros-base', 'ros:galactic-ros-base', 'ros:foxy-ros-base'] + docker_image: ['ros:humble-ros-base'] container: image: ${{ matrix.docker_image }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install rustup dependencies run: | apt update @@ -25,7 +25,8 @@ jobs: toolchain: stable - name: rosdep run: | + apt update && apt upgrade -y rosdep update - rosdep resolve -q ament_cmake std_msgs example_interfaces rclcpp rclcpp_action | sed '/^#/d' | xargs sudo apt install -y + rosdep resolve -q ament_cmake std_msgs example_interfaces | sed '/^#/d' | xargs sudo apt install -y - name: cargo test run: . /ros_entrypoint.sh && cargo test diff --git a/src/cpp/CMakeLists.txt.j2 b/src/cpp/CMakeLists.txt.j2 index 1c04d6a..8ed993a 100644 --- a/src/cpp/CMakeLists.txt.j2 +++ b/src/cpp/CMakeLists.txt.j2 @@ -4,6 +4,9 @@ cmake_minimum_required(VERSION 3.16) project({{project_name}}) find_package(rclcpp REQUIRED) +{% if have_actions -%} +find_package(rclcpp_action REQUIRED) +{%- endif %} find_package(ament_cmake REQUIRED) {%- for pkg in packages %} find_package({{pkg}} REQUIRED) @@ -15,7 +18,7 @@ target_include_directories({{project_name}} INTERFACE {%raw%}${{%endraw%}{{pkg}}_INCLUDE_DIRS} {%- endfor %} ) -target_link_libraries({{project_name}} INTERFACE rclcpp::rclcpp +target_link_libraries({{project_name}} INTERFACE rclcpp::rclcpp {% if have_actions -%} rclcpp_action::rclcpp_action {%- endif %} {%- for pkg in packages %} {%raw%}${{%endraw%}{{pkg}}_LIBRARIES} {%- endfor %} diff --git a/tests/cpp/package.xml b/tests/cpp/package.xml index 52613da..38c7e76 100644 --- a/tests/cpp/package.xml +++ b/tests/cpp/package.xml @@ -8,6 +8,7 @@ Apache License 2.0 rclcpp + rclcpp_action test_api ament_cmake