Skip to content

Commit

Permalink
iox-#5 Add RuDiEnvironment for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jun 20, 2022
1 parent d0813f9 commit 1e729d2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fn make_and_install(source_dir: &str, build_dir: &str, install_dir: &str) -> std
.args(&[
"-DCMAKE_BUILD_TYPE=Release",
"-DBUILD_SHARED_LIBS=OFF",
"-DROUDI_ENVIRONMENT=ON",
&cmake_prefix_path,
&cmake_install_prefix,
&component_source_dir,
Expand Down Expand Up @@ -136,14 +137,20 @@ fn main() -> std::io::Result<()> {

println!("cargo:rustc-link-search={}", iceoryx_lib_dir);

println!("cargo:rustc-link-lib=iceoryx_posh_testing");

println!("cargo:rustc-link-lib=iceoryx_posh_roudi");
println!("cargo:rustc-link-lib=iceoryx_posh");
println!("cargo:rustc-link-lib=iceoryx_hoofs");
println!("cargo:rustc-link-lib=iceoryx_platform");

println!("cargo:rustc-link-lib=acl");

#[cfg(not(any(target_os = "windows", target_os = "macos")))]
println!("cargo:rustc-link-lib=stdc++");
#[cfg(any(target_os = "macos"))]
println!("cargo:rustc-link-lib=c++");


Ok(())
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ extern crate cpp;

mod error;
mod runtime;
mod testing;

pub mod introspection;
pub mod pb;
Expand Down
8 changes: 8 additions & 0 deletions src/testing/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: © Contributors to the iceoryx-rs project
// SPDX-FileContributor: Mathias Kraus

mod roudi_environment_ffi;

// re-exports
pub (crate) use roudi_environment_ffi::RouDiEnvironment;
24 changes: 24 additions & 0 deletions src/testing/roudi_environment_ffi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: © Contributors to the iceoryx-rs project
// SPDX-FileContributor: Mathias Kraus

cpp! {{
#include "iceoryx_posh/testing/roudi_environment/roudi_environment.hpp"

using iox::roudi::RouDiEnvironment;
}}

cpp_class!(pub unsafe struct RouDiEnvironment as "RouDiEnvironment");

impl RouDiEnvironment {
pub(crate) fn new() -> Box<Self> {
unsafe {
let raw = cpp!([] -> *mut RouDiEnvironment as "RouDiEnvironment*"
{
return new RouDiEnvironment();
});

Box::from_raw(raw)
}
}
}

0 comments on commit 1e729d2

Please sign in to comment.