diff options
| author | Daniel Frampton <dframpto@microsoft.com> | 2020-01-10 09:11:32 -0800 |
|---|---|---|
| committer | Daniel Frampton <dframpto@microsoft.com> | 2020-01-14 12:15:13 -0800 |
| commit | 7d6271b76b7ee7a192e03933ed6b37e6e6385c08 (patch) | |
| tree | 21b3ca4c256e5a61e662c3a04755a745f006581b | |
| parent | 8a87b945b27b5670ac5ed665bbb0fccc1b88a0a0 (diff) | |
| download | rust-7d6271b76b7ee7a192e03933ed6b37e6e6385c08.tar.gz rust-7d6271b76b7ee7a192e03933ed6b37e6e6385c08.zip | |
Better support for cross compilation on Windows.
| -rw-r--r-- | src/bootstrap/native.rs | 2 | ||||
| -rw-r--r-- | src/librustc_llvm/build.rs | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index ce977f1bbc4..89e1a7319cf 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -230,6 +230,8 @@ impl Step for Llvm { 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")); diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index dff20f87410..405ce0307cd 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -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") { |
