diff --git a/build.zig b/build.zig index 8d8b2d3532e4..428efb2db7b7 100644 --- a/build.zig +++ b/build.zig @@ -63,21 +63,18 @@ pub const emsdk = struct { } pub fn emccStep(b: *std.Build, raylib: *std.Build.Step.Compile, wasm: *std.Build.Step.Compile, options: zemscripten.StepOptions) *std.Build.Step { - const activate_emsdk_step = zemscripten.activateEmsdkStep(b); - const emsdk_dep = b.dependency("emsdk", .{}); raylib.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include")); wasm.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include")); - const emcc_step = zemscripten.emccStep(b, wasm, options); - emcc_step.dependOn(activate_emsdk_step); + const emcc_step = zemscripten.emccStep(b, &.{}, &.{wasm}, options); return emcc_step; } pub fn emrunStep( b: *std.Build, - html_path: []const u8, + html_path: std.Build.LazyPath, extra_args: []const []const u8, ) *std.Build.Step { return zemscripten.emrunStep(b, html_path, extra_args); @@ -92,7 +89,7 @@ pub fn linkWindows(mod: *std.Build.Module, opengl: bool, comptime shcore: bool) } fn findWaylandScanner(b: *std.Build) void { - _ = b.findProgram(&.{"wayland-scanner"}, &.{}) catch { + _ = b.findProgram(.{ .names = &.{"wayland-scanner"} }) orelse { std.log.err( \\ `wayland-scanner` may not be installed on the system. \\ You can switch to X11 in your `build.zig` by changing `Options.linux_display_backend` @@ -648,7 +645,7 @@ fn addExamples( const all = b.step(module, "All " ++ module ++ " examples"); const module_subpath = b.pathJoin(&.{ "examples", module }); - var dir = try b.build_root.handle.openDir(b.graph.io, module_subpath, .{ .iterate = true }); + var dir = try b.root.openDir(b.graph.io, module_subpath, .{ .iterate = true }); defer dir.close(b.graph.io); var iter = dir.iterate(); @@ -706,9 +703,10 @@ fn addExamples( const emcc_flags = emsdk.emccDefaultFlags(b.allocator, .{ .optimize = optimize }); const emcc_settings = emsdk.emccDefaultSettings(b.allocator, .{ .optimize = optimize }); - const EmccExamplesPreloadMap = std.static_string_map.StaticStringMap([]const emsdk.zemscripten.EmccFilePath); - const EmccExamplesPreloadKV = struct { []const u8, []const emsdk.zemscripten.EmccFilePath }; - const emcc_examples_preloads: []const EmccExamplesPreloadKV = @import("examples/example_resources.zon"); + const EmccExamplesPreloadMap = std.static_string_map.StaticStringMap([]const emsdk.zemscripten.ResourceFile); + const EmccExamplesPreloadKV = struct { []const u8, []const emsdk.zemscripten.ResourceFile }; + const emcc_examples_preloads_ = @import("examples/example_resources.zon"); + const emcc_examples_preloads: []const EmccExamplesPreloadKV = @ptrCast(@alignCast(&emcc_examples_preloads_)); const emcc_examples_preloads_map = EmccExamplesPreloadMap.initComptime(emcc_examples_preloads); const emcc_step = emsdk.emccStep(b, raylib, wasm, .{ @@ -718,13 +716,13 @@ fn addExamples( .preload_paths = emcc_examples_preloads_map.get(filename) orelse &.{}, .shell_file_path = b.path("src/shell.html"), .install_dir = install_dir, + .out_file_name = wasm.name, }); b.getInstallStep().dependOn(emcc_step); - const html_filename = try std.fmt.allocPrint(b.allocator, "{s}.html", .{wasm.name}); const emrun_step = emsdk.emrunStep( b, - b.getInstallPath(install_dir, html_filename), + b.graph.path(.install_prefix, b.fmt("{s}/{s}.html", .{ filename, wasm.name })), &.{}, ); @@ -759,7 +757,7 @@ fn waylandGenerate( comptime waylandDir: []const u8, comptime source: bool, ) !void { - const dir = try b.build_root.handle.openDir(b.graph.io, waylandDir, .{ .iterate = true }); + const dir = try b.root.openDir(b.graph.io, waylandDir, .{ .iterate = true }); defer dir.close(b.graph.io); var iter = dir.iterate(); @@ -793,4 +791,3 @@ fn waylandGenerate( } } } - diff --git a/build.zig.zon b/build.zig.zon index 07a1f7400ad0..248b72313856 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .name = .raylib, .version = "6.0.0", - .minimum_zig_version = "0.16.0", + .minimum_zig_version = "0.17.0-dev.1158+1d1193aa7", .fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications. @@ -21,8 +21,8 @@ .hash = "N-V-__8AAJl1DwBezhYo_VE6f53mPVm00R-Fk28NPW7P14EQ", }, .zemscripten = .{ - .url = "git+https://github.com/zig-gamedev/zemscripten#3fa4b778852226c7346bdcc3c1486e875a9a6d02", - .hash = "zemscripten-0.2.0-dev-sRlDqApRAACspTbAZnuNKWIzfWzSYgYkb2nWAXZ-tqqt", + .url = "git+https://github.com/Yinameah/zemscripten#06d49243789d638ba10d4af004c46df4da83579c", + .hash = "zemscripten-0.2.0-dev-sRlDqKFRAAAXl8aICu541O6PiY70v4HIr3FTmCg--WqM", }, },