Skip to content

Commit 7d6271b

Browse files
Better support for cross compilation on Windows.
1 parent 8a87b94 commit 7d6271b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/bootstrap/native.rs

+2
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ impl Step for Llvm {
230230
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
231231
} else if target.contains("freebsd") {
232232
cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
233+
} else if target.contains("windows") {
234+
cfg.define("CMAKE_SYSTEM_NAME", "Windows");
233235
}
234236

235237
cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));

src/librustc_llvm/build.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,14 @@ fn main() {
215215
let mut cmd = Command::new(&llvm_config);
216216
cmd.arg(llvm_link_arg).arg("--ldflags");
217217
for lib in output(&mut cmd).split_whitespace() {
218-
if lib.starts_with("-LIBPATH:") {
219-
println!("cargo:rustc-link-search=native={}", &lib[9..]);
220-
} else if is_crossed {
221-
if lib.starts_with("-L") {
218+
if is_crossed {
219+
if lib.starts_with("-LIBPATH:") {
220+
println!("cargo:rustc-link-search=native={}", lib[9..].replace(&host, &target));
221+
} else if lib.starts_with("-L") {
222222
println!("cargo:rustc-link-search=native={}", lib[2..].replace(&host, &target));
223223
}
224+
} else if lib.starts_with("-LIBPATH:") {
225+
println!("cargo:rustc-link-search=native={}", &lib[9..]);
224226
} else if lib.starts_with("-l") {
225227
println!("cargo:rustc-link-lib={}", &lib[2..]);
226228
} else if lib.starts_with("-L") {

0 commit comments

Comments
 (0)