Skip to content

Commit 288a33f

Browse files
authored
Merge pull request #743 from tgross35/fix-opt-level
Account for optimization levels other than numbers
2 parents 280c7b1 + 4e3cc6d commit 288a33f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn configure_libm(target: &Target) {
121121
}
122122

123123
println!("cargo:rustc-check-cfg=cfg(optimizations_enabled)");
124-
if target.opt_level >= 2 {
124+
if !matches!(target.opt_level.as_str(), "0" | "1") {
125125
println!("cargo:rustc-cfg=optimizations_enabled");
126126
}
127127

configure.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::env;
66
#[allow(dead_code)]
77
pub struct Target {
88
pub triple: String,
9-
pub opt_level: u8,
9+
pub opt_level: String,
1010
pub cargo_features: Vec<String>,
1111
pub os: String,
1212
pub arch: String,
@@ -32,7 +32,7 @@ impl Target {
3232
Self {
3333
triple: env::var("TARGET").unwrap(),
3434
os: env::var("CARGO_CFG_TARGET_OS").unwrap(),
35-
opt_level: env::var("OPT_LEVEL").unwrap().parse().unwrap(),
35+
opt_level: env::var("OPT_LEVEL").unwrap(),
3636
cargo_features,
3737
arch: env::var("CARGO_CFG_TARGET_ARCH").unwrap(),
3838
vendor: env::var("CARGO_CFG_TARGET_VENDOR").unwrap(),

0 commit comments

Comments
 (0)