]> git.lizzy.rs Git - rust.git/blob - src/librustc_asan/build.rs
Auto merge of #57851 - Aaron1011:fix/clean-lifetime, r=GuillaumeGomez
[rust.git] / src / librustc_asan / build.rs
1 extern crate build_helper;
2 extern crate cmake;
3
4 use std::env;
5 use build_helper::sanitizer_lib_boilerplate;
6
7 use cmake::Config;
8
9 fn main() {
10     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
11         build_helper::restore_library_path();
12
13         let (native, target) = match sanitizer_lib_boilerplate("asan") {
14             Ok(native) => native,
15             _ => return,
16         };
17
18         Config::new(&native.src_dir)
19             .define("COMPILER_RT_BUILD_SANITIZERS", "ON")
20             .define("COMPILER_RT_BUILD_BUILTINS", "OFF")
21             .define("COMPILER_RT_BUILD_XRAY", "OFF")
22             .define("LLVM_CONFIG_PATH", llvm_config)
23             .out_dir(&native.out_dir)
24             .build_target(&target)
25             .build();
26         native.fixup_sanitizer_lib_name("asan");
27     }
28     println!("cargo:rerun-if-env-changed=LLVM_CONFIG");
29 }