extern crate bindgen; use std::env; use std::path::PathBuf; fn main() { println!("cargo:rustc-link-lib=knot"); let bindings = bindgen::Builder::default() .header("/usr/include/libknot/libknot.h") .whitelist_type("knot_.*") .whitelist_function("knot_.*") .whitelist_var("(KNOT|knot)_.*") .rustified_enum(".*_idx_t") .raw_line("#[allow(bad_style)]") .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("Could not write bindings"); }