37 lines
1.1 KiB
Zig
37 lines
1.1 KiB
Zig
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);
|
|
|
|
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;
|
|
|
|
lib.export_symbol_names = &[_][]const u8{ "start", "update" };
|
|
lib.install();
|
|
}
|