Use CARGO_CFG_FEATURE to get feature list in version (#15972)

This commit is contained in:
Piepmatz
2025-06-19 12:58:37 +02:00
committed by GitHub
parent bfa95bbd24
commit 24ab294cda
6 changed files with 86 additions and 62 deletions

View File

@ -1,18 +1,26 @@
#[cfg(windows)]
fn main() {
let mut res = winresource::WindowsResource::new();
res.set("ProductName", "Nushell");
res.set("FileDescription", "Nushell");
res.set("LegalCopyright", "Copyright (C) 2025");
res.set_icon("assets/nu_logo.ico");
res.compile()
.expect("Failed to run the Windows resource compiler (rc.exe)");
}
#[cfg(not(windows))]
fn main() {
// Tango uses dynamic linking, to allow us to dynamically change between two bench suit at runtime.
// This is currently not supported on non nightly rust, on windows.
println!("cargo:rustc-link-arg-benches=-rdynamic");
println!("cargo:rerun-if-changed=scripts/build.rs");
println!(
"cargo:rustc-env=NU_FEATURES={}",
std::env::var("CARGO_CFG_FEATURE").expect("set by cargo")
);
#[cfg(windows)]
{
println!("cargo:rerun-if-changed=assets/nu_logo.ico");
let mut res = winresource::WindowsResource::new();
res.set("ProductName", "Nushell");
res.set("FileDescription", "Nushell");
res.set("LegalCopyright", "Copyright (C) 2025");
res.set_icon("assets/nu_logo.ico");
res.compile()
.expect("Failed to run the Windows resource compiler (rc.exe)");
}
#[cfg(not(windows))]
{
// Tango uses dynamic linking, to allow us to dynamically change between two bench suit at runtime.
// This is currently not supported on non nightly rust, on windows.
println!("cargo:rustc-link-arg-benches=-rdynamic");
}
}