From 75b6b825dfc93488bc411c00845164b5c0f8fae6 Mon Sep 17 00:00:00 2001 From: Johannes <59510166+Joonsey@users.noreply.github.com> Date: Sat, 28 Dec 2024 15:57:10 +0100 Subject: [PATCH] using addCMacro instead of defineCMacro (#4620) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Johannes Rønning --- build.zig | 24 ++++++++++++------------ examples/build.zig | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build.zig b/build.zig index 66e8fab4f578..0f6f297556cc 100644 --- a/build.zig +++ b/build.zig @@ -13,9 +13,9 @@ comptime { fn setDesktopPlatform(raylib: *std.Build.Step.Compile, platform: PlatformBackend) void { switch (platform) { - .glfw => raylib.defineCMacro("PLATFORM_DESKTOP_GLFW", null), - .rgfw => raylib.defineCMacro("PLATFORM_DESKTOP_RGFW", null), - .sdl => raylib.defineCMacro("PLATFORM_DESKTOP_SDL", null), + .glfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_GLFW", ""), + .rgfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_RGFW", ""), + .sdl => raylib.root_module.addCMacro("PLATFORM_DESKTOP_SDL", ""), else => {}, } } @@ -173,7 +173,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. } if (options.opengl_version != .auto) { - raylib.defineCMacro(options.opengl_version.toCMacroStr(), null); + raylib.root_module.addCMacro(options.opengl_version.toCMacroStr(), ""); } raylib.addIncludePath(b.path("src/platforms")); @@ -191,7 +191,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. try c_source_files.append("src/rglfw.c"); if (options.linux_display_backend == .X11 or options.linux_display_backend == .Both) { - raylib.defineCMacro("_GLFW_X11", null); + raylib.root_module.addCMacro("_GLFW_X11", ""); raylib.linkSystemLibrary("GLX"); raylib.linkSystemLibrary("X11"); raylib.linkSystemLibrary("Xcursor"); @@ -211,7 +211,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. , .{}); @panic("`wayland-scanner` not found"); }; - raylib.defineCMacro("_GLFW_WAYLAND", null); + raylib.root_module.addCMacro("_GLFW_WAYLAND", ""); raylib.linkSystemLibrary("EGL"); raylib.linkSystemLibrary("wayland-client"); raylib.linkSystemLibrary("xkbcommon"); @@ -230,16 +230,16 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. } else { if (options.opengl_version == .auto) { raylib.linkSystemLibrary("GLESv2"); - raylib.defineCMacro("GRAPHICS_API_OPENGL_ES2", null); + raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", ""); } raylib.linkSystemLibrary("EGL"); raylib.linkSystemLibrary("gbm"); raylib.linkSystemLibrary2("libdrm", .{ .use_pkg_config = .force }); - raylib.defineCMacro("PLATFORM_DRM", null); - raylib.defineCMacro("EGL_NO_X11", null); - raylib.defineCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", "2048"); + raylib.root_module.addCMacro("PLATFORM_DRM", ""); + raylib.root_module.addCMacro("EGL_NO_X11", ""); + raylib.root_module.addCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", ""); } }, .freebsd, .openbsd, .netbsd, .dragonfly => { @@ -290,9 +290,9 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. raylib.addIncludePath(dep.path("upstream/emscripten/cache/sysroot/include")); } - raylib.defineCMacro("PLATFORM_WEB", null); + raylib.root_module.addCMacro("PLATFORM_WEB", ""); if (options.opengl_version == .auto) { - raylib.defineCMacro("GRAPHICS_API_OPENGL_ES2", null); + raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", ""); } }, else => { diff --git a/examples/build.zig b/examples/build.zig index df0cdf8c17f0..301381df3297 100644 --- a/examples/build.zig +++ b/examples/build.zig @@ -46,7 +46,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.Reso exe.linkSystemLibrary("gdi32"); exe.linkSystemLibrary("opengl32"); - exe.defineCMacro("PLATFORM_DESKTOP", null); + exe.root_module.addCMacro("PLATFORM_DESKTOP", ""); }, .linux => { exe.linkSystemLibrary("GL"); @@ -55,7 +55,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.Reso exe.linkSystemLibrary("m"); exe.linkSystemLibrary("X11"); - exe.defineCMacro("PLATFORM_DESKTOP", null); + exe.root_module.addCMacro("PLATFORM_DESKTOP", ""); }, .macos => { exe.linkFramework("Foundation"); @@ -65,7 +65,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.Reso exe.linkFramework("CoreVideo"); exe.linkFramework("IOKit"); - exe.defineCMacro("PLATFORM_DESKTOP", null); + exe.root_module.addCMacro("PLATFORM_DESKTOP", ""); }, else => { @panic("Unsupported OS");