const std = @import("std"); pub fn build(b: *std.build.Builder) !void { const mode = b.standardReleaseOptions(); const lib = b.addSharedLibrary("cart", "src/main.zig", .unversioned); lib.setBuildMode(mode); lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }); lib.import_memory = true; lib.initial_memory = 65536; lib.max_memory = 65536; lib.stack_size = 14752; // Export WASM-4 symbols lib.export_symbol_names = &[_][]const u8{ "start", "update" }; lib.install(); const run_cmd = b.addSystemCommand(&.{"w4", "run-native"}); run_cmd.step.dependOn(&lib.step); run_cmd.addFileSourceArg(lib.getOutputSource()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run Cartridge with w4"); run_step.dependOn(&run_cmd.step); }