60 lines
1.7 KiB
Zig
60 lines
1.7 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_dep = b.dependency("zomt", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
const zomt_mod = zomt_dep.module("zomt");
|
|
|
|
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.addLibraryPath(zomt_dep.namedLazyPath("output_dir"));
|
|
exe.root_module.addIncludePath(zomt_dep.namedLazyPath("output_dir"));
|
|
// exe.root_module.linkSystemLibrary("omt", .{});
|
|
exe.root_module.addImport("zomt", zomt_mod);
|
|
|
|
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);
|
|
}
|