forked from rust-lang/libm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
26 lines (20 loc) · 786 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::env;
mod configure;
fn main() {
let cfg = configure::Config::from_env();
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rustc-check-cfg=cfg(assert_no_panic)");
println!("cargo:rustc-check-cfg=cfg(feature, values(\"checked\"))");
#[allow(unexpected_cfgs)]
if !cfg!(feature = "checked") {
let lvl = env::var("OPT_LEVEL").unwrap();
if lvl != "0" && !cfg!(debug_assertions) {
println!("cargo:rustc-cfg=assert_no_panic");
} else if env::var("ENSURE_NO_PANIC").is_ok() {
// Give us a defensive way of ensureing that no-panic is checked when we
// expect it to be.
panic!("`assert_no_panic `was not enabled");
}
}
configure::emit_libm_config(&cfg);
}