Skip to content

Commit 4bac274

Browse files
committed
build: Adapt to defineCMacro deprecation
1 parent 2c435cf commit 4bac274

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

build.zig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ pub fn build(b: *std.Build) void {
8787
});
8888

8989
if (target.result.os.tag == .windows) {
90-
lib.defineCMacro("IMGUI_API", "__declspec(dllexport)");
91-
lib.defineCMacro("IMPLOT_API", "__declspec(dllexport)");
92-
lib.defineCMacro("ZGUI_API", "__declspec(dllexport)");
90+
lib.root_module.addCMacro("IMGUI_API", "__declspec(dllexport)");
91+
lib.root_module.addCMacro("IMPLOT_API", "__declspec(dllexport)");
92+
lib.root_module.addCMacro("ZGUI_API", "__declspec(dllexport)");
9393
}
9494

9595
if (target.result.os.tag == .macos) {
@@ -107,10 +107,10 @@ pub fn build(b: *std.Build) void {
107107

108108
const emscripten = target.result.os.tag == .emscripten;
109109
if (emscripten) {
110-
imgui.defineCMacro("__EMSCRIPTEN__", null);
110+
imgui.root_module.addCMacro("__EMSCRIPTEN__", "");
111111
// TODO: read from enviroment or `emcc --version`
112-
imgui.defineCMacro("__EMSCRIPTEN_major__", "3");
113-
imgui.defineCMacro("__EMSCRIPTEN_minor__", "1");
112+
imgui.root_module.addCMacro("__EMSCRIPTEN_major__", "3");
113+
imgui.root_module.addCMacro("__EMSCRIPTEN_minor__", "1");
114114
imgui.root_module.stack_protector = false;
115115
//imgui.root_module.disable_stack_probing = true;
116116
}
@@ -148,11 +148,11 @@ pub fn build(b: *std.Build) void {
148148
.file = b.path("libs/imgui/misc/freetype/imgui_freetype.cpp"),
149149
.flags = cflags,
150150
});
151-
imgui.defineCMacro("IMGUI_ENABLE_FREETYPE", "1");
151+
imgui.root_module.addCMacro("IMGUI_ENABLE_FREETYPE", "1");
152152
}
153153

154154
if (options.use_wchar32) {
155-
imgui.defineCMacro("IMGUI_USE_WCHAR32", "1");
155+
imgui.root_module.addCMacro("IMGUI_USE_WCHAR32", "1");
156156
}
157157

158158
if (options.with_implot) {
@@ -207,8 +207,8 @@ pub fn build(b: *std.Build) void {
207207
.flags = cflags,
208208
});
209209

210-
imgui.defineCMacro("IMGUI_ENABLE_TEST_ENGINE", null);
211-
imgui.defineCMacro("IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL", "1");
210+
imgui.root_module.addCMacro("IMGUI_ENABLE_TEST_ENGINE", "");
211+
imgui.root_module.addCMacro("IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL", "1");
212212

213213
imgui.addIncludePath(b.path("libs/imgui_test_engine/"));
214214

@@ -255,7 +255,7 @@ pub fn build(b: *std.Build) void {
255255
"-Wall",
256256
"-Wextra",
257257
} });
258-
winpthreads.defineCMacro("__USE_MINGW_ANSI_STDIO", "1");
258+
winpthreads.root_module.addCMacro("__USE_MINGW_ANSI_STDIO", "1");
259259
winpthreads.addIncludePath(b.path("libs/winpthreads/include"));
260260
winpthreads.addIncludePath(b.path("libs/winpthreads/src"));
261261
winpthreads.linkLibC();

0 commit comments

Comments
 (0)