Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -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"),
},
);
```
Expand Down Expand Up @@ -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.

6 changes: 4 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(.{
Expand Down
Loading