use std::env; use std::path::Path; #[cfg(all(target_os = "linux",target_arch = "x86_64"))] fn main() { println!("cargo:rerun-if-changed=build.rs"); let lib_path = std::fs::canonicalize("./lib").unwrap(); println!("cargo:rustc-link-search={}", lib_path.to_str().unwrap()); println!("cargo:rustc-link-lib=uring-ffi-naiveuring-prebuild"); let bindings = bindgen::builder() .header("include/liburing.h") .allowlist_function("io_uring_queue_init") .allowlist_function("io_uring_queue_exit") .allowlist_function("io_uring_get_sqe") .allowlist_function("io_uring_prep_read") .allowlist_function("io_uring_prep_write") .allowlist_function("io_uring_sqe_set_data") .allowlist_function("io_uring_submit") .allowlist_function("io_uring_wait_cqe") .allowlist_function("io_uring_cqe_seen") .allowlist_function("io_uring_major_version") .allowlist_function("io_uring_minor_version") .generate() .unwrap(); let out_dir = env::var_os("OUT_DIR").unwrap(); let out_path = Path::new(&out_dir).join("bindings.rs"); bindings.write_to_file(out_path).unwrap(); } #[cfg(not(all(target_os = "linux",target_arch = "x86_64")))] fn main() { panic!("platform not supported!"); }