Skip to content

Commit

Permalink
Add ROS2 packaging of zenoh-bridge-dds
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Aug 30, 2021
1 parent 66394f0 commit a466f22
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
target
*~
*.log

# ROS2 packaging
build
log
install

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 52 additions & 0 deletions ros2_pkg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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, <zenoh@adlink-labs.tech>
#
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(<dependency> 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()
33 changes: 33 additions & 0 deletions ros2_pkg/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!--
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, <zenoh@adlink-labs.tech>
-->
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>zenoh-bridge-dds</name>
<version>0.5.0</version>
<description>Bridge between ROS2/DDS and Eclipse zenoh</description>
<url>https://github.com/eclipse-zenoh/zenoh-plugin-dds</url>
<maintainer email="zenoh@adlink-labs.tech">ADLINK zenoh team</maintainer>
<license>EPL-2.0</license>
<license>Apache-2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>cargo</build_depend>
<build_depend>clang</build_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>

0 comments on commit a466f22

Please sign in to comment.