2022-04-24 09:46:36 +00:00
|
|
|
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();
|
2022-04-24 13:05:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2022-04-24 09:46:36 +00:00
|
|
|
}
|