1
0
Files
wfassoc/wfassoc-cdylib/build.rs
2026-05-15 17:02:29 +08:00

24 lines
738 B
Rust

extern crate cbindgen;
use std::{env, path::Path};
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let crate_dir_path = Path::new(&crate_dir);
let cbindgen_toml_path = crate_dir_path.join("cbindgen.toml");
let cbindgen_config = cbindgen::Config::from_file(cbindgen_toml_path)
.expect("Unable to load cbindgen configuration file.");
let out_dir = env::var("OUT_DIR").unwrap();
let out_dir_path = Path::new(&out_dir);
let wfassoc_h_path = out_dir_path.join("wfassoc.h");
cbindgen::Builder::new()
.with_crate(crate_dir)
.with_config(cbindgen_config)
.generate()
.expect("Unable to generate bindings")
.write_to_file(wfassoc_h_path);
}