Skip to content

Commit

Permalink
Use opt-level to detect debug profile (#2622)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ authored Nov 28, 2024
1 parent 92910bf commit b6117d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ fn main() {
// Allow building examples in CI in debug mode
println!("cargo:rustc-check-cfg=cfg(is_not_release)");
println!("cargo:rerun-if-env-changed=CI");
#[cfg(debug_assertions)]
if std::env::var("CI").is_err() {
println!("cargo::rustc-cfg=is_not_release");
if let Ok(level) = std::env::var("OPT_LEVEL") {
if level == "0" || level == "1" {
println!("cargo::rustc-cfg=is_not_release");
}
}
}
}

0 comments on commit b6117d5

Please sign in to comment.