Skip to content

Commit

Permalink
Merge pull request #51 from eclipse-zenoh/simplified_load_plugin
Browse files Browse the repository at this point in the history
Simplified load plugin
  • Loading branch information
milyin authored Feb 22, 2024
2 parents fdf9a1a + ec1b4dc commit ecf81c9
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 74 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@

.vscode

# cmake default build directory
build

54 changes: 29 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,12 @@ Once these dependencies are in place, you may clone the repository on your machi
```bash
$ git clone https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds.git
$ cd zenoh-plugin-ros2dds
$ cargo build --release
```
> :warning: **WARNING** :warning: : On Linux, don't use `cargo build` command without specifying a package with `-p`. Building both `zenoh-plugin-ros2dds` (plugin library) and `zenoh-bridge-ros2dds` (standalone executable) together will lead to a `multiple definition of `load_plugin'` error at link time. See [#117](https://github.com/eclipse-zenoh/zenoh-plugin-dds/issues/117#issuecomment-1439694331) for explanations.

You can then choose between building the zenoh bridge for DDS:
- as a plugin library that can be dynamically loaded by the zenoh router (`zenohd`):
```bash
$ cargo build --release -p zenoh-plugin-ros2dds
```
The plugin shared library (`*.so` on Linux, `*.dylib` on Mac OS, `*.dll` on Windows) will be generated in the `target/release` subdirectory.
The standalone executable binary `zenoh-bridge-ros2dds` and a plugin shared library (`*.so` on Linux, `*.dylib` on Mac OS, `*.dll` on Windows) to be dynamically
loaded by the zenoh router `zenohd` will be generated in the `target/release` subdirectory.

- or as a standalone executable binary:
```bash
$ cargo build --release -p zenoh-bridge-ros2dds
```
The **`zenoh-bridge-ros2dds`** binary will be generated in the `target/release` sub-directory.

## ROS 2 package
You can also build `zenoh-bridge-ros2dds` as a ROS package running:
Expand Down
5 changes: 3 additions & 2 deletions zenoh-bridge-ros2dds/src/bridge_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ use crate::zenoh_args::CommonArgs;
use clap::builder::FalseyValueParser;
use zenoh::config::Config;
use zenoh::prelude::*;
use zenoh_plugin_trait::Plugin;

//
// All Bridge arguments
//
#[derive(clap::Parser, Clone, Debug)]
#[command(version=zenoh_plugin_ros2dds::GIT_VERSION,
long_version=zenoh_plugin_ros2dds::LONG_VERSION.as_str(),
#[command(version=zenoh_plugin_ros2dds::ROS2Plugin::PLUGIN_VERSION,
long_version=zenoh_plugin_ros2dds::ROS2Plugin::PLUGIN_LONG_VERSION,
about="Zenoh bridge for ROS 2 with a DDS RMW",
)]
pub struct BridgeArgs {
Expand Down
2 changes: 1 addition & 1 deletion zenoh-bridge-ros2dds/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async fn main() {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("z=info")).init();
log::info!(
"zenoh-bridge-ros2dds {}",
*zenoh_plugin_ros2dds::LONG_VERSION
zenoh_plugin_ros2dds::ROS2Plugin::PLUGIN_LONG_VERSION
);

let (watchdog_period, config) = parse_args();
Expand Down
2 changes: 1 addition & 1 deletion zenoh-plugin-ros2dds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ crate-type = ["cdylib", "rlib"]
[features]
default = ["no_mangle"]
stats = ["zenoh/stats"]
no_mangle = ["zenoh-plugin-trait/no_mangle"]
no_mangle = []
dds_shm = ["cyclors/iceoryx"]

[dependencies]
Expand Down
Loading

0 comments on commit ecf81c9

Please sign in to comment.