Closed glennyonemitsu closed 3 years ago
This API usage still works in master
I might be misunderstanding something, but this did not for me.
$../zig version
0.9.0-dev.952+0c091feb5
$cat build.zig
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("p", "src/main.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.addPackage(.{
.name = "table-helper",
.path = "libs/table-helper/table-helper.zig",
});
exe.install();
const run_cmd = exe.run();
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);
}
$../zig build
./build.zig:20:17: error: expected type 'std.build.FileSource', found '*const [34:0]u8'
.path = "libs/table-helper/table-helper.zig",
^
<omitted>:1355:24: note: std.build.FileSource declared here
pub const FileSource = union(enum) {
^
What made this API method work for me is this (or the diff in this PR):
exe.addPackage(.{
.name = "table-helper",
.path = std.build.FileSource{ .path = "libs/table-helper/table-helper.zig" },
});
Sorry you were totally right, I misread the diff.
I see now how my PR might have just been seen as a pointless method switch.
Thank you for reconsidering my PR and accepting it.
In both Zig
0.8
andmaster
this didn't comply with the API.