Feature/zig 0.15 upgrade (#1)

* fix: adjust build and stdout

* fix: compiles on 0.15

* fix: fix io changes

* fix: update github action zig version
This commit is contained in:
Tilo
2025-10-05 18:40:15 +02:00
committed by GitHub
parent 0b60592e61
commit d17540cb33
4 changed files with 55 additions and 46 deletions

View File

@@ -15,8 +15,7 @@ pub fn build(b: *std.Build) void {
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
.name = "csvu",
const lib = b.addModule("csvu", .{
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
.root_source_file = b.path("src/root.zig"),
@@ -27,13 +26,11 @@ pub fn build(b: *std.Build) void {
// This declares intent for the library to be installed into the standard
// location when the user invokes the "install" step (the default step when
// running `zig build`).
b.installArtifact(lib);
//b.installArtifact(lib);
const exe = b.addExecutable(.{
.name = "csvu",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "csvu", .module = lib }} }),
});
// This declares intent for the executable to be installed into the
@@ -67,17 +64,21 @@ pub fn build(b: *std.Build) void {
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const lib_unit_tests = b.addTest(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);