use std::env; use std::path::PathBuf; fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rustc-link-search=native=m"); cc::Build::new() .flag_if_supported("/std:c17") .flag_if_supported("-std=c17") .flag_if_supported("-w") .file("s7/s7.c") .compile("s7"); let bindings = bindgen::Builder::default() .header("wrapper.h") .generate() .expect("Unable to generate bindings"); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); bindings .write_to_file(out_path.join("bindings.rs")) .expect("Couldn't write bindings!"); }