fn main() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows")
&& std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc")
{
println!("cargo:rustc-link-arg-bins=/STACK:8388608");
}
println!("cargo:rustc-env=AUBE_BUILD_DATE={}", build_date());
println!("cargo:rerun-if-changed=build.rs");
}
fn build_date() -> String {
let (cmd, args): (&str, &[&str]) = if cfg!(windows) {
(
"powershell",
&[
"-NoProfile",
"-Command",
"(Get-Date).ToUniversalTime().ToString('yyyy-MM-dd')",
],
)
} else {
("date", &["-u", "+%Y-%m-%d"])
};
std::process::Command::new(cmd)
.args(args)
.output()
.ok()
.filter(|o| o.status.success())
.and_then(|o| String::from_utf8(o.stdout).ok())
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty())
.unwrap_or_else(|| "unknown".into())
}