[emcc] Fix build for Windows (#86)

Co-authored-by: DanielKMach <danikoucher@gmail.com>
This commit is contained in:
Not-Nik 2024-11-08 15:18:20 +01:00
parent f5abffe4f7
commit a420751c0d
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784

View File

@ -92,7 +92,10 @@ pub fn linkWithEmscripten(
} }
// Create the output directory because emcc can't do it. // Create the output directory because emcc can't do it.
const mkdir_command = b.addSystemCommand(&[_][]const u8{ "mkdir", "-p", emccOutputDir }); const mkdir_command = switch (builtin.os.tag) {
.windows => b.addSystemCommand(&.{ "cmd.exe", "/c", "if", "not", "exist", emccOutputDir, "mkdir", emccOutputDir }),
else => b.addSystemCommand(&.{ "mkdir", "-p", emccOutputDir }),
};
// Actually link everything together. // Actually link everything together.
const emcc_command = b.addSystemCommand(&[_][]const u8{emcc_run_arg}); const emcc_command = b.addSystemCommand(&[_][]const u8{emcc_run_arg});