2020-09-16 18:04:18 +02:00
|
|
|
use bindgen::{Builder, CargoCallbacks};
|
2020-10-23 19:47:57 +02:00
|
|
|
use cc::Build;
|
2020-09-16 18:04:18 +02:00
|
|
|
use std::env;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
fn main() {
|
2020-10-23 19:47:57 +02:00
|
|
|
println!("cargo:rerun-if-changed=setup/setup.h");
|
|
|
|
println!("cargo:rerun-if-changed=setup/setup.c");
|
|
|
|
|
|
|
|
Build::new().file("setup/setup.c").compile("setup");
|
2020-09-16 18:04:18 +02:00
|
|
|
|
|
|
|
let bindings = Builder::default()
|
2020-10-23 19:47:57 +02:00
|
|
|
.header("setup/setup.h")
|
2020-09-16 18:04:18 +02:00
|
|
|
.parse_callbacks(Box::new(CargoCallbacks))
|
|
|
|
.generate()
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
2020-10-23 19:47:57 +02:00
|
|
|
bindings.write_to_file(out_path.join("setup.rs")).unwrap();
|
2020-09-16 18:04:18 +02:00
|
|
|
}
|