blob: 3bd87c09c1d1af8792a8ad4299911fe161ee423c [file] [log] [blame]
use std::env;
use std::path::PathBuf;
fn main() {
// Generate C header bindings.
println!("cargo:rerun-if-changed=wrapper.h");
let bindings = bindgen::Builder::default()
.header("bindings.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate C bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Unable to write bindings.rs");
// Compile C code.
cc::Build::new()
.file("c/swap.c")
.flag("-std=c17")
.compile("swap");
}