This reverts commit a1fe671db8.
Lue suggested reverting #661 because ZLS worked around the issue of @src
being relative in that environment: https://github.com/zigtools/zls/pull/898
This is not a perfect solution (what zls did seems to be a workaround), but
is good enough for us until Zig gets an official package manager.
18 lines
524 B
Zig
18 lines
524 B
Zig
const std = @import("std");
|
|
|
|
pub const pkg = std.build.Pkg{
|
|
.name = "gamemode",
|
|
.source = .{ .path = sdkPath("/gamemode.zig") },
|
|
};
|
|
|
|
pub fn link(step: *std.build.LibExeObjStep) void {
|
|
step.addIncludePath(sdkPath("/upstream/include"));
|
|
}
|
|
|
|
fn sdkPath(comptime suffix: []const u8) []const u8 {
|
|
if (suffix[0] != '/') @compileError("suffix must be an absolute path");
|
|
return comptime blk: {
|
|
const root_dir = std.fs.path.dirname(@src().file) orelse ".";
|
|
break :blk root_dir ++ suffix;
|
|
};
|
|
}
|