Skip to content

Commit 67f606a

Browse files
authored
Use LazyPath for shell_file_path (#13)
1 parent 97eb64f commit 67f606a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Add zemscripten's "root" module to your wasm compile target., then create an `em
2727
wasm.root_module.addImport("zemscripten", zemscripten.module("root"));
2828
2929
const emcc_flags = @import("zemscripten").emccDefaultFlags(b.allocator, optimize);
30-
30+
3131
var emcc_settings = @import("zemscripten").emccDefaultSettings(b.allocator, .{
3232
.optimize = optimize,
3333
});
@@ -65,7 +65,7 @@ To use a custom html file emccStep() accepts a shell_file_path option:
6565
.embed_paths = &.{},
6666
.preload_paths = &.{},
6767
.install_dir = .{ .custom = "web" },
68-
.shell_file_path = "path/to/file"
68+
.shell_file_path = b.path("path/to/file"),
6969
},
7070
);
7171
```
@@ -103,4 +103,3 @@ You can also define a run step that invokes `emrun`. This will serve the html lo
103103
b.step("emrun", "Build and open the web app locally using emrun").dependOn(emrun_step);
104104
```
105105
See the [emrun documentation](https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html) for the difference args that can be used.
106-

build.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub fn emccStep(
181181
use_preload_plugins: bool = false,
182182
embed_paths: ?[]const EmccFilePath = null,
183183
preload_paths: ?[]const EmccFilePath = null,
184-
shell_file_path: ?[]const u8 = null,
184+
shell_file_path: ?std.Build.LazyPath = null,
185185
install_dir: std.Build.InstallDir,
186186
},
187187
) *std.Build.Step {
@@ -256,7 +256,9 @@ pub fn emccStep(
256256
}
257257

258258
if (options.shell_file_path) |shell_file_path| {
259-
emcc.addArgs(&.{ "--shell-file", shell_file_path });
259+
emcc.addArg("--shell-file");
260+
emcc.addFileArg(shell_file_path);
261+
emcc.addFileInput(shell_file_path);
260262
}
261263

262264
const install_step = b.addInstallDirectory(.{

0 commit comments

Comments
 (0)