fn main() {
for name in ["ring", "port", "completion", "readiness", "precise_timer"] {
println!("cargo::rustc-check-cfg=cfg({name})");
}
let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let unix = std::env::var("CARGO_CFG_UNIX").is_ok();
let iouring = std::env::var("CARGO_FEATURE_IOURING").is_ok();
let ring = iouring && (os == "linux" || os == "android");
let port = os == "windows";
let set = |name: &str, on: bool| {
if on {
println!("cargo::rustc-cfg={name}");
}
};
set("ring", ring);
set("port", port);
set("completion", ring || port);
set("readiness", unix);
set(
"precise_timer",
matches!(os.as_str(), "macos" | "ios" | "freebsd" | "netbsd"),
);
}