From 960097ffb85fffe95b23794eef6796c91b35e780 Mon Sep 17 00:00:00 2001 From: Frank Fischer Date: Fri, 7 Jun 2024 18:54:53 +0200 Subject: [PATCH] build.zig: fix file paths using `b.path` In zig 0.13 paths should be generated using the `b.path` method, which returns a lazy relative to the project source. --- build.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index 03cd798..c8c8978 100644 --- a/build.zig +++ b/build.zig @@ -5,21 +5,21 @@ pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); const uuid_module = b.addModule("uuid", .{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), }); try b.modules.put(b.dupe("uuid"), uuid_module); const lib = b.addStaticLibrary(.{ .name = "uuid-zig", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); b.installArtifact(lib); const main_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); @@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void { fn addExample(b: *std.Build, uuid_module: *std.Build.Module, exeName: []const u8, sourceFile: []const u8, target: std.Build.ResolvedTarget) *std.Build.Step.Run { const exe = b.addExecutable(.{ .name = exeName, - .root_source_file = .{ .path = sourceFile }, + .root_source_file = b.path(sourceFile), .target = target, }); exe.root_module.addImport("uuid-zig", uuid_module); @@ -58,7 +58,7 @@ fn addExample(b: *std.Build, uuid_module: *std.Build.Module, exeName: []const u8 fn addBenchmark(b: *std.Build, uuid_module: *std.Build.Module, exeName: []const u8, sourceFile: []const u8, target: std.Build.ResolvedTarget) *std.Build.Step.Run { const exe = b.addExecutable(.{ .name = exeName, - .root_source_file = .{ .path = sourceFile }, + .root_source_file = b.path(sourceFile), .optimize = .ReleaseFast, .target = target, });