Skip to content

Commit

Permalink
Merge pull request #168 from eclipse-zenoh/simplified_load_plugin
Browse files Browse the repository at this point in the history
new plugin API update
  • Loading branch information
milyin authored Feb 22, 2024
2 parents de7ad3b + f3f907f commit 817c93f
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 80 deletions.
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.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ members = ["zenoh-bridge-dds", "zenoh-plugin-dds"]
[workspace.package]
version = "0.11.0-dev"
authors = [
"kydos <[email protected]>",
"Esteve Fernandez <[email protected]>",
"Julien Enoch <[email protected]>",
"Pierre Avital <[email protected]>",
"kydos <[email protected]>",
"Esteve Fernandez <[email protected]>",
"Julien Enoch <[email protected]>",
"Pierre Avital <[email protected]>",
]
edition = "2021"
repository = "https://github.com/eclipse-zenoh/zenoh-plugin-dds"
Expand Down
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,11 @@ Once these dependencies are in place, you may clone the repository on your machi
```bash
$ git clone https://github.com/eclipse-zenoh/zenoh-plugin-dds.git
$ cd zenoh-plugin-dds
$ cargo build --release
```
> :warning: **WARNING** :warning: : On Linux, don't use `cargo build` command without specifying a package with `-p`. Building both `zenoh-plugin-dds` (plugin library) and `zenoh-bridge-dds` (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-dds
```
The plugin shared library (`*.so` on Linux, `*.dylib` on Mac OS, `*.dll` on Windows) will be generated in the `target/release` subdirectory.

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

The standalone executable binary `zenoh-bridge-dds` 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.

### Enabling Cyclone DDS Shared Memory Support

Expand Down
8 changes: 5 additions & 3 deletions zenoh-bridge-dds/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use std::str::FromStr;
use std::time::{Duration, SystemTime};
use zenoh::config::{Config, ModeDependentValue};
use zenoh::prelude::*;
use zenoh_plugin_dds::DDSPlugin;
use zenoh_plugin_trait::Plugin;

lazy_static::lazy_static!(
pub static ref DEFAULT_DOMAIN_STR: String = zenoh_plugin_dds::config::DEFAULT_DOMAIN.to_string();
Expand All @@ -42,8 +44,8 @@ macro_rules! insert_json5 {

fn parse_args() -> (Config, Option<f32>) {
let mut app = App::new("zenoh bridge for DDS")
.version(zenoh_plugin_dds::GIT_VERSION)
.long_version(zenoh_plugin_dds::LONG_VERSION.as_str())
.version(DDSPlugin::PLUGIN_VERSION)
.long_version(DDSPlugin::PLUGIN_LONG_VERSION)
//
// zenoh related arguments:
//
Expand Down Expand Up @@ -234,7 +236,7 @@ r#"--watchdog=[PERIOD] 'Experimental!! Run a watchdog thread that monitors the
#[async_std::main]
async fn main() {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("z=info")).init();
log::info!("zenoh-bridge-dds {}", *zenoh_plugin_dds::LONG_VERSION);
log::info!("zenoh-bridge-dds {}", DDSPlugin::PLUGIN_LONG_VERSION);

let (config, watchdog_period) = parse_args();
let rest_plugin = config.plugin("rest").is_some();
Expand Down
2 changes: 1 addition & 1 deletion zenoh-plugin-dds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ crate-type = ["cdylib", "rlib"]

[features]
default = ["no_mangle"]
no_mangle = ["zenoh-plugin-trait/no_mangle"]
no_mangle = []
dds_shm = ["cyclors/iceoryx"]
stats = ["zenoh/stats"]

Expand Down
Loading

0 comments on commit 817c93f

Please sign in to comment.