Skip to content

Commit 33bb457

Browse files
committed
Replace deprecated defineCMacro for Zig 0.14.0-dev compat
1 parent 7827c2f commit 33bb457

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

build.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ pub fn build(b: *std.Build) void {
2020

2121
const sdl_include_path = b.path("include");
2222
lib.addCSourceFiles(.{ .files = &generic_src_files });
23-
lib.defineCMacro("SDL_USE_BUILTIN_OPENGL_DEFINITIONS", "1");
24-
lib.defineCMacro("HAVE_GCC_ATOMICS", "1");
25-
lib.defineCMacro("HAVE_GCC_SYNC_LOCK_TEST_AND_SET", "1");
23+
lib.root_module.addCMacro("SDL_USE_BUILTIN_OPENGL_DEFINITIONS", "1");
24+
lib.root_module.addCMacro("HAVE_GCC_ATOMICS", "1");
25+
lib.root_module.addCMacro("HAVE_GCC_SYNC_LOCK_TEST_AND_SET", "1");
2626
lib.linkLibC();
2727
switch (t.os.tag) {
2828
.windows => {
29-
lib.defineCMacro("SDL_STATIC_LIB", "");
29+
lib.root_module.addCMacro("SDL_STATIC_LIB", "");
3030
lib.addCSourceFiles(.{ .files = &windows_src_files });
3131
lib.linkSystemLibrary("user32");
3232
lib.linkSystemLibrary("shell32");
@@ -58,8 +58,8 @@ pub fn build(b: *std.Build) void {
5858
lib.linkFramework("Foundation");
5959
},
6060
.emscripten => {
61-
lib.defineCMacro("__EMSCRIPTEN_PTHREADS__ ", "1");
62-
lib.defineCMacro("USE_SDL", "2");
61+
lib.root_module.addCMacro("__EMSCRIPTEN_PTHREADS__ ", "1");
62+
lib.root_module.addCMacro("USE_SDL", "2");
6363
lib.addCSourceFiles(.{ .files = &emscripten_src_files });
6464
if (b.sysroot == null) {
6565
@panic("Pass '--sysroot \"$EMSDK/upstream/emscripten\"'");
@@ -125,7 +125,7 @@ pub fn build(b: *std.Build) void {
125125
lib.addCSourceFiles(.{ .files = render_driver_sw.src_files });
126126
} else {
127127
// causes pregenerated SDL_config.h to assert an error
128-
lib.defineCMacro("USING_GENERATED_CONFIG_H", "");
128+
lib.root_module.addCMacro("USING_GENERATED_CONFIG_H", "");
129129

130130
var files = std.ArrayList([]const u8).init(b.allocator);
131131
defer files.deinit();
@@ -1002,7 +1002,7 @@ fn applyOptions(
10021002
inline for (options) |option| {
10031003
const enabled = if (b.option(bool, option.name, option.desc)) |o| o else option.default;
10041004
for (option.c_macros) |name| {
1005-
lib.defineCMacro(name, if (enabled) "1" else "0");
1005+
lib.root_module.addCMacro(name, if (enabled) "1" else "0");
10061006
}
10071007
for (option.sdl_configs) |config| {
10081008
config_header.values.put(config, .{ .int = if (enabled) 1 else 0 }) catch @panic("OOM");

0 commit comments

Comments
 (0)