Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating header file using cbindgen #54

Open
wants to merge 4 commits into
base: rust
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
269 changes: 260 additions & 9 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions dll/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ crate-type = ["cdylib"]
winvd = { path = "../", features = ["crossbeam-channel"] }
once_cell = "1.5.0"
crossbeam-channel = { version = "0.5" }

[build-dependencies]
cbindgen = "0.24.3"
28 changes: 28 additions & 0 deletions dll/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
extern crate cbindgen;

use cbindgen::Config;
use std::env;
use std::path::Path;

fn main() {
let crate_env = env::var("CARGO_MANIFEST_DIR").unwrap();
let crate_path = Path::new(&crate_env);

let target_env = env::var("OUT_DIR").unwrap();
let target_path = Path::new(&target_env);
let header_path = target_path
.join("..")
.join("..")
.join("..")
.join("VirtualDesktopAccessor.h");

let header_path = header_path.to_str().unwrap();

let config = Config::from_root_or_default(crate_path);
cbindgen::Builder::new()
.with_crate(crate_path.to_str().unwrap())
.with_config(config)
.generate()
.expect("Unable to generate bindings")
.write_to_file(header_path);
}
Loading