ledbox/build.zig
2025-04-05 16:12:50 -06:00

74 lines
2 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
// const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const wasm_mod = b.createModule(.{
.root_source_file = b.path("src/wasm.zig"),
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
}),
// .optimize = .ReleaseSafe,
.optimize = optimize,
});
const wasm = b.addExecutable(.{
.name = "ledbox",
.root_module = wasm_mod,
});
wasm.entry = .disabled;
wasm.rdynamic = true;
wasm.import_memory = true;
wasm.initial_memory = std.wasm.page_size * 2;
wasm.max_memory = std.wasm.page_size * 2;
wasm.stack_size = std.wasm.page_size;
wasm.global_base = 6560;
b.installArtifact(wasm);
// const lib_mod = b.createModule(.{
// .root_source_file = b.path("src/root.zig"),
// .target = target,
// .optimize = optimize,
// });
// const exe_mod = b.createModule(.{
// .root_source_file = b.path("src/main.zig"),
// .target = target,
// .optimize = optimize,
// });
// exe_mod.addImport("ledbox_lib", lib_mod);
// const lib = b.addLibrary(.{
// .linkage = .static,
// .name = "ledbox",
// .root_module = lib_mod,
// });
// b.installArtifact(lib);
// const exe = b.addExecutable(.{
// .name = "ledbox",
// .root_module = exe_mod,
// });
// b.installArtifact(exe);
// const lib_unit_tests = b.addTest(.{
// .root_module = lib_mod,
// });
// const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
// const exe_unit_tests = b.addTest(.{
// .root_module = exe_mod,
// });
// const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
// const test_step = b.step("test", "Run unit tests");
// test_step.dependOn(&run_lib_unit_tests.step);
// test_step.dependOn(&run_exe_unit_tests.step);
}