all: build: thisDir improvements (#570)

* build:all: thisDir improvements

more performant output, usage code reducement and compileError for wrong usage

* glfw: update deprecated code
This commit is contained in:
Ali Chraghi 2022-09-29 19:11:46 +03:30 committed by GitHub
parent a8d8fedf95
commit 82e10f4f28
Failed to generate hash of commit
13 changed files with 196 additions and 148 deletions

View file

@ -2,13 +2,17 @@ const std = @import("std");
pub const pkg = std.build.Pkg{
.name = "gamemode",
.source = .{ .path = thisDir() ++ "/gamemode.zig" },
.source = .{ .path = sdkPath("/gamemode.zig") },
};
pub fn link(step: *std.build.LibExeObjStep) void {
step.addIncludePath(comptime thisDir() ++ "/upstream/include");
step.addIncludePath(sdkPath("/upstream/include"));
}
fn thisDir() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
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;
};
}