From a466f226765cb4051a368870ba34fad5d5b9f523 Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Mon, 30 Aug 2021 17:21:11 +0200 Subject: [PATCH] Add ROS2 packaging of zenoh-bridge-dds --- .gitignore | 6 +++++ README.md | 8 +++++++ ros2_pkg/CMakeLists.txt | 52 +++++++++++++++++++++++++++++++++++++++++ ros2_pkg/package.xml | 33 ++++++++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 ros2_pkg/CMakeLists.txt create mode 100644 ros2_pkg/package.xml diff --git a/.gitignore b/.gitignore index e7dc3101..a11aa22e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ target *~ *.log + +# ROS2 packaging +build +log +install + diff --git a/README.md b/README.md index e845ba50..388b71e6 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,14 @@ $ cargo build --release ``` The **`zenoh-bridge-dds`** binary will be generated in the `target/release` sub-directory. +### ROS2 package +If you're a ROS2 user, you can also build `zenoh-bridge-dds` as a ROS package running: +```bash +rosdep install --from-paths . --ignore-src -r -y +colcon build --packages-select zenoh-bridge-dds +``` +The `rosdep` command will automatically install *Rust* and *clang* as build dependencies. + ## Docker image The **`zenoh-bridge-dds`** standalone executable is also available as a [Docker images](https://hub.docker.com/r/eclipse/zenoh-bridge-dds/tags?page=1&ordering=last_updated) for both amd64 and arm64. To get it, do: - `docker pull eclipse/zenoh-bridge-dds:master` for the master branch version diff --git a/ros2_pkg/CMakeLists.txt b/ros2_pkg/CMakeLists.txt new file mode 100644 index 00000000..373695d3 --- /dev/null +++ b/ros2_pkg/CMakeLists.txt @@ -0,0 +1,52 @@ +# +# Copyright (c) 2017, 2020 ADLINK Technology Inc. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +# which is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +# +# Contributors: +# ADLINK zenoh team, +# +cmake_minimum_required(VERSION 3.8) +project(zenoh-bridge-dds) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +set(RUST_PROJECT_DIR "${CMAKE_SOURCE_DIR}/../zenoh-bridge-dds") +set(RUST_TARGET_DIR ${CMAKE_BINARY_DIR}/target) + +FILE(GLOB RUST_SRC_FILES ${RUST_PROJECT_DIR}/src/*.rs ${RUST_PROJECT_DIR}/../zplugin-dds/src/*.rs) + +add_custom_command( + OUTPUT + ${RUST_TARGET_DIR}/release/zenoh-bridge-dds + COMMAND cargo build --release --manifest-path "${RUST_PROJECT_DIR}/Cargo.toml" --target-dir "${RUST_TARGET_DIR}" + DEPENDS + ${RUST_SRC_FILES} +) + +add_custom_target( + build_crate ALL + DEPENDS + ${RUST_TARGET_DIR}/release/zenoh-bridge-dds +) + +install(FILES + ${RUST_TARGET_DIR}/release/zenoh-bridge-dds + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + DESTINATION lib/${PROJECT_NAME} +) + +ament_package() diff --git a/ros2_pkg/package.xml b/ros2_pkg/package.xml new file mode 100644 index 00000000..ace1e3c2 --- /dev/null +++ b/ros2_pkg/package.xml @@ -0,0 +1,33 @@ + + + + + zenoh-bridge-dds + 0.5.0 + Bridge between ROS2/DDS and Eclipse zenoh + https://github.com/eclipse-zenoh/zenoh-plugin-dds + ADLINK zenoh team + EPL-2.0 + Apache-2.0 + + ament_cmake + + cargo + clang + + + ament_cmake + +