Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make target specific dependencies lazy #3526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1210,11 +1210,11 @@ fn addDeps(
}

// Wasm we do manually since it is such a different build.
if (step.rootModuleTarget().cpu.arch == .wasm32) {
const js_dep = b.dependency("zig_js", .{
if (step.rootModuleTarget().cpu.arch == .wasm32) wasm: {
const js_dep = b.lazyDependency("zig_js", .{
.target = target,
.optimize = optimize,
});
}) orelse break :wasm;
step.root_module.addImport("zig-js", js_dep.module("zig-js"));

return static_libs;
Expand Down Expand Up @@ -1306,15 +1306,15 @@ fn addDeps(
}).module("zf"));

// Mac Stuff
if (step.rootModuleTarget().isDarwin()) {
const objc_dep = b.dependency("zig_objc", .{
if (step.rootModuleTarget().isDarwin()) darwin: {
const objc_dep = b.lazyDependency("zig_objc", .{
.target = target,
.optimize = optimize,
});
const macos_dep = b.dependency("macos", .{
}) orelse break: darwin;
const macos_dep = b.lazyDependency("macos", .{
.target = target,
.optimize = optimize,
});
}) orelse break: darwin;

step.root_module.addImport("objc", objc_dep.module("objc"));
step.root_module.addImport("macos", macos_dep.module("macos"));
Expand Down
2 changes: 2 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
.zig_objc = .{
.url = "https://github.com/mitchellh/zig-objc/archive/9b8ba849b0f58fe207ecd6ab7c147af55b17556e.tar.gz",
.hash = "1220e17e64ef0ef561b3e4b9f3a96a2494285f2ec31c097721bf8c8677ec4415c634",
.lazy = true,
},
.zig_js = .{
.url = "https://github.com/mitchellh/zig-js/archive/d0b8b0a57c52fbc89f9d9fecba75ca29da7dd7d1.tar.gz",
.hash = "12205a66d423259567764fa0fc60c82be35365c21aeb76c5a7dc99698401f4f6fefc",
.lazy = true,
},
.ziglyph = .{
.url = "https://deps.files.ghostty.org/ziglyph-b89d43d1e3fb01b6074bc1f7fc980324b04d26a5.tar.gz",
Expand Down
Loading