2025-04-07 22:23:32 +00:00
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
|
|
|
|
|
|
const lib_mod = b.createModule(.{
|
|
|
|
|
.root_source_file = b.path("src/root.zig"),
|
|
|
|
|
.target = target,
|
|
|
|
|
.optimize = optimize,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const lib = b.addLibrary(.{
|
|
|
|
|
.linkage = .static,
|
2025-04-08 00:33:12 +02:00
|
|
|
.name = "smol_str",
|
2025-04-07 22:23:32 +00:00
|
|
|
.root_module = lib_mod,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
b.installArtifact(lib);
|
|
|
|
|
|
|
|
|
|
const lib_unit_tests = b.addTest(.{
|
|
|
|
|
.root_module = lib_mod,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const ext_tests = b.addTest(.{
|
|
|
|
|
.root_source_file = b.path("tests/root.zig"),
|
|
|
|
|
});
|
|
|
|
|
|
2025-04-08 00:33:12 +02:00
|
|
|
ext_tests.root_module.addImport("smol_str", lib.root_module);
|
|
|
|
|
|
2025-04-07 22:23:32 +00:00
|
|
|
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
|
|
|
|
const run_ext_tests = b.addRunArtifact(ext_tests);
|
|
|
|
|
|
|
|
|
|
const test_step = b.step("test", "Run unit tests");
|
|
|
|
|
test_step.dependOn(&run_lib_unit_tests.step);
|
|
|
|
|
test_step.dependOn(&run_ext_tests.step);
|
|
|
|
|
}
|