2022-04-24 09:46:36 +00:00
|
|
|
const std = @import("std");
|
|
|
|
|
2022-07-01 18:23:39 +00:00
|
|
|
pub fn mapgen(b: *std.build.Step) !void {
|
|
|
|
_ = b;
|
|
|
|
var alloc = std.heap.page_allocator;
|
2022-07-01 19:08:30 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
2022-06-27 00:47:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn build(b: *std.build.Builder) !void {
|
2022-07-01 18:23:39 +00:00
|
|
|
const map_step = b.step("mapgen", "generate maps");
|
|
|
|
map_step.makeFn = mapgen;
|
|
|
|
|
2022-06-27 00:47:20 +00:00
|
|
|
const mode = b.standardReleaseOptions();
|
2022-06-26 23:32:01 +00:00
|
|
|
const lib = b.addSharedLibrary("cart", "src/main.zig", .unversioned);
|
2022-07-01 19:08:30 +00:00
|
|
|
//lib.step.dependOn(map_step);
|
2022-07-01 18:23:39 +00:00
|
|
|
|
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;
|
2022-07-01 18:23:39 +00:00
|
|
|
lib.stack_size = 14752;
|
|
|
|
|
2022-04-24 09:46:36 +00:00
|
|
|
lib.export_symbol_names = &[_][]const u8{ "start", "update" };
|
|
|
|
lib.install();
|
2022-06-27 00:47:20 +00:00
|
|
|
}
|