From 125fa230e8a79815cb5eef468dab5cfa09a0c5f7 Mon Sep 17 00:00:00 2001 From: rodolpheh Date: Wed, 20 Aug 2025 23:15:57 +0100 Subject: [PATCH 1/2] Make shell_file_path a LazyPath --- build.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 27d7136..8185831 100644 --- a/build.zig +++ b/build.zig @@ -165,7 +165,7 @@ pub fn emccStep( use_preload_plugins: bool = false, embed_paths: ?[]const EmccFilePath = null, preload_paths: ?[]const EmccFilePath = null, - shell_file_path: ?[]const u8 = null, + shell_file_path: ?std.Build.LazyPath = null, install_dir: std.Build.InstallDir, }, ) *std.Build.Step { @@ -240,7 +240,9 @@ pub fn emccStep( } if (options.shell_file_path) |shell_file_path| { - emcc.addArgs(&.{ "--shell-file", shell_file_path }); + emcc.addArg("--shell-file"); + emcc.addFileArg(shell_file_path); + emcc.addFileInput(shell_file_path); } const install_step = b.addInstallDirectory(.{ From e1da691261b13993ca344d089cc29dab06adfe12 Mon Sep 17 00:00:00 2001 From: rodolpheh Date: Wed, 20 Aug 2025 23:18:14 +0100 Subject: [PATCH 2/2] Update README --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d899efa..206bd94 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Add zemscripten's "root" module to your wasm compile target., then create an `em wasm.root_module.addImport("zemscripten", zemscripten.module("root")); const emcc_flags = @import("zemscripten").emccDefaultFlags(b.allocator, optimize); - + var emcc_settings = @import("zemscripten").emccDefaultSettings(b.allocator, .{ .optimize = optimize, }); @@ -65,7 +65,7 @@ To use a custom html file emccStep() accepts a shell_file_path option: .embed_paths = &.{}, .preload_paths = &.{}, .install_dir = .{ .custom = "web" }, - .shell_file_path = "path/to/file" + .shell_file_path = b.path("path/to/file"), }, ); ``` @@ -103,4 +103,3 @@ You can also define a run step that invokes `emrun`. This will serve the html lo b.step("emrun", "Build and open the web app locally using emrun").dependOn(emrun_step); ``` See the [emrun documentation](https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html) for the difference args that can be used. -