diff --git a/build.zig b/build.zig index bd07334b5..b66ebffda 100644 --- a/build.zig +++ b/build.zig @@ -30,24 +30,27 @@ pub fn build(b: *std.Build) void { lib.installHeadersDirectory("include/GLFW", "GLFW"); // GLFW headers depend on these headers, so they must be distributed too. - const vulkan_headers_dep = b.dependency("vulkan_headers", .{ + if (b.lazyDependency("vulkan_headers", .{ .target = target, .optimize = optimize, - }); - lib.installLibraryHeaders(vulkan_headers_dep.artifact("vulkan-headers")); + })) |dep| { + lib.installLibraryHeaders(dep.artifact("vulkan-headers")); + } if (target.result.os.tag == .linux) { - const x11_headers_dep = b.dependency("x11_headers", .{ + if (b.lazyDependency("x11_headers", .{ .target = target, .optimize = optimize, - }); - const wayland_headers_dep = b.dependency("wayland_headers", .{ + })) |dep| { + lib.linkLibrary(dep.artifact("x11-headers")); + lib.installLibraryHeaders(dep.artifact("x11-headers")); + } + if (b.lazyDependency("wayland_headers", .{ .target = target, .optimize = optimize, - }); - lib.linkLibrary(x11_headers_dep.artifact("x11-headers")); - lib.linkLibrary(wayland_headers_dep.artifact("wayland-headers")); - lib.installLibraryHeaders(x11_headers_dep.artifact("x11-headers")); - lib.installLibraryHeaders(wayland_headers_dep.artifact("wayland-headers")); + })) |dep| { + lib.linkLibrary(dep.artifact("wayland-headers")); + lib.installLibraryHeaders(dep.artifact("wayland-headers")); + } } if (target.result.isDarwin()) { diff --git a/build.zig.zon b/build.zig.zon index 72984e9f5..72f59e2db 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -20,14 +20,17 @@ .vulkan_headers = .{ .url = "https://pkg.machengine.org/vulkan-headers/e33f2e482893a90bb36d67649ab30d5236ac21ab.tar.gz", .hash = "122017098e4ca00dac1a9d30d152a6e6e9522843219c6df4489210fb7c8a6e4c7c1a", + .lazy = true, }, .wayland_headers = .{ .url = "https://pkg.machengine.org/wayland-headers/4926b8c635aa2f215b0d5382060fc4091aa7b705.tar.gz", .hash = "12207decf58bee217ae9c5340a6852a62e7f5af9901bef9b1468d93e480798898285", + .lazy = true, }, .x11_headers = .{ .url = "https://pkg.machengine.org/x11-headers/ad1c4891f70302c61ba956cfd565758dc1ca9d28.tar.gz", .hash = "1220ce35d8f1556afd5bf4796a7899d459f9c628b989f247eaf6aa00fbad10a88c9f", + .lazy = true, }, }, }