build: use std.Build.path

This commit is contained in:
Tim Culverhouse 2024-04-19 16:22:46 -08:00
parent b93a5d2c72
commit cde945f2ef

View file

@ -3,7 +3,7 @@ const std = @import("std");
pub fn build(b: *std.Build) void { pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const root_source_file = std.Build.LazyPath.relative("src/main.zig"); const root_source_file = b.path("src/main.zig");
// Dependencies // Dependencies
const ziglyph_dep = b.dependency("ziglyph", .{ const ziglyph_dep = b.dependency("ziglyph", .{
@ -48,7 +48,7 @@ pub fn build(b: *std.Build) void {
const example = b.addExecutable(.{ const example = b.addExecutable(.{
.name = "example", .name = "example",
// future versions should use b.path, see zig PR #19597 // future versions should use b.path, see zig PR #19597
.root_source_file = std.Build.LazyPath.relative( .root_source_file = b.path(
b.fmt("examples/{s}.zig", .{@tagName(example_option)}), b.fmt("examples/{s}.zig", .{@tagName(example_option)}),
), ),
.target = target, .target = target,
@ -62,7 +62,7 @@ pub fn build(b: *std.Build) void {
const tests_step = b.step("test", "Run tests"); const tests_step = b.step("test", "Run tests");
const tests = b.addTest(.{ const tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = b.path("src/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });