use std::env; use std::error::Error; use std::path::PathBuf; use bindgen::MacroTypeVariation; fn main() -> Result<(), Box> { println!("cargo:rustc-link-lib=glfw"); println!("cargo:rerun-if-changed=glfw.h"); let bindings = bindgen::Builder::default() .header("glfw.h") .clang_arg("-fretain-comments-from-system-headers") .generate_comments(true) .allowlist_function("glfw.*") .allowlist_type("GLFW.*") .allowlist_var("GLFW.*") .default_macro_constant_type(MacroTypeVariation::Signed) .generate()?; let out_path = PathBuf::from(env::var("OUT_DIR")?); bindings.write_to_file(out_path.join("bindings.rs"))?; Ok(()) }