100 lines
2.8 KiB
Zig
100 lines
2.8 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const sandbox_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
const sandbox_exe = b.addExecutable(.{
|
|
.name = "sandbox_ftime",
|
|
.root_module = sandbox_mod,
|
|
});
|
|
|
|
const console_exe_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/console_main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
const console_exe = b.addExecutable(.{
|
|
.name = "ftime",
|
|
.root_module = console_exe_mod,
|
|
});
|
|
|
|
const gui_exe_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/gui_main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
const gui_exe = b.addExecutable(.{
|
|
.name = "filetime",
|
|
.root_module = gui_exe_mod,
|
|
});
|
|
|
|
//Dependencies
|
|
|
|
const vaxis = b.dependency("vaxis", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
console_exe.root_module.addImport("vaxis", vaxis.module("vaxis"));
|
|
|
|
const dvui = b.dependency("dvui", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.backend = .raylib,
|
|
});
|
|
|
|
gui_exe.root_module.addImport("dvui", dvui.module("dvui_raylib"));
|
|
|
|
// Import the dependency
|
|
const zigrc_dep = b.dependency("zigrc", .{});
|
|
|
|
// Extract the module
|
|
const zigrc_mod = zigrc_dep.artifact("zig-rc").root_module;
|
|
|
|
console_exe.root_module.addImport("zigrc", zigrc_mod);
|
|
gui_exe.root_module.addImport("zigrc", zigrc_mod);
|
|
|
|
|
|
b.installArtifact(console_exe);
|
|
b.installArtifact(gui_exe);
|
|
// Run commands
|
|
|
|
const run_sandbox_cmd = b.addRunArtifact(sandbox_exe);
|
|
run_sandbox_cmd.step.dependOn(b.getInstallStep());
|
|
|
|
const run_console_cmd = b.addRunArtifact(console_exe);
|
|
run_console_cmd.step.dependOn(b.getInstallStep());
|
|
|
|
const run_gui_cmd = b.addRunArtifact(gui_exe);
|
|
run_gui_cmd.step.dependOn(b.getInstallStep());
|
|
|
|
if (b.args) |args| {
|
|
run_console_cmd.addArgs(args);
|
|
run_gui_cmd.addArgs(args);
|
|
}
|
|
|
|
const run_sandbox_step = b.step("run:s", "Run the sandbox");
|
|
run_sandbox_step.dependOn(&run_sandbox_cmd.step);
|
|
|
|
const run_console_step = b.step("run:console", "Run the console app");
|
|
run_console_step.dependOn(&run_console_cmd.step);
|
|
|
|
const run_gui_step = b.step("run:gui", "Run the gui app");
|
|
run_gui_step.dependOn(&run_gui_cmd.step);
|
|
|
|
// const console_unit_tests = b.addTest(.{
|
|
// .root_module = console_exe_mod,
|
|
// });
|
|
//
|
|
// const run_console_unit_tests = b.addRunArtifact(console_unit_tests);
|
|
//
|
|
// const test_step = b.step("test", "Run unit console tests");
|
|
// test_step.dependOn(&run_console_unit_tests.step);
|
|
}
|