Skip to content

Commit 14217b1

Browse files
committed
More windows
1 parent f60e7cc commit 14217b1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/compiletests/src/main.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,36 @@ fn setup_windows_dll_path(codegen_backend_path: &Path) {
639639
let final_path = env::var(dylib_path_envvar()).unwrap_or_default();
640640
println!("\nFinal PATH: {}", final_path);
641641

642+
// Try copying LLVM DLLs to the codegen backend directory
643+
println!("\nChecking if LLVM DLLs need to be copied...");
644+
if let Some(codegen_dir) = codegen_backend_path.parent() {
645+
// Look for LLVM DLLs in the PATH
646+
for path_str in final_path.split(';') {
647+
let path = Path::new(path_str);
648+
if path.exists() && path.to_str().unwrap().contains("rustc_codegen_nvvm") && path.to_str().unwrap().contains("bin") {
649+
println!(" Checking for LLVM DLLs in: {}", path.display());
650+
if let Ok(entries) = std::fs::read_dir(path) {
651+
for entry in entries.flatten() {
652+
if let Some(name) = entry.file_name().to_str() {
653+
if name.starts_with("LLVM") && name.ends_with(".dll") {
654+
let src = entry.path();
655+
let dst = codegen_dir.join(name);
656+
if !dst.exists() {
657+
println!(" Copying {} to codegen directory", name);
658+
if let Err(e) = std::fs::copy(&src, &dst) {
659+
println!(" Failed to copy: {}", e);
660+
}
661+
} else {
662+
println!(" {} already exists in codegen directory", name);
663+
}
664+
}
665+
}
666+
}
667+
}
668+
}
669+
}
670+
}
671+
642672
// Try to use dumpbin to check what DLLs are needed
643673
println!("\nChecking DLL dependencies...");
644674
let dumpbin_result = Command::new("dumpbin")

0 commit comments

Comments
 (0)