@@ -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
}
@@ -84,7 +84,7 @@ const config_h_flags = outer: {
84
84
85
85
// Set to 1 if no value is provided
86
86
var value = strs .next () orelse "1" ;
87
- value = if (std .mem .startsWith (u8 , value , "//" )) "1" else value ;
87
+ if (std .mem .startsWith (u8 , value , "//" )) value = "1" ;
88
88
89
89
flags [i ] = .{ flag , value };
90
90
i += 1 ;
@@ -192,7 +192,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
192
192
}
193
193
194
194
if (options .opengl_version != .auto ) {
195
- raylib .defineCMacro (options .opengl_version .toCMacroStr (), null );
195
+ raylib .root_module . addCMacro (options .opengl_version .toCMacroStr (), "1" );
196
196
}
197
197
198
198
switch (target .result .os .tag ) {
@@ -215,7 +215,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
215
215
raylib .addLibraryPath (.{ .cwd_relative = "/usr/lib" });
216
216
raylib .addIncludePath (.{ .cwd_relative = "/usr/include" });
217
217
if (options .linux_display_backend == .X11 or options .linux_display_backend == .Both ) {
218
- raylib .defineCMacro ("_GLFW_X11" , null );
218
+ raylib .root_module . addCMacro ("_GLFW_X11" , "1" );
219
219
raylib .linkSystemLibrary ("X11" );
220
220
}
221
221
@@ -227,7 +227,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
227
227
, .{});
228
228
@panic ("`wayland-scanner` not found" );
229
229
};
230
- raylib .defineCMacro ("_GLFW_WAYLAND" , null );
230
+ raylib .root_module . addCMacro ("_GLFW_WAYLAND" , "1" );
231
231
raylib .linkSystemLibrary ("wayland-client" );
232
232
raylib .linkSystemLibrary ("wayland-cursor" );
233
233
raylib .linkSystemLibrary ("wayland-egl" );
@@ -246,7 +246,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
246
246
} else {
247
247
if (options .opengl_version == .auto ) {
248
248
raylib .linkSystemLibrary ("GLESv2" );
249
- raylib .defineCMacro ("GRAPHICS_API_OPENGL_ES2" , null );
249
+ raylib .root_module . addCMacro ("GRAPHICS_API_OPENGL_ES2" , "1" );
250
250
}
251
251
252
252
raylib .linkSystemLibrary ("EGL" );
@@ -258,9 +258,9 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
258
258
raylib .linkSystemLibrary ("dl" );
259
259
raylib .addIncludePath (.{ .cwd_relative = "/usr/include/libdrm" });
260
260
261
- raylib .defineCMacro ("PLATFORM_DRM" , null );
262
- raylib .defineCMacro ("EGL_NO_X11" , null );
263
- raylib .defineCMacro ("DEFAULT_BATCH_BUFFER_ELEMENT" , "2048" );
261
+ raylib .root_module . addCMacro ("PLATFORM_DRM" , "1" );
262
+ raylib .root_module . addCMacro ("EGL_NO_X11" , "1" );
263
+ raylib .root_module . addCMacro ("DEFAULT_BATCH_BUFFER_ELEMENT" , "2048" );
264
264
}
265
265
},
266
266
.freebsd , .openbsd , .netbsd , .dragonfly = > {
@@ -295,9 +295,9 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
295
295
setDesktopPlatform (raylib , options .platform );
296
296
},
297
297
.emscripten = > {
298
- raylib .defineCMacro ("PLATFORM_WEB" , null );
298
+ raylib .root_module . addCMacro ("PLATFORM_WEB" , "1" );
299
299
if (options .opengl_version == .auto ) {
300
- raylib .defineCMacro ("GRAPHICS_API_OPENGL_ES2" , null );
300
+ raylib .root_module . addCMacro ("GRAPHICS_API_OPENGL_ES2" , "1" );
301
301
}
302
302
303
303
if (b .sysroot == null ) {
0 commit comments