Skip to content

Commit f62fbbc

Browse files
committed
Merge remote-tracking branch 'upstream/master' into add_windows_ci
2 parents c0a93d6 + 8bae639 commit f62fbbc

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

sdl2-sys/build.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -554,16 +554,22 @@ fn copy_dynamic_libraries(sdl2_compiled_path: &PathBuf, target_os: &str) {
554554
if target_os.contains("windows") {
555555
let sdl2_dll_name = "SDL2.dll";
556556
let sdl2_bin_path = sdl2_compiled_path.join("bin");
557-
let target_path = find_cargo_target_dir();
558-
559557
let src_dll_path = sdl2_bin_path.join(sdl2_dll_name);
560-
let dst_dll_path = target_path.join(sdl2_dll_name);
561558

562-
fs::copy(&src_dll_path, &dst_dll_path).expect(&format!(
563-
"Failed to copy SDL2 dynamic library from {} to {}",
564-
src_dll_path.to_string_lossy(),
565-
dst_dll_path.to_string_lossy()
566-
));
559+
// Copy the dll to:
560+
// * target dir: as a product ship product of the build,
561+
// * deps directory: as comment example testing doesn't pick up the library search path
562+
// otherwise and fails.
563+
let target_path = find_cargo_target_dir();
564+
let deps_path = target_path.join("deps");
565+
for path in &[target_path, deps_path] {
566+
let dst_dll_path = path.join(&sdl2_dll_name);
567+
fs::copy(&src_dll_path, &dst_dll_path).expect(&format!(
568+
"Failed to copy SDL2 dynamic library from {} to {}",
569+
src_dll_path.to_string_lossy(),
570+
dst_dll_path.to_string_lossy()
571+
));
572+
}
567573
}
568574
}
569575

0 commit comments

Comments
 (0)