Merge pull request #743 from tgross35/fix-opt-level

Account for optimization levels other than numbers
This commit is contained in:
Trevor Gross 2025-01-07 18:21:12 -05:00 committed by GitHub
commit 156e12f8d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -121,7 +121,7 @@ fn configure_libm(target: &Target) {
}
println!("cargo:rustc-check-cfg=cfg(optimizations_enabled)");
if target.opt_level >= 2 {
if !matches!(target.opt_level.as_str(), "0" | "1") {
println!("cargo:rustc-cfg=optimizations_enabled");
}

View file

@ -6,7 +6,7 @@ use std::env;
#[allow(dead_code)]
pub struct Target {
pub triple: String,
pub opt_level: u8,
pub opt_level: String,
pub cargo_features: Vec<String>,
pub os: String,
pub arch: String,
@ -32,7 +32,7 @@ impl Target {
Self {
triple: env::var("TARGET").unwrap(),
os: env::var("CARGO_CFG_TARGET_OS").unwrap(),
opt_level: env::var("OPT_LEVEL").unwrap().parse().unwrap(),
opt_level: env::var("OPT_LEVEL").unwrap(),
cargo_features,
arch: env::var("CARGO_CFG_TARGET_ARCH").unwrap(),
vendor: env::var("CARGO_CFG_TARGET_VENDOR").unwrap(),

@ -1 +1 @@
Subproject commit 44770b96920557baf38990d2ee4142e166be579d
Subproject commit 8e82616f154b06cf4ee9cdb82a4f56474a403d04