39 lines
1.2 KiB
Zig
39 lines
1.2 KiB
Zig
const std = @import("std");
|
|
const CrossTarget = std.zig.CrossTarget;
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const nativeTarget = b.standardTargetOptions(.{});
|
|
const wasmTarget = b.resolveTargetQuery(.{
|
|
.cpu_arch = .wasm32,
|
|
.os_tag = .freestanding,
|
|
});
|
|
|
|
const add_up_to_mod = b.createModule(.{
|
|
.root_source_file = b.path("addupto.zig"),
|
|
.target = wasmTarget,
|
|
.optimize = .ReleaseFast,
|
|
});
|
|
const add_up_to_native_mod = b.createModule(.{
|
|
.root_source_file = b.path("addupto.zig"),
|
|
.target = nativeTarget,
|
|
});
|
|
|
|
const add_up_to = b.addExecutable(.{
|
|
.name = "addUpTo",
|
|
.root_module = add_up_to_mod,
|
|
});
|
|
add_up_to.entry = .disabled;
|
|
add_up_to.rdynamic = true;
|
|
b.installArtifact(add_up_to);
|
|
|
|
const add_up_to_uts = b.addTest(.{
|
|
.root_module = add_up_to_native_mod,
|
|
});
|
|
const run_add_up_to_uts = b.addRunArtifact(add_up_to_uts);
|
|
|
|
// Similar to creating the run step earlier, this exposes a `test` step to
|
|
// the `zig build --help` menu, providing a way for the user to request
|
|
// running the unit tests.
|
|
const test_step = b.step("test", "Run unit tests");
|
|
test_step.dependOn(&run_add_up_to_uts.step);
|
|
}
|