Two breaking changes from the 0.17 release: Build.args removed from configure phase (Run step passthru args), and std.meta.fields deprecated in favor of @typeInfo (Enum now exposes field_names / field_values arrays instead of StructField objects). Unit tests + test_linear selftest pass under 0.17.0. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
61 lines
1.9 KiB
Zig
61 lines
1.9 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
// The library module — what downstream consumers import.
|
|
const cruc_mod = b.addModule("crucible", .{
|
|
.root_source_file = b.path("src/crucible.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
// Static lib artifact (optional install).
|
|
const lib = b.addLibrary(.{
|
|
.name = "crucible",
|
|
.root_module = cruc_mod,
|
|
});
|
|
b.installArtifact(lib);
|
|
|
|
// Example executable: stripsolver (self-contained: uses crucible only
|
|
// for state dict + layers; arm input comes from CSV).
|
|
const example_mod = b.createModule(.{
|
|
.root_source_file = b.path("examples/stripsolver.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "crucible", .module = cruc_mod },
|
|
},
|
|
});
|
|
const example = b.addExecutable(.{
|
|
.name = "stripsolver",
|
|
.root_module = example_mod,
|
|
});
|
|
b.installArtifact(example);
|
|
|
|
const run_example = b.addRunArtifact(example);
|
|
run_example.step.dependOn(b.getInstallStep());
|
|
run_example.addPassthruArgs();
|
|
const run_step = b.step("run", "Run the stripsolver example");
|
|
run_step.dependOn(&run_example.step);
|
|
|
|
// linear selftest
|
|
const tl_mod = b.createModule(.{
|
|
.root_source_file = b.path("examples/test_linear.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "crucible", .module = cruc_mod },
|
|
},
|
|
});
|
|
const tl = b.addExecutable(.{ .name = "test_linear", .root_module = tl_mod });
|
|
b.installArtifact(tl);
|
|
|
|
// Unit tests.
|
|
const tests = b.addTest(.{ .root_module = cruc_mod });
|
|
const run_tests = b.addRunArtifact(tests);
|
|
const test_step = b.step("test", "Run unit tests");
|
|
test_step.dependOn(&run_tests.step);
|
|
}
|