use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=io_uring.h");
let header = manifest().join("io_uring.h").to_str().unwrap().to_string();
let bindings = out_dir().join("bindings.rs").to_str().unwrap().to_string();
bindgen::builder()
.header(&header)
.allowlist_file(&header)
.use_core()
.anon_fields_prefix("anonymous")
.default_enum_style(bindgen::EnumVariation::ModuleConsts)
.default_non_copy_union_style(bindgen::NonCopyUnionStyle::ManuallyDrop)
.explicit_padding(true)
.derive_copy(true)
.derive_debug(true)
.derive_default(false)
.generate()
.unwrap()
.write_to_file(bindings)
.unwrap();
}
fn manifest() -> PathBuf {
std::path::Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap())
.canonicalize()
.unwrap()
}
fn out_dir() -> PathBuf {
std::path::Path::new(&std::env::var("OUT_DIR").unwrap())
.canonicalize()
.unwrap()
}