blob: 7b5130d88234ba987217052fca01f9ae229aa73d [file] [log] [blame]
use std::env;
use std::path::PathBuf;
fn main() {
// Generate C header bindings.
println!("cargo:rerun-if-changed=bindings.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");
}