tamamo/build.zig

37 lines
1.1 KiB
Zig
Raw Normal View History

2022-04-24 09:46:36 +00:00
const std = @import("std");
pub fn mapgen(b: *std.build.Step) !void {
_ = b;
var alloc = std.heap.page_allocator;
const maps = [_][2][]const u8{
[2][]const u8{"./maps/TestMap.json", "./src/maps/test.zig"},
[2][]const u8{"./maps/RPGmap.json", "./src/maps/rpg.zig"},
};
for (&maps) |map| {
var deno = std.ChildProcess.init(&.{"deno", "run", "-A", "./src/tools/genmap.js", map[0], map[1]}, alloc);
try deno.spawn();
_ = try deno.wait();
}
}
pub fn build(b: *std.build.Builder) !void {
const map_step = b.step("mapgen", "generate maps");
map_step.makeFn = mapgen;
const mode = b.standardReleaseOptions();
const lib = b.addSharedLibrary("cart", "src/main.zig", .unversioned);
//lib.step.dependOn(map_step);
2022-04-24 09:46:36 +00:00
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;
2022-04-24 09:46:36 +00:00
lib.export_symbol_names = &[_][]const u8{ "start", "update" };
lib.install();
}