]> git.lizzy.rs Git - rust.git/blob - src/librustc_asan/build.rs
Simplify Cache wrapper to single type, impl Deref on it, fix all compilation errors...
[rust.git] / src / librustc_asan / build.rs
1 use std::env;
2 use build_helper::sanitizer_lib_boilerplate;
3
4 use cmake::Config;
5
6 fn main() {
7     println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
8     if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
9         return;
10     }
11     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
12         build_helper::restore_library_path();
13
14         let (native, target) = match sanitizer_lib_boilerplate("asan") {
15             Ok(native) => native,
16             _ => return,
17         };
18
19         Config::new(&native.src_dir)
20             .define("COMPILER_RT_BUILD_SANITIZERS", "ON")
21             .define("COMPILER_RT_BUILD_BUILTINS", "OFF")
22             .define("COMPILER_RT_BUILD_XRAY", "OFF")
23             .define("LLVM_CONFIG_PATH", llvm_config)
24             .out_dir(&native.out_dir)
25             .build_target(&target)
26             .build();
27         native.fixup_sanitizer_lib_name("asan");
28     }
29     println!("cargo:rerun-if-env-changed=LLVM_CONFIG");
30 }