fn main() {
println!("cargo::rustc-check-cfg=cfg(exec_backend)");
println!("cargo::rustc-check-cfg=cfg(tokio_backend)");
println!("cargo::rustc-check-cfg=cfg(epics_embedded_target)");
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
let embedded_target = matches!(target_os.as_str(), "rtems" | "vxworks");
if embedded_target {
println!("cargo::rustc-cfg=epics_embedded_target");
}
println!("cargo::rerun-if-env-changed=EPICS_RS_BUILD_EXEC_BACKEND");
let requested = std::env::var_os("EPICS_RS_BUILD_EXEC_BACKEND").unwrap_or_default();
let host_exec_backend = match requested.to_string_lossy().as_ref() {
"thread" => true,
"" | "tokio" => false,
bad => panic!(
"EPICS_RS_BUILD_EXEC_BACKEND={bad}: the exec backend is `thread` \
(reactor-free std threads) or `tokio` (the host default, which an \
unset or empty variable also selects)"
),
};
if embedded_target || host_exec_backend {
println!("cargo::rustc-cfg=exec_backend");
} else {
println!("cargo::rustc-cfg=tokio_backend");
}
}