@@ -64,6 +64,19 @@ pub fn build(b: *std.Build) void {
64
64
const zsdl3_tests = addTests (test_step , target , optimize , "zsdl3-tests" , "src/sdl3.zig" );
65
65
link_SDL3 (zsdl3_tests );
66
66
}
67
+
68
+ if (prebuilt .install_SDL2 (b , target .result , .bin )) | install_sdl2_step | {
69
+ b .getInstallStep ().dependOn (install_sdl2_step );
70
+ }
71
+ if (prebuilt .install_SDL2_ttf (b , target .result , .bin )) | install_sdl2_ttf_step | {
72
+ b .getInstallStep ().dependOn (install_sdl2_ttf_step );
73
+ }
74
+ if (prebuilt .install_SDL2_image (b , target .result , .bin )) | install_sdl2_image_step | {
75
+ b .getInstallStep ().dependOn (install_sdl2_image_step );
76
+ }
77
+ if (prebuilt .install_SDL3 (b , target .result , .bin )) | install_sdl3_step | {
78
+ b .getInstallStep ().dependOn (install_sdl3_step );
79
+ }
67
80
}
68
81
69
82
pub fn link_SDL2 (compile_step : * std.Build.Step.Compile ) void {
@@ -326,6 +339,48 @@ pub const prebuilt = struct {
326
339
}
327
340
return null ;
328
341
}
342
+
343
+ pub fn install_SDL3 (
344
+ b : * std.Build ,
345
+ target : std.Target ,
346
+ install_dir : std.Build.InstallDir ,
347
+ ) ? * std.Build.Step {
348
+ switch (target .os .tag ) {
349
+ .windows = > {
350
+ if (target .cpu .arch .isX86 ()) {
351
+ if (b .lazyDependency ("sdl3-prebuilt-x86_64-windows-gnu" , .{})) | sdl3_prebuilt | {
352
+ return & b .addInstallFileWithDir (
353
+ sdl3_prebuilt .path ("bin/SDL3.dll" ),
354
+ install_dir ,
355
+ "SDL2.dll" ,
356
+ ).step ;
357
+ }
358
+ }
359
+ },
360
+ .linux = > {
361
+ if (target .cpu .arch .isX86 ()) {
362
+ if (b .lazyDependency ("sdl3-prebuilt-x86_64-linux-gnu" , .{})) | sdl3_prebuilt | {
363
+ return & b .addInstallFileWithDir (
364
+ sdl3_prebuilt .path ("lib/libSDL3.so" ),
365
+ install_dir ,
366
+ "libSDL2.so" ,
367
+ ).step ;
368
+ }
369
+ }
370
+ },
371
+ .macos = > {
372
+ if (b .lazyDependency ("sdl3-prebuilt-macos" , .{})) | sdl3_prebuilt | {
373
+ return & b .addInstallDirectory (.{
374
+ .source_dir = sdl3_prebuilt .path ("Frameworks/SDL3.framework" ),
375
+ .install_dir = install_dir ,
376
+ .install_subdir = "SDL3.framework" ,
377
+ }).step ;
378
+ }
379
+ },
380
+ else = > {},
381
+ }
382
+ return null ;
383
+ }
329
384
};
330
385
331
386
fn addTests (
0 commit comments