-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
26 lines (22 loc) · 855 Bytes
/
build.rs
File metadata and controls
26 lines (22 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::{env, error::Error, path::PathBuf};
fn main() -> Result<(), Box<dyn Error>> {
let bindings = bindgen::builder()
.header("wrapper.h")
.clang_arg("-I./third_party/machine-guest-tools/sys-utils/libcmt/include")
.clang_arg("-I./third_party/machine-guest-tools/sys-utils/libcmt/include/libcmt")
.allowlist_function("cmt_.*")
.allowlist_type("cmt_.*")
.allowlist_var("CMT_.*")
.allowlist_var("HTIF_.*")
.layout_tests(false)
.generate()
.expect("Unable to generate libcmt bindings");
let out_path = PathBuf::from(env::var("OUT_DIR")?);
bindings.write_to_file(out_path.join("bindings.rs"))?;
println!("cargo:rerun-if-changed=wrapper.h");
println!(
"cargo:out-dir={}",
PathBuf::from(env::var("OUT_DIR")?).display()
);
Ok(())
}