@@ -125,13 +125,10 @@ pub fn build(b: *std.Build) void {
125125 // causes pregenerated SDL_config.h to assert an error
126126 lib .root_module .addCMacro ("USING_GENERATED_CONFIG_H" , "" );
127127
128- var files = std .ArrayList ([]const u8 ).init (b .allocator );
129- defer files .deinit ();
130-
131128 const config_header = configHeader (b , t );
132129 switch (t .os .tag ) {
133130 .linux = > {
134- files . appendSlice ( & linux_src_files ) catch @panic ( "OOM" );
131+ lib . addCSourceFiles (.{ . files = & linux_src_files } );
135132 config_header .addValues (.{
136133 .SDL_VIDEO_OPENGL = 1 ,
137134 .SDL_VIDEO_OPENGL_ES = 1 ,
@@ -144,11 +141,10 @@ pub fn build(b: *std.Build) void {
144141 .SDL_VIDEO_OPENGL_OSMESA = 1 ,
145142 .SDL_VIDEO_OPENGL_OSMESA_DYNAMIC = 1 ,
146143 });
147- applyOptions (b , lib , & files , config_header , & linux_options );
144+ applyOptions (b , lib , config_header , & linux_options );
148145 },
149146 else = > {},
150147 }
151- lib .addCSourceFiles (.{ .files = files .toOwnedSlice () catch @panic ("OOM" ) });
152148 lib .addConfigHeader (config_header );
153149 lib .installHeader (config_header .getOutput (), "SDL2/SDL_config.h" );
154150
@@ -997,7 +993,6 @@ const linux_options = [_]SdlOption{
997993fn applyOptions (
998994 b : * std.Build ,
999995 lib : * std.Build.Step.Compile ,
1000- files : * std .ArrayList ([]const u8 ),
1001996 config_header : * std.Build.Step.ConfigHeader ,
1002997 comptime options : []const SdlOption ,
1003998) void {
@@ -1010,7 +1005,7 @@ fn applyOptions(
10101005 config_header .values .put (config , .{ .int = if (enabled ) 1 else 0 }) catch @panic ("OOM" );
10111006 }
10121007 if (enabled ) {
1013- files . appendSlice ( option .src_files ) catch @panic ( "OOM" );
1008+ lib . addCSourceFiles (.{ . files = option .src_files } );
10141009 for (option .system_libs ) | lib_name | {
10151010 lib .linkSystemLibrary (lib_name );
10161011 }
0 commit comments