Use opt-level to detect debug profile (#2622)

This commit is contained in:
Björn Quentin 2024-11-28 11:52:11 +01:00 committed by GitHub
parent 92910bf1cb
commit b6117d5040
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");
}
}
}
}