@@ -12,7 +12,7 @@ pub fn build(b: *std.Build) !void {
1212 const sdl_ttf_dep = b .dependency ("sdl_ttf" , .{});
1313 const freetype_dep = b .dependency ("freetype" , .{});
1414 const wayland_scanner_dep = b .dependency ("wayland_scanner" , .{
15- .target = b .host ,
15+ .target = b .graph . host ,
1616 .optimize = .ReleaseFast ,
1717 });
1818 const font_dep = b .dependency ("fonts" , .{});
@@ -41,12 +41,12 @@ pub fn build(b: *std.Build) !void {
4141 .ReleaseFast , .ReleaseSmall , .ReleaseSafe = > 0 ,
4242 .Debug = > 3 ,
4343 };
44- lib .defineCMacro ("SDL_ASSERT_LEVEL" , b .fmt ("{d}" , .{SDL_ASSERT_LEVEL }));
44+ lib .root_module . addCMacro ("SDL_ASSERT_LEVEL" , b .fmt ("{d}" , .{SDL_ASSERT_LEVEL }));
4545
4646 if (optimize != .Debug ) {
47- lib .defineCMacro ("NDEBUG" , "1" );
48- lib .defineCMacro ("__FILE__" , "\" __FILE__\" " );
49- lib .defineCMacro ("__LINE__" , "0" );
47+ lib .root_module . addCMacro ("NDEBUG" , "1" );
48+ lib .root_module . addCMacro ("__FILE__" , "\" __FILE__\" " );
49+ lib .root_module . addCMacro ("__LINE__" , "0" );
5050 }
5151
5252 lib .linkLibC ();
@@ -65,7 +65,7 @@ pub fn build(b: *std.Build) !void {
6565 lib .linkSystemLibrary ("version" );
6666 lib .linkSystemLibrary ("oleaut32" );
6767 lib .linkSystemLibrary ("ole32" );
68- lib .defineCMacro ("SDL_USE_BUILTIN_OPENGL_DEFINITIONS" , "1" );
68+ lib .root_module . addCMacro ("SDL_USE_BUILTIN_OPENGL_DEFINITIONS" , "1" );
6969 },
7070 .macos = > {
7171 lib .addCSourceFiles (.{
@@ -78,7 +78,7 @@ pub fn build(b: *std.Build) !void {
7878 .files = & objective_c_src_files ,
7979 .flags = &.{"-fobjc-arc" },
8080 });
81- lib .defineCMacro ("SDL_USE_BUILTIN_OPENGL_DEFINITIONS" , "1" );
81+ lib .root_module . addCMacro ("SDL_USE_BUILTIN_OPENGL_DEFINITIONS" , "1" );
8282
8383 // TODO: re-check which frameworks are needed
8484 lib .linkFramework ("AudioToolbox" );
@@ -94,14 +94,14 @@ pub fn build(b: *std.Build) !void {
9494 lib .linkFramework ("CoreVideo" );
9595 lib .linkFramework ("ForceFeedback" );
9696 lib .linkFramework ("Foundation" );
97- lib .linkFrameworkWeak ("GameController" );
97+ lib .linkFramework ("GameController" );
9898 lib .linkFramework ("IOKit" );
99- lib .linkFrameworkWeak ("Metal" );
100- lib .linkFrameworkWeak ("QuartzCore" );
101- lib .linkFrameworkWeak ("UniformTypeIdentifiers" );
99+ lib .linkFramework ("Metal" );
100+ lib .linkFramework ("QuartzCore" );
101+ lib .linkFramework ("UniformTypeIdentifiers" );
102102 lib .linkSystemLibrary ("objc" );
103103
104- const sdk = std .zig .system .darwin .getSdk (b .allocator , b .host .result ) orelse
104+ const sdk = std .zig .system .darwin .getSdk (b .allocator , b .graph . host .result ) orelse
105105 @panic ("macOS SDK is missing" );
106106 lib .addSystemIncludePath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/include" }) });
107107 lib .addSystemFrameworkPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/System/Library/Frameworks" }) });
@@ -376,7 +376,7 @@ pub fn build(b: *std.Build) !void {
376376
377377 inline for (std .meta .fields (@TypeOf (values ))) | f | {
378378 const value = b .fmt ("{any}" , .{@field (values , f .name )});
379- lib .defineCMacro (f .name , value );
379+ lib .root_module . addCMacro (f .name , value );
380380 }
381381
382382 // SDL3_DYNAMIC_API=/my/actual/libSDL3.so.0
@@ -387,7 +387,7 @@ pub fn build(b: *std.Build) !void {
387387
388388 // Avoid
389389 // SDL/include/build_config/SDL_build_config_minimal.h
390- lib .defineCMacro ("SDL_build_config_minimal_h_" , "1" );
390+ lib .root_module . addCMacro ("SDL_build_config_minimal_h_" , "1" );
391391
392392 //--
393393
@@ -523,7 +523,7 @@ pub fn build(b: *std.Build) !void {
523523 SDL_ttf .linkLibrary (freetype_dep .artifact ("freetype" ));
524524
525525 if (target .result .os .tag == .macos ) {
526- const sdk = std .zig .system .darwin .getSdk (b .allocator , b .host .result ) orelse
526+ const sdk = std .zig .system .darwin .getSdk (b .allocator , b .graph . host .result ) orelse
527527 @panic ("macOS SDK is missing" );
528528 SDL_ttf .addSystemIncludePath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/include" }) });
529529 SDL_ttf .addSystemFrameworkPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/System/Library/Frameworks" }) });
@@ -582,7 +582,7 @@ pub fn build(b: *std.Build) !void {
582582 exe .root_module .addImport ("sdl" , module );
583583
584584 if (target .result .os .tag == .macos ) {
585- const sdk = std .zig .system .darwin .getSdk (b .allocator , b .host .result ) orelse
585+ const sdk = std .zig .system .darwin .getSdk (b .allocator , b .graph . host .result ) orelse
586586 @panic ("macOS SDK is missing" );
587587 exe .addSystemIncludePath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/include" }) });
588588 exe .addSystemFrameworkPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/System/Library/Frameworks" }) });
@@ -855,7 +855,7 @@ pub fn build(b: *std.Build) !void {
855855 exe .linkLibrary (test_utils );
856856
857857 if (target .result .os .tag == .macos ) {
858- const sdk = std .zig .system .darwin .getSdk (b .allocator , b .host .result ) orelse
858+ const sdk = std .zig .system .darwin .getSdk (b .allocator , b .graph . host .result ) orelse
859859 @panic ("macOS SDK is missing" );
860860 exe .addSystemIncludePath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/include" }) });
861861 exe .addSystemFrameworkPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/System/Library/Frameworks" }) });
@@ -928,7 +928,7 @@ pub fn build(b: *std.Build) !void {
928928 exe .linkLibrary (lib );
929929
930930 if (target .result .os .tag == .macos ) {
931- const sdk = std .zig .system .darwin .getSdk (b .allocator , b .host .result ) orelse
931+ const sdk = std .zig .system .darwin .getSdk (b .allocator , b .graph . host .result ) orelse
932932 @panic ("macOS SDK is missing" );
933933 exe .addSystemIncludePath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/usr/include" }) });
934934 exe .addSystemFrameworkPath (.{ .cwd_relative = b .pathJoin (&.{ sdk , "/System/Library/Frameworks" }) });
0 commit comments