authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-12-28 19:33:24 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-12-28 19:33:24 -08:00
logb7abb501e62646641eaa22672c24fdef0106a512
treed4f6b2a192ceed8071e276b0187418ab824a5e48
parent60f0de9eb5d6c8acb1b7cea4a751751c122c272f

update to zig 0.13


3 files changed, 9 insertions(+), 7 deletions(-)

.gitignore-1
...@@ -1,4 +1,3 @@...@@ -1,4 +1,3 @@
1zig-cache
2.zig-cache1.zig-cache
3zig-out2zig-out
4.zigmod3.zigmod
build.zig+8-6
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const deps = @import("./deps.zig");
23
3pub fn build(b: *std.Build) void {4pub fn build(b: *std.Build) void {
4 const target = b.standardTargetOptions(.{});5 const target = b.standardTargetOptions(.{});
5 const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug;6 const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug;
67
7 const mod = b.addModule("tracer", .{ .source_file = .{ .path = "src/mod.zig" } });8 const mod = b.addModule("tracer", .{ .root_source_file = b.path("src/mod.zig") });
89
9 addTest(b, target, mode, mod, 0);10 addTest(b, target, mode, mod, 0);
10 addTest(b, target, mode, mod, 1);11 addTest(b, target, mode, mod, 1);
...@@ -12,22 +13,23 @@ pub fn build(b: *std.Build) void {...@@ -12,22 +13,23 @@ pub fn build(b: *std.Build) void {
12 addTest(b, target, mode, mod, 3);13 addTest(b, target, mode, mod, 3);
1314
14 const test_step = b.step("test", "dummy test step to pass CI checks");15 const test_step = b.step("test", "dummy test step to pass CI checks");
15 _ = test_step;16 test_step.dependOn(b.default_step);
16}17}
1718
18fn addTest(b: *std.Build, target: std.zig.CrossTarget, mode: std.builtin.Mode, mod: *std.build.Module, comptime backend: u8) void {19fn addTest(b: *std.Build, target: std.Build.ResolvedTarget, mode: std.builtin.Mode, mod: *std.Build.Module, comptime backend: u8) void {
20 _ = mod;
19 const options = b.addOptions();21 const options = b.addOptions();
20 options.addOption(usize, "src_file_trimlen", std.fs.path.dirname(std.fs.path.dirname(@src().file).?).?.len);22 options.addOption(usize, "src_file_trimlen", std.fs.path.dirname(std.fs.path.dirname(@src().file).?).?.len);
21 options.addOption(u8, "backend", backend);23 options.addOption(u8, "backend", backend);
2224
23 const exe = b.addExecutable(.{25 const exe = b.addExecutable(.{
24 .name = "test" ++ std.fmt.comptimePrint("{d}", .{backend}),26 .name = "test" ++ std.fmt.comptimePrint("{d}", .{backend}),
25 .root_source_file = .{ .path = "src/main.zig" },27 .root_source_file = b.path("src/main.zig"),
26 .target = target,28 .target = target,
27 .optimize = mode,29 .optimize = mode,
28 });30 });
31 deps.addAllTo(exe);
29 exe.linkLibC();32 exe.linkLibC();
30 exe.addModule("tracer", mod);33 exe.root_module.addImport("build_options", options.createModule());
31 exe.addOptions("build_options", options);
32 b.installArtifact(exe);34 b.installArtifact(exe);
33}35}
src/main.zig+1
...@@ -16,6 +16,7 @@ pub fn main() !void {...@@ -16,6 +16,7 @@ pub fn main() !void {
1616
17 // main loop17 // main loop
18 var go = false;18 var go = false;
19 _ = &go;
19 while (go) {20 while (go) {
20 try tracer.init_thread(std.fs.cwd());21 try tracer.init_thread(std.fs.cwd());
21 defer tracer.deinit_thread();22 defer tracer.deinit_thread();