generated from mg/zig-template
added SmolStr
This commit is contained in:
parent
650a824b16
commit
2116081424
6 changed files with 132 additions and 50 deletions
37
build.zig
37
build.zig
|
|
@ -4,63 +4,34 @@ pub fn build(b: *std.Build) void {
|
|||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const lib_mod = b.createModule(.{
|
||||
const lib_mod = b.addModule("smolstr", .{
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const exe_mod = b.createModule(.{
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
exe_mod.addImport("zig_template_lib", lib_mod);
|
||||
|
||||
const lib = b.addLibrary(.{
|
||||
.linkage = .static,
|
||||
.name = "zig_template",
|
||||
.name = "smolstr",
|
||||
.root_module = lib_mod,
|
||||
});
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "zig_template",
|
||||
.root_module = exe_mod,
|
||||
});
|
||||
|
||||
b.installArtifact(lib);
|
||||
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);
|
||||
|
||||
const lib_unit_tests = b.addTest(.{
|
||||
.root_module = lib_mod,
|
||||
});
|
||||
|
||||
const exe_unit_tests = b.addTest(.{
|
||||
.root_module = exe_mod,
|
||||
});
|
||||
|
||||
const ext_tests = b.addTest(.{
|
||||
.root_source_file = b.path("tests/root.zig"),
|
||||
});
|
||||
|
||||
ext_tests.root_module.addImport("smolstr", lib.root_module);
|
||||
|
||||
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
||||
const run_exe_unit_tests = b.addRunArtifact(exe_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_exe_unit_tests.step);
|
||||
test_step.dependOn(&run_ext_tests.step);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue