Skip to content

Commit f1b28ee

Browse files
authored
Merge pull request #719 from webui-dev/fix/zig-0.17
Fix build with Zig 0.17.0
2 parents 4f6242a + d526574 commit f1b28ee

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎.github/workflows/zig.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
version: [0.16.0]
11+
version: [0.16.0, 0.17.0]
1212
fail-fast: false
1313
runs-on: ${{ matrix.os }}
1414
steps:

‎build.zig‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ fn addLinkerFlags(
8080
const webui_target = webui.rootModuleTarget();
8181
const is_windows = webui_target.os.tag == .windows;
8282
const is_darwin = webui_target.os.tag == .macos;
83-
const debug = webui.root_module.optimize.? == .Debug;
83+
// Zig 0.17 renamed `OptimizeMode` to `Optimize` with lowercase tags.
84+
const debug = webui.root_module.optimize.? == if (comptime builtin.zig_version.minor >= 17) .debug else .Debug;
8485
// In Zig 0.16, methods like addCSourceFile/linkLibC/addIncludePath/linkSystemLibrary/
8586
// linkFramework/addCMacro were removed from *Compile and live only on *Module.
8687
// Routing every call through `mod` keeps the build script compatible with 0.14/0.15/0.16.
@@ -185,6 +186,10 @@ fn build_examples(b: *Build, webui: *Compile) !void {
185186
};
186187
defer examples_dir.close(io);
187188

189+
// Zig 0.17 caches the configure phase; re-run it when an example
190+
// directory is added or removed.
191+
b.dependOnDirectoryContents(b.path("examples/C"));
192+
188193
var paths = examples_dir.iterate();
189194
while (try paths.next(io)) |val| {
190195
if (val.kind != .directory) continue;

0 commit comments

Comments
 (0)