Files
omtoy/build.zig
Kasper Sauramo d4e42514ff reorganize project (wip)
We can build omt again, but something weird happens on import
2025-10-21 23:25:49 +03:00

57 lines
1.6 KiB
Zig

//
// Omtoy build script
//
// Build required OMT parts and link against our code
//
// Run `zig build omt` to build dependencies before anything else.
//
// I don't know yet how to best create a conditional step to build and install
// the dependencies only if they aren't installed yet. Just putting the installs
// as dependencies runs the omt build scripts on every `zig build`.
//
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const zomt = b.dependency("omt", .{
.target = target,
.optimize = optimize,
});
const exe = b.addExecutable((.{
.name = "omtoy",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
}),
}));
exe.root_module.addImport("omt", zomt.module("zomt"));
exe.addLibraryPath(b.path("omt/zig-out/lib/"));
b.installArtifact(exe);
// Run step
const run_step = b.step("run", "Run Omtoy");
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
// TODO: write tests and stuff
// const exe_tests = b.addTest(.{
// .root_module = sender_exe.root_module,
// });
// const run_exe_tests = b.addRunArtifact(exe_tests);
// const test_step = b.step("test", "Run tests");
// test_step.dependOn(&run_exe_tests.step);
}