Skip to content

Commit

Permalink
add addPathsToModule functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
slimsag committed Feb 1, 2024
1 parent 5b4e027 commit 072635a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});
addPaths(lib); // just for testing
addPathsToModule(&lib.root_module); // just for testing
lib.linkLibC();
lib.installHeadersDirectory("include", ".");
b.installArtifact(lib);
Expand All @@ -22,6 +23,12 @@ pub fn addPaths(step: *std.Build.Step.Compile) void {
step.addLibraryPath(.{ .path = sdkPath("/lib") });
}

pub fn addPathsToModule(mod: *std.Build.Module) void {
mod.addSystemFrameworkPath(.{ .path = sdkPath("/Frameworks") });
mod.addSystemIncludePath(.{ .path = sdkPath("/include") });
mod.addLibraryPath(.{ .path = sdkPath("/lib") });
}

fn sdkPath(comptime suffix: []const u8) []const u8 {
if (suffix[0] != '/') @compileError("suffix must be an absolute path");
return comptime blk: {
Expand Down

0 comments on commit 072635a

Please sign in to comment.