@@ -554,16 +554,22 @@ fn copy_dynamic_libraries(sdl2_compiled_path: &PathBuf, target_os: &str) {
554
554
if target_os. contains ( "windows" ) {
555
555
let sdl2_dll_name = "SDL2.dll" ;
556
556
let sdl2_bin_path = sdl2_compiled_path. join ( "bin" ) ;
557
- let target_path = find_cargo_target_dir ( ) ;
558
-
559
557
let src_dll_path = sdl2_bin_path. join ( sdl2_dll_name) ;
560
- let dst_dll_path = target_path. join ( sdl2_dll_name) ;
561
558
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
+ }
567
573
}
568
574
}
569
575
0 commit comments