diff --git a/.github/workflows/zig.yml b/.github/workflows/zig.yml index c63b5a466..6fa6bc65b 100644 --- a/.github/workflows/zig.yml +++ b/.github/workflows/zig.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - version: [0.16.0] + version: [0.16.0, 0.17.0] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/build.zig b/build.zig index 57b66a2dd..b144e93a4 100644 --- a/build.zig +++ b/build.zig @@ -80,7 +80,8 @@ fn addLinkerFlags( const webui_target = webui.rootModuleTarget(); const is_windows = webui_target.os.tag == .windows; const is_darwin = webui_target.os.tag == .macos; - const debug = webui.root_module.optimize.? == .Debug; + // Zig 0.17 renamed `OptimizeMode` to `Optimize` with lowercase tags. + const debug = webui.root_module.optimize.? == if (comptime builtin.zig_version.minor >= 17) .debug else .Debug; // In Zig 0.16, methods like addCSourceFile/linkLibC/addIncludePath/linkSystemLibrary/ // linkFramework/addCMacro were removed from *Compile and live only on *Module. // 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 { }; defer examples_dir.close(io); + // Zig 0.17 caches the configure phase; re-run it when an example + // directory is added or removed. + b.dependOnDirectoryContents(b.path("examples/C")); + var paths = examples_dir.iterate(); while (try paths.next(io)) |val| { if (val.kind != .directory) continue;