use std::env;
use std::path::PathBuf;
const CSRC: &str = "csrc";
fn main() {
cc::Build::new()
.file(format!("{CSRC}/splinter.c"))
.include(CSRC)
.warnings(false)
.compile("splinter");
for f in ["splinter.c", "splinter.h", "config.h", "build.h"] {
println!("cargo:rerun-if-changed={CSRC}/{f}");
}
println!("cargo:rerun-if-changed=build.rs");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("bindings.rs");
bindgen::Builder::default()
.header(format!("{CSRC}/splinter.h"))
.clang_arg(format!("-I{CSRC}"))
.generate()
.expect("unable to generate splinter bindings")
.write_to_file(&out_path)
.expect("couldn't write splinter bindings");
}