]> git.lizzy.rs Git - rust.git/commitdiff
Better support for cross compilation on Windows.
authorDaniel Frampton <dframpto@microsoft.com>
Fri, 10 Jan 2020 17:11:32 +0000 (09:11 -0800)
committerDaniel Frampton <dframpto@microsoft.com>
Tue, 14 Jan 2020 20:15:13 +0000 (12:15 -0800)
src/bootstrap/native.rs
src/librustc_llvm/build.rs

index ce977f1bbc44e5c0eda159230ba65cda643746d1..89e1a7319cf59bb01cb00376fdc143044b167cc6 100644 (file)
@@ -230,6 +230,8 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
                 cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
             } else if target.contains("freebsd") {
                 cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
+            } else if target.contains("windows") {
+                cfg.define("CMAKE_SYSTEM_NAME", "Windows");
             }
 
             cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
index dff20f8741065f97bee7d268af2d339ce67ce09c..405ce0307cd822f7fff95ddab38f192f12c8eff2 100644 (file)
@@ -215,12 +215,14 @@ fn main() {
     let mut cmd = Command::new(&llvm_config);
     cmd.arg(llvm_link_arg).arg("--ldflags");
     for lib in output(&mut cmd).split_whitespace() {
-        if lib.starts_with("-LIBPATH:") {
-            println!("cargo:rustc-link-search=native={}", &lib[9..]);
-        } else if is_crossed {
-            if lib.starts_with("-L") {
+        if is_crossed {
+            if lib.starts_with("-LIBPATH:") {
+                println!("cargo:rustc-link-search=native={}", lib[9..].replace(&host, &target));
+            } else if lib.starts_with("-L") {
                 println!("cargo:rustc-link-search=native={}", lib[2..].replace(&host, &target));
             }
+        } else if lib.starts_with("-LIBPATH:") {
+            println!("cargo:rustc-link-search=native={}", &lib[9..]);
         } else if lib.starts_with("-l") {
             println!("cargo:rustc-link-lib={}", &lib[2..]);
         } else if lib.starts_with("-L") {