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. - diff --git a/build.zig b/build.zig index 3e4e0fa..c4a205c 100644 --- a/build.zig +++ b/build.zig @@ -181,7 +181,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 { @@ -256,7 +256,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(.{