]> git.lizzy.rs Git - rust.git/blob - src/librustc_lsan/build.rs
ignore-emcscripten as it does not support threads
[rust.git] / src / librustc_lsan / build.rs
1 use std::env;
2 use build_helper::sanitizer_lib_boilerplate;
3
4 use cmake::Config;
5
6 fn main() {
7     if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
8         return;
9     }
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("lsan") {
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     }
27     println!("cargo:rerun-if-env-changed=LLVM_CONFIG");
28 }