From 08292e58f3456609f9c64bcc310a56a82cd6d86b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 17 Aug 2022 14:53:34 -0700 Subject: [PATCH] add system SDK to build to enable cross compilation --- build.zig | 8 +++++--- pkg/freetype/build.zig | 3 ++- pkg/libuv/build.zig | 3 ++- pkg/tracy/build.zig | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build.zig b/build.zig index fa16e9299..6ccb5d505 100644 --- a/build.zig +++ b/build.zig @@ -144,7 +144,7 @@ fn addDeps( // Freetype step.addPackage(freetype.pkg); - try freetype.link(b, step); + _ = try freetype.link(b, step); // Glfw step.addPackage(glfw.pkg); @@ -155,11 +155,13 @@ fn addDeps( // Libuv step.addPackage(libuv.pkg); - try libuv.link(b, step); + var libuv_step = try libuv.link(b, step); + system_sdk.include(b, libuv_step, .{}); // Tracy step.addPackage(tracylib.pkg); - try tracylib.link(b, step); + var tracy_step = try tracylib.link(b, step); + system_sdk.include(b, tracy_step, .{}); } fn conformanceSteps( diff --git a/pkg/freetype/build.zig b/pkg/freetype/build.zig index 348a405ca..7c152d5cc 100644 --- a/pkg/freetype/build.zig +++ b/pkg/freetype/build.zig @@ -14,11 +14,12 @@ fn thisDir() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; } -pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !void { +pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep { const lib = try buildFreetype(b, step); step.linkLibrary(lib); step.addIncludePath(include_path); step.addIncludePath(include_path_self); + return lib; } pub fn buildFreetype( diff --git a/pkg/libuv/build.zig b/pkg/libuv/build.zig index 6bcf6fc3c..2d3930496 100644 --- a/pkg/libuv/build.zig +++ b/pkg/libuv/build.zig @@ -13,10 +13,11 @@ fn thisDir() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; } -pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !void { +pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep { const libuv = try buildLibuv(b, step); step.linkLibrary(libuv); step.addIncludePath(include_path); + return libuv; } pub fn buildLibuv( diff --git a/pkg/tracy/build.zig b/pkg/tracy/build.zig index e70fb6036..9bdb0978e 100644 --- a/pkg/tracy/build.zig +++ b/pkg/tracy/build.zig @@ -12,10 +12,11 @@ fn thisDir() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; } -pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !void { +pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep { const tracy = try buildTracy(b, step); step.linkLibrary(tracy); step.addIncludePath(root); + return tracy; } pub fn buildTracy(