48 lines
1.4 KiB
Zig
48 lines
1.4 KiB
Zig
const std = @import("std");
|
|
|
|
const material_max_len_default: usize = 40;
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const material_max_len = b.option(
|
|
usize,
|
|
"material-max-len",
|
|
"Maximum length a material name can have",
|
|
) orelse material_max_len_default;
|
|
const lib_options = b.addOptions();
|
|
lib_options.addOption(usize, "material_max_len", material_max_len);
|
|
|
|
const zap_dep = b.dependency("zap", .{ .openssl = false });
|
|
const clap_dep = b.dependency("clap", .{});
|
|
|
|
const lib_mod = b.addModule("craftflut", .{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
});
|
|
lib_mod.addOptions("build_options", lib_options);
|
|
lib_mod.addImport("zap", zap_dep.module("zap"));
|
|
|
|
const exe_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
exe_mod.addImport("craftflut", lib_mod);
|
|
exe_mod.addImport("clap", clap_dep.module("clap"));
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "craftflut",
|
|
.root_module = exe_mod,
|
|
});
|
|
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);
|
|
}
|