]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_msan/build.rs
Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.
[rust.git] / src / librustc_msan / build.rs
index 7a4c8f7073933f7d597991cf776cfa8e7662461f..dcadbe86966e71eeab8adf40f4e2ad44d6d045e8 100644 (file)
 extern crate build_helper;
 extern crate cmake;
 
-use std::path::PathBuf;
 use std::env;
+use build_helper::sanitizer_lib_boilerplate;
 
 use cmake::Config;
 
 fn main() {
     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
-        let dst = Config::new("../compiler-rt")
+        let native = match sanitizer_lib_boilerplate("msan") {
+            Ok(native) => native,
+            _ => return,
+        };
+
+        Config::new(&native.src_dir)
             .define("COMPILER_RT_BUILD_SANITIZERS", "ON")
             .define("COMPILER_RT_BUILD_BUILTINS", "OFF")
             .define("COMPILER_RT_BUILD_XRAY", "OFF")
             .define("LLVM_CONFIG_PATH", llvm_config)
+            .out_dir(&native.out_dir)
             .build_target("msan")
             .build();
-
-        println!("cargo:rustc-link-search=native={}",
-                 dst.join("build/lib/linux").display());
-        println!("cargo:rustc-link-lib=static=clang_rt.msan-x86_64");
-
-        build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR")
-                .unwrap())
-            .join("../compiler-rt"));
     }
-
-    println!("cargo:rerun-if-changed=build.rs");
 }