// requires treelite header files to be found by path: /usr/local/include/treelite fn main() { println!("cargo:rustc-link-lib=treelite"); println!("cargo:rustc-link-lib=treelite_runtime"); println!("cargo:rustc-link-search=native=/usr/local/lib"); println!("cargo:rerun-if-changed=wrapper.h"); let bindings = bindgen::Builder::default() .header("wrapper.h") .clang_arg("-Iheaders/treelite") // Tell cargo to invalidate the built crate whenever any of the // included header files changed. .parse_callbacks(Box::new(bindgen::CargoCallbacks)) // Finish the builder and generate the bindings. .generate() // Unwrap the Result and panic on failure. .expect("Unable to generate bindings"); // Write the bindings to the $OUT_DIR/bindings.rs file. bindings .write_to_file("src/bindings.rs") .expect("Couldn't write bindings!"); }