Skip to content

Commit 31af33a

Browse files
committed
Add optional out_file_name to StepOptions.
Allow overriding the output filename arg passed to emcc. Resolves #15
1 parent 3fa4b77 commit 31af33a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

build.zig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ pub const StepOptions = struct {
182182
embed_paths: ?[]const EmccFilePath = null,
183183
preload_paths: ?[]const EmccFilePath = null,
184184
shell_file_path: ?std.Build.LazyPath = null,
185+
out_file_name: ?[]const u8 = null,
185186
install_dir: std.Build.InstallDir,
186187
};
187188

@@ -226,7 +227,13 @@ pub fn emccStep(
226227
}
227228

228229
emcc.addArg("-o");
229-
const out_file = emcc.addOutputFileArg(b.fmt("{s}.html", .{wasm.name}));
230+
const out_file = out_file: {
231+
if (options.out_file_name) |out_file_name| {
232+
break :out_file emcc.addOutputFileArg(out_file_name);
233+
} else {
234+
break :out_file emcc.addOutputFileArg(b.fmt("{s}.html", .{wasm.name}));
235+
}
236+
};
230237

231238
if (options.use_preload_plugins) {
232239
emcc.addArg("--use-preload-plugins");

0 commit comments

Comments
 (0)