81 lines
2.3 KiB
Zig
81 lines
2.3 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const ds = b.dependency("ds", .{});
|
|
const cargs = b.dependency("cargs", .{});
|
|
const log = b.dependency("log.c", .{});
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "wom",
|
|
.root_module = b.createModule(.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.link_libc = true,
|
|
}),
|
|
});
|
|
|
|
const games = b.addLibrary(.{
|
|
.name = "games",
|
|
.linkage = .static,
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/subcmds/arcade/arcade.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.link_libc = true,
|
|
}),
|
|
});
|
|
games.pie = true;
|
|
|
|
exe.root_module.addCSourceFiles(.{
|
|
.files = &.{
|
|
"src/main.c",
|
|
"src/conf.c",
|
|
"src/api.c",
|
|
|
|
"src/subcmds/clock.c",
|
|
"src/subcmds/dev.c",
|
|
"src/subcmds/motd.c",
|
|
"src/subcmds/project.c",
|
|
"src/subcmds/subcmds.c",
|
|
|
|
"src/lua/wom.c",
|
|
"src/lua/wom_fs.c",
|
|
},
|
|
.flags = &.{
|
|
"-DVERSION=\"hi\"",
|
|
"-std=c23",
|
|
"-D_GNU_SOURCE",
|
|
"-MJcompile_commands.json",
|
|
}
|
|
});
|
|
|
|
exe.root_module.linkLibrary(games);
|
|
exe.root_module.linkSystemLibrary("lua", .{});
|
|
|
|
exe.root_module.addIncludePath(b.path("include"));
|
|
exe.root_module.addLibraryPath(ds.path("."));
|
|
exe.root_module.addLibraryPath(cargs.path("src"));
|
|
exe.root_module.addLibraryPath(log.path("src"));
|
|
|
|
exe.addCSourceFile(.{ .file = ds.builder.path("./ds.c") });
|
|
exe.addCSourceFile(.{ .file = cargs.builder.path("src/cargs.c") });
|
|
exe.addCSourceFile(.{ .file = log.builder.path("./src/log.c") });
|
|
|
|
exe.root_module.addIncludePath(ds.path("."));
|
|
exe.root_module.addIncludePath(cargs.path("include"));
|
|
exe.root_module.addIncludePath(log.path("src"));
|
|
b.installArtifact(exe);
|
|
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
|
|
if (b.args) |args| {
|
|
run_cmd.addArgs(args);
|
|
}
|
|
|
|
const run_step = b.step("run", "Run the app");
|
|
run_step.dependOn(&run_cmd.step);
|
|
}
|