@@ -42,12 +42,12 @@ pub fn addRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
42
42
}
43
43
44
44
fn setDesktopPlatform (raylib : * std.Build.Step.Compile , platform : PlatformBackend ) void {
45
- raylib .defineCMacro ("PLATFORM_DESKTOP" , null );
45
+ raylib .root_module . addCMacro ("PLATFORM_DESKTOP" , "1" );
46
46
47
47
switch (platform ) {
48
- .glfw = > raylib .defineCMacro ("PLATFORM_DESKTOP_GLFW" , null ),
49
- .rgfw = > raylib .defineCMacro ("PLATFORM_DESKTOP_RGFW" , null ),
50
- .sdl = > raylib .defineCMacro ("PLATFORM_DESKTOP_SDL" , null ),
48
+ .glfw = > raylib .root_module . addCMacro ("PLATFORM_DESKTOP_GLFW" , "1" ),
49
+ .rgfw = > raylib .root_module . addCMacro ("PLATFORM_DESKTOP_RGFW" , "1" ),
50
+ .sdl = > raylib .root_module . addCMacro ("PLATFORM_DESKTOP_SDL" , "1" ),
51
51
else = > {},
52
52
}
53
53
}
@@ -131,7 +131,6 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
131
131
try raylib_flags_arr .appendSlice (b .allocator , &[_ ][]const u8 {
132
132
"-std=gnu99" ,
133
133
"-D_GNU_SOURCE" ,
134
- "-DGL_SILENCE_DEPRECATION=199309L" ,
135
134
"-fno-sanitize=undefined" , // https://github.com/raysan5/raylib/issues/3674
136
135
});
137
136
@@ -220,7 +219,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
220
219
}
221
220
222
221
if (options .opengl_version != .auto ) {
223
- raylib .defineCMacro (options .opengl_version .toCMacroStr (), null );
222
+ raylib .root_module . addCMacro (options .opengl_version .toCMacroStr (), "1" );
224
223
}
225
224
226
225
switch (target .result .os .tag ) {
@@ -237,7 +236,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
237
236
try c_source_files .append ("src/rglfw.c" );
238
237
239
238
if (options .linux_display_backend == .X11 or options .linux_display_backend == .Both ) {
240
- raylib .defineCMacro ("_GLFW_X11" , null );
239
+ raylib .root_module . addCMacro ("_GLFW_X11" , "1" );
241
240
raylib .linkSystemLibrary ("GLX" );
242
241
raylib .linkSystemLibrary ("X11" );
243
242
raylib .linkSystemLibrary ("Xcursor" );
@@ -257,7 +256,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
257
256
, .{});
258
257
@panic ("`wayland-scanner` not found" );
259
258
};
260
- raylib .defineCMacro ("_GLFW_WAYLAND" , null );
259
+ raylib .root_module . addCMacro ("_GLFW_WAYLAND" , "1" );
261
260
raylib .linkSystemLibrary ("EGL" );
262
261
raylib .linkSystemLibrary ("wayland-client" );
263
262
raylib .linkSystemLibrary ("xkbcommon" );
@@ -276,16 +275,15 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
276
275
} else {
277
276
if (options .opengl_version == .auto ) {
278
277
raylib .linkSystemLibrary ("GLESv2" );
279
- raylib .defineCMacro ("GRAPHICS_API_OPENGL_ES2" , null );
278
+ raylib .root_module . addCMacro ("GRAPHICS_API_OPENGL_ES2" , "1" );
280
279
}
281
280
282
281
raylib .linkSystemLibrary ("EGL" );
283
282
raylib .linkSystemLibrary ("gbm" );
284
283
raylib .linkSystemLibrary2 ("libdrm" , .{ .use_pkg_config = .force });
285
284
286
- raylib .defineCMacro ("PLATFORM_DRM" , null );
287
- raylib .defineCMacro ("EGL_NO_X11" , null );
288
- raylib .defineCMacro ("DEFAULT_BATCH_BUFFER_ELEMENT" , "2048" );
285
+ raylib .root_module .addCMacro ("PLATFORM_DRM" , "1" );
286
+ raylib .root_module .addCMacro ("EGL_NO_X11" , "1" );
289
287
}
290
288
},
291
289
.freebsd , .openbsd , .netbsd , .dragonfly = > {
@@ -313,6 +311,8 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
313
311
314
312
// On macos rglfw.c include Objective-C files.
315
313
try raylib_flags_arr .append (b .allocator , "-ObjC" );
314
+ // Silence OpenGL deprecation warnings on macOS
315
+ try raylib_flags_arr .append (b .allocator , "-DGL_SILENCE_DEPRECATION=199309L" );
316
316
raylib .root_module .addCSourceFile (.{
317
317
.file = b .path ("src/rglfw.c" ),
318
318
.flags = raylib_flags_arr .items ,
@@ -336,9 +336,9 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
336
336
raylib .addIncludePath (dep .path ("upstream/emscripten/cache/sysroot/include" ));
337
337
}
338
338
339
- raylib .defineCMacro ("PLATFORM_WEB" , null );
339
+ raylib .root_module . addCMacro ("PLATFORM_WEB" , "1" );
340
340
if (options .opengl_version == .auto ) {
341
- raylib .defineCMacro ("GRAPHICS_API_OPENGL_ES2" , null );
341
+ raylib .root_module . addCMacro ("GRAPHICS_API_OPENGL_ES2" , "1" );
342
342
}
343
343
},
344
344
else = > {
0 commit comments