Crates.io | orbit2-buildtools |
lib.rs | orbit2-buildtools |
version | 0.1.1-alpha.2 |
source | src |
created_at | 2024-06-25 12:09:21.054234 |
updated_at | 2024-06-26 19:19:05.571394 |
description | Some tools to build some Corba binding from IDLs using orbit2-sys |
homepage | https://github.com/jeteve/orbit2-rs |
repository | |
max_upload_size | |
id | 1283270 |
size | 15,569 |
For the rest of this readme, we assume that your library containing your IDLs binding
is called $PROJECT_IDLS_NAME
. We'll also work from an example echo.idl
to illustrate how to build
the binding.
cargo new --lib $PROJECT_IDLS_NAME
cd $PROJECT_IDLS_NAME
Cargo.toml
, as well as orbit2-sys as a standard dependency[dependencies]
orbit2-sys = ">=0.1.0"
[build-dependencies]
orbit2-buildtools = ">=0.1.0"
$ mkdir static/
# And put your IDL(s?), for instance:
$ cat static/echo.idl
interface Echo {
void echoString(in string input);
};
build.rs
to compile the idlExample build.rs
(assuming echo.idl)
use std::path::PathBuf;
use orbit2_buildtools::CommonBuilder;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let idl_path = PathBuf::from("static/echo.idl");
let out_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
// generate the C code plus the Rust binding
// Note the name of the service is the toplevel name in your IDL
let r = CommonBuilder::new("Echo")
.idl_file(&idl_path)
.out_path(&out_path)
.generate()?;
// make the binding path available in the rest of the compilation
println!(
"cargo:rustc-env=ECHO_IDL_BINDING={:?}",
r.binding_file.as_path()
);
Ok(())
}
use orbit2_sys::core::*;
include!(env!("ECHO_IDL_BINDING"));
And that's it. Now you can use your module in your client and server applications.