build: many more lazy dependencies, defer deps add unless needed
This makes more dependencies lazy. This has a practical effect of reducing the number of dependencies that need to be downloaded when running certain zig build steps. This is all limited because we're blocked on an upstream Zig issue: https://github.com/ziglang/zig/issues/21525 This prevents us from fully avoiding downloading many dependencies, but at least they're relatively small. One major improvement here is the usage of `lazyImport` for `zig-wayland` that prevents downloading `zig_wayland` unconditionally on all platforms. On macOS, we don't download this at all anymore. Another, weirder change is that all our transitive dependencies are now marked lazy (e.g. glslang's upstream source) even if the glslang build always requires it. This was necessary because without this, even if we simply referenced glslang in the root build.zig, it would force the source package to download unconditionally. This no longer happens.pull/8826/head
parent
fcd0f88024
commit
17498ce122
|
|
@ -45,6 +45,7 @@
|
||||||
// codeberg ifreund/zig-wayland
|
// codeberg ifreund/zig-wayland
|
||||||
.url = "https://codeberg.org/ifreund/zig-wayland/archive/f3c5d503e540ada8cbcb056420de240af0c094f7.tar.gz",
|
.url = "https://codeberg.org/ifreund/zig-wayland/archive/f3c5d503e540ada8cbcb056420de240af0c094f7.tar.gz",
|
||||||
.hash = "wayland-0.4.0-dev-lQa1kjfIAQCmhhQu3xF0KH-94-TzeMXOqfnP0-Dg6Wyy",
|
.hash = "wayland-0.4.0-dev-lQa1kjfIAQCmhhQu3xF0KH-94-TzeMXOqfnP0-Dg6Wyy",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
.zf = .{
|
.zf = .{
|
||||||
// natecraddock/zf
|
// natecraddock/zf
|
||||||
|
|
@ -103,10 +104,12 @@
|
||||||
.jetbrains_mono = .{
|
.jetbrains_mono = .{
|
||||||
.url = "https://deps.files.ghostty.org/JetBrainsMono-2.304.tar.gz",
|
.url = "https://deps.files.ghostty.org/JetBrainsMono-2.304.tar.gz",
|
||||||
.hash = "N-V-__8AAIC5lwAVPJJzxnCAahSvZTIlG-HhtOvnM1uh-66x",
|
.hash = "N-V-__8AAIC5lwAVPJJzxnCAahSvZTIlG-HhtOvnM1uh-66x",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
.nerd_fonts_symbols_only = .{
|
.nerd_fonts_symbols_only = .{
|
||||||
.url = "https://deps.files.ghostty.org/NerdFontsSymbolsOnly-3.4.0.tar.gz",
|
.url = "https://deps.files.ghostty.org/NerdFontsSymbolsOnly-3.4.0.tar.gz",
|
||||||
.hash = "N-V-__8AAMVLTABmYkLqhZPLXnMl-KyN38R8UVYqGrxqO26s",
|
.hash = "N-V-__8AAMVLTABmYkLqhZPLXnMl-KyN38R8UVYqGrxqO26s",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const imgui = b.dependency("imgui", .{});
|
const imgui_ = b.lazyDependency("imgui", .{});
|
||||||
const lib = b.addLibrary(.{
|
const lib = b.addLibrary(.{
|
||||||
.name = "cimgui",
|
.name = "cimgui",
|
||||||
.root_module = b.createModule(.{
|
.root_module = b.createModule(.{
|
||||||
|
|
@ -52,7 +52,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lib.addIncludePath(imgui.path(""));
|
if (imgui_) |imgui| lib.addIncludePath(imgui.path(""));
|
||||||
module.addIncludePath(b.path("vendor"));
|
module.addIncludePath(b.path("vendor"));
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
|
|
@ -72,32 +72,33 @@ pub fn build(b: *std.Build) !void {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
lib.addCSourceFile(.{ .file = b.path("vendor/cimgui.cpp"), .flags = flags.items });
|
if (imgui_) |imgui| {
|
||||||
lib.addCSourceFile(.{ .file = imgui.path("imgui.cpp"), .flags = flags.items });
|
lib.addCSourceFile(.{ .file = b.path("vendor/cimgui.cpp"), .flags = flags.items });
|
||||||
lib.addCSourceFile(.{ .file = imgui.path("imgui_draw.cpp"), .flags = flags.items });
|
lib.addCSourceFile(.{ .file = imgui.path("imgui.cpp"), .flags = flags.items });
|
||||||
lib.addCSourceFile(.{ .file = imgui.path("imgui_demo.cpp"), .flags = flags.items });
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_draw.cpp"), .flags = flags.items });
|
||||||
lib.addCSourceFile(.{ .file = imgui.path("imgui_widgets.cpp"), .flags = flags.items });
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_demo.cpp"), .flags = flags.items });
|
||||||
lib.addCSourceFile(.{ .file = imgui.path("imgui_tables.cpp"), .flags = flags.items });
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_widgets.cpp"), .flags = flags.items });
|
||||||
lib.addCSourceFile(.{ .file = imgui.path("misc/freetype/imgui_freetype.cpp"), .flags = flags.items });
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_tables.cpp"), .flags = flags.items });
|
||||||
|
lib.addCSourceFile(.{ .file = imgui.path("misc/freetype/imgui_freetype.cpp"), .flags = flags.items });
|
||||||
lib.addCSourceFile(.{
|
|
||||||
.file = imgui.path("backends/imgui_impl_opengl3.cpp"),
|
|
||||||
.flags = flags.items,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (target.result.os.tag.isDarwin()) {
|
|
||||||
if (!target.query.isNative()) {
|
|
||||||
try @import("apple_sdk").addPaths(b, lib);
|
|
||||||
}
|
|
||||||
lib.addCSourceFile(.{
|
lib.addCSourceFile(.{
|
||||||
.file = imgui.path("backends/imgui_impl_metal.mm"),
|
.file = imgui.path("backends/imgui_impl_opengl3.cpp"),
|
||||||
.flags = flags.items,
|
.flags = flags.items,
|
||||||
});
|
});
|
||||||
if (target.result.os.tag == .macos) {
|
|
||||||
|
if (target.result.os.tag.isDarwin()) {
|
||||||
|
if (!target.query.isNative()) {
|
||||||
|
try @import("apple_sdk").addPaths(b, lib);
|
||||||
|
}
|
||||||
lib.addCSourceFile(.{
|
lib.addCSourceFile(.{
|
||||||
.file = imgui.path("backends/imgui_impl_osx.mm"),
|
.file = imgui.path("backends/imgui_impl_metal.mm"),
|
||||||
.flags = flags.items,
|
.flags = flags.items,
|
||||||
});
|
});
|
||||||
|
if (target.result.os.tag == .macos) {
|
||||||
|
lib.addCSourceFile(.{
|
||||||
|
.file = imgui.path("backends/imgui_impl_osx.mm"),
|
||||||
|
.flags = flags.items,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
// ocornut/imgui
|
// ocornut/imgui
|
||||||
.url = "https://deps.files.ghostty.org/imgui-1220bc6b9daceaf7c8c60f3c3998058045ba0c5c5f48ae255ff97776d9cd8bfc6402.tar.gz",
|
.url = "https://deps.files.ghostty.org/imgui-1220bc6b9daceaf7c8c60f3c3998058045ba0c5c5f48ae255ff97776d9cd8bfc6402.tar.gz",
|
||||||
.hash = "N-V-__8AAH0GaQC8a52s6vfIxg88OZgFgEW6DFxfSK4lX_l3",
|
.hash = "N-V-__8AAH0GaQC8a52s6vfIxg88OZgFgEW6DFxfSK4lX_l3",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
.apple_sdk = .{ .path = "../apple-sdk" },
|
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ pub fn build(b: *std.Build) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const upstream = b.dependency("glslang", .{});
|
const upstream = b.lazyDependency("glslang", .{});
|
||||||
const lib = try buildGlslang(b, upstream, target, optimize);
|
const lib = try buildGlslang(b, upstream, target, optimize);
|
||||||
b.installArtifact(lib);
|
b.installArtifact(lib);
|
||||||
|
|
||||||
module.addIncludePath(upstream.path(""));
|
if (upstream) |v| module.addIncludePath(v.path(""));
|
||||||
module.addIncludePath(b.path("override"));
|
module.addIncludePath(b.path("override"));
|
||||||
|
|
||||||
if (target.query.isNative()) {
|
if (target.query.isNative()) {
|
||||||
|
|
@ -38,7 +38,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
|
|
||||||
fn buildGlslang(
|
fn buildGlslang(
|
||||||
b: *std.Build,
|
b: *std.Build,
|
||||||
upstream: *std.Build.Dependency,
|
upstream_: ?*std.Build.Dependency,
|
||||||
target: std.Build.ResolvedTarget,
|
target: std.Build.ResolvedTarget,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
) !*std.Build.Step.Compile {
|
) !*std.Build.Step.Compile {
|
||||||
|
|
@ -52,7 +52,7 @@ fn buildGlslang(
|
||||||
});
|
});
|
||||||
lib.linkLibC();
|
lib.linkLibC();
|
||||||
lib.linkLibCpp();
|
lib.linkLibCpp();
|
||||||
lib.addIncludePath(upstream.path(""));
|
if (upstream_) |upstream| lib.addIncludePath(upstream.path(""));
|
||||||
lib.addIncludePath(b.path("override"));
|
lib.addIncludePath(b.path("override"));
|
||||||
if (target.result.os.tag.isDarwin()) {
|
if (target.result.os.tag.isDarwin()) {
|
||||||
const apple_sdk = @import("apple_sdk");
|
const apple_sdk = @import("apple_sdk");
|
||||||
|
|
@ -66,87 +66,89 @@ fn buildGlslang(
|
||||||
"-fno-sanitize-trap=undefined",
|
"-fno-sanitize-trap=undefined",
|
||||||
});
|
});
|
||||||
|
|
||||||
lib.addCSourceFiles(.{
|
if (upstream_) |upstream| {
|
||||||
.root = upstream.path(""),
|
|
||||||
.flags = flags.items,
|
|
||||||
.files = &.{
|
|
||||||
// GenericCodeGen
|
|
||||||
"glslang/GenericCodeGen/CodeGen.cpp",
|
|
||||||
"glslang/GenericCodeGen/Link.cpp",
|
|
||||||
|
|
||||||
// MachineIndependent
|
|
||||||
//"MachineIndependent/glslang.y",
|
|
||||||
"glslang/MachineIndependent/glslang_tab.cpp",
|
|
||||||
"glslang/MachineIndependent/attribute.cpp",
|
|
||||||
"glslang/MachineIndependent/Constant.cpp",
|
|
||||||
"glslang/MachineIndependent/iomapper.cpp",
|
|
||||||
"glslang/MachineIndependent/InfoSink.cpp",
|
|
||||||
"glslang/MachineIndependent/Initialize.cpp",
|
|
||||||
"glslang/MachineIndependent/IntermTraverse.cpp",
|
|
||||||
"glslang/MachineIndependent/Intermediate.cpp",
|
|
||||||
"glslang/MachineIndependent/ParseContextBase.cpp",
|
|
||||||
"glslang/MachineIndependent/ParseHelper.cpp",
|
|
||||||
"glslang/MachineIndependent/PoolAlloc.cpp",
|
|
||||||
"glslang/MachineIndependent/RemoveTree.cpp",
|
|
||||||
"glslang/MachineIndependent/Scan.cpp",
|
|
||||||
"glslang/MachineIndependent/ShaderLang.cpp",
|
|
||||||
"glslang/MachineIndependent/SpirvIntrinsics.cpp",
|
|
||||||
"glslang/MachineIndependent/SymbolTable.cpp",
|
|
||||||
"glslang/MachineIndependent/Versions.cpp",
|
|
||||||
"glslang/MachineIndependent/intermOut.cpp",
|
|
||||||
"glslang/MachineIndependent/limits.cpp",
|
|
||||||
"glslang/MachineIndependent/linkValidate.cpp",
|
|
||||||
"glslang/MachineIndependent/parseConst.cpp",
|
|
||||||
"glslang/MachineIndependent/reflection.cpp",
|
|
||||||
"glslang/MachineIndependent/preprocessor/Pp.cpp",
|
|
||||||
"glslang/MachineIndependent/preprocessor/PpAtom.cpp",
|
|
||||||
"glslang/MachineIndependent/preprocessor/PpContext.cpp",
|
|
||||||
"glslang/MachineIndependent/preprocessor/PpScanner.cpp",
|
|
||||||
"glslang/MachineIndependent/preprocessor/PpTokens.cpp",
|
|
||||||
"glslang/MachineIndependent/propagateNoContraction.cpp",
|
|
||||||
|
|
||||||
// C Interface
|
|
||||||
"glslang/CInterface/glslang_c_interface.cpp",
|
|
||||||
|
|
||||||
// ResourceLimits
|
|
||||||
"glslang/ResourceLimits/ResourceLimits.cpp",
|
|
||||||
"glslang/ResourceLimits/resource_limits_c.cpp",
|
|
||||||
|
|
||||||
// SPIRV
|
|
||||||
"SPIRV/GlslangToSpv.cpp",
|
|
||||||
"SPIRV/InReadableOrder.cpp",
|
|
||||||
"SPIRV/Logger.cpp",
|
|
||||||
"SPIRV/SpvBuilder.cpp",
|
|
||||||
"SPIRV/SpvPostProcess.cpp",
|
|
||||||
"SPIRV/doc.cpp",
|
|
||||||
"SPIRV/disassemble.cpp",
|
|
||||||
"SPIRV/CInterface/spirv_c_interface.cpp",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (target.result.os.tag != .windows) {
|
|
||||||
lib.addCSourceFiles(.{
|
lib.addCSourceFiles(.{
|
||||||
.root = upstream.path(""),
|
.root = upstream.path(""),
|
||||||
.flags = flags.items,
|
.flags = flags.items,
|
||||||
.files = &.{
|
.files = &.{
|
||||||
"glslang/OSDependent/Unix/ossource.cpp",
|
// GenericCodeGen
|
||||||
},
|
"glslang/GenericCodeGen/CodeGen.cpp",
|
||||||
});
|
"glslang/GenericCodeGen/Link.cpp",
|
||||||
} else {
|
|
||||||
lib.addCSourceFiles(.{
|
// MachineIndependent
|
||||||
.root = upstream.path(""),
|
//"MachineIndependent/glslang.y",
|
||||||
.flags = flags.items,
|
"glslang/MachineIndependent/glslang_tab.cpp",
|
||||||
.files = &.{
|
"glslang/MachineIndependent/attribute.cpp",
|
||||||
"glslang/OSDependent/Windows/ossource.cpp",
|
"glslang/MachineIndependent/Constant.cpp",
|
||||||
|
"glslang/MachineIndependent/iomapper.cpp",
|
||||||
|
"glslang/MachineIndependent/InfoSink.cpp",
|
||||||
|
"glslang/MachineIndependent/Initialize.cpp",
|
||||||
|
"glslang/MachineIndependent/IntermTraverse.cpp",
|
||||||
|
"glslang/MachineIndependent/Intermediate.cpp",
|
||||||
|
"glslang/MachineIndependent/ParseContextBase.cpp",
|
||||||
|
"glslang/MachineIndependent/ParseHelper.cpp",
|
||||||
|
"glslang/MachineIndependent/PoolAlloc.cpp",
|
||||||
|
"glslang/MachineIndependent/RemoveTree.cpp",
|
||||||
|
"glslang/MachineIndependent/Scan.cpp",
|
||||||
|
"glslang/MachineIndependent/ShaderLang.cpp",
|
||||||
|
"glslang/MachineIndependent/SpirvIntrinsics.cpp",
|
||||||
|
"glslang/MachineIndependent/SymbolTable.cpp",
|
||||||
|
"glslang/MachineIndependent/Versions.cpp",
|
||||||
|
"glslang/MachineIndependent/intermOut.cpp",
|
||||||
|
"glslang/MachineIndependent/limits.cpp",
|
||||||
|
"glslang/MachineIndependent/linkValidate.cpp",
|
||||||
|
"glslang/MachineIndependent/parseConst.cpp",
|
||||||
|
"glslang/MachineIndependent/reflection.cpp",
|
||||||
|
"glslang/MachineIndependent/preprocessor/Pp.cpp",
|
||||||
|
"glslang/MachineIndependent/preprocessor/PpAtom.cpp",
|
||||||
|
"glslang/MachineIndependent/preprocessor/PpContext.cpp",
|
||||||
|
"glslang/MachineIndependent/preprocessor/PpScanner.cpp",
|
||||||
|
"glslang/MachineIndependent/preprocessor/PpTokens.cpp",
|
||||||
|
"glslang/MachineIndependent/propagateNoContraction.cpp",
|
||||||
|
|
||||||
|
// C Interface
|
||||||
|
"glslang/CInterface/glslang_c_interface.cpp",
|
||||||
|
|
||||||
|
// ResourceLimits
|
||||||
|
"glslang/ResourceLimits/ResourceLimits.cpp",
|
||||||
|
"glslang/ResourceLimits/resource_limits_c.cpp",
|
||||||
|
|
||||||
|
// SPIRV
|
||||||
|
"SPIRV/GlslangToSpv.cpp",
|
||||||
|
"SPIRV/InReadableOrder.cpp",
|
||||||
|
"SPIRV/Logger.cpp",
|
||||||
|
"SPIRV/SpvBuilder.cpp",
|
||||||
|
"SPIRV/SpvPostProcess.cpp",
|
||||||
|
"SPIRV/doc.cpp",
|
||||||
|
"SPIRV/disassemble.cpp",
|
||||||
|
"SPIRV/CInterface/spirv_c_interface.cpp",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (target.result.os.tag != .windows) {
|
||||||
|
lib.addCSourceFiles(.{
|
||||||
|
.root = upstream.path(""),
|
||||||
|
.flags = flags.items,
|
||||||
|
.files = &.{
|
||||||
|
"glslang/OSDependent/Unix/ossource.cpp",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
lib.addCSourceFiles(.{
|
||||||
|
.root = upstream.path(""),
|
||||||
|
.flags = flags.items,
|
||||||
|
.files = &.{
|
||||||
|
"glslang/OSDependent/Windows/ossource.cpp",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
lib.installHeadersDirectory(
|
||||||
|
upstream.path(""),
|
||||||
|
"",
|
||||||
|
.{ .include_extensions = &.{".h"} },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
lib.installHeadersDirectory(
|
|
||||||
upstream.path(""),
|
|
||||||
"",
|
|
||||||
.{ .include_extensions = &.{".h"} },
|
|
||||||
);
|
|
||||||
|
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
.glslang = .{
|
.glslang = .{
|
||||||
.url = "https://deps.files.ghostty.org/glslang-12201278a1a05c0ce0b6eb6026c65cd3e9247aa041b1c260324bf29cee559dd23ba1.tar.gz",
|
.url = "https://deps.files.ghostty.org/glslang-12201278a1a05c0ce0b6eb6026c65cd3e9247aa041b1c260324bf29cee559dd23ba1.tar.gz",
|
||||||
.hash = "N-V-__8AABzkUgISeKGgXAzgtutgJsZc0-kkeqBBscJgMkvy",
|
.hash = "N-V-__8AABzkUgISeKGgXAzgtutgJsZc0-kkeqBBscJgMkvy",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
.apple_sdk = .{ .path = "../apple-sdk" },
|
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const upstream = b.dependency("highway", .{});
|
const upstream_ = b.lazyDependency("highway", .{});
|
||||||
|
|
||||||
const module = b.addModule("highway", .{
|
const module = b.addModule("highway", .{
|
||||||
.root_source_file = b.path("main.zig"),
|
.root_source_file = b.path("main.zig"),
|
||||||
|
|
@ -21,8 +21,10 @@ pub fn build(b: *std.Build) !void {
|
||||||
.linkage = .static,
|
.linkage = .static,
|
||||||
});
|
});
|
||||||
lib.linkLibCpp();
|
lib.linkLibCpp();
|
||||||
lib.addIncludePath(upstream.path(""));
|
if (upstream_) |upstream| {
|
||||||
module.addIncludePath(upstream.path(""));
|
lib.addIncludePath(upstream.path(""));
|
||||||
|
module.addIncludePath(upstream.path(""));
|
||||||
|
}
|
||||||
|
|
||||||
if (target.result.os.tag.isDarwin()) {
|
if (target.result.os.tag.isDarwin()) {
|
||||||
const apple_sdk = @import("apple_sdk");
|
const apple_sdk = @import("apple_sdk");
|
||||||
|
|
@ -74,24 +76,26 @@ pub fn build(b: *std.Build) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
lib.addCSourceFiles(.{ .flags = flags.items, .files = &.{"bridge.cpp"} });
|
lib.addCSourceFiles(.{ .flags = flags.items, .files = &.{"bridge.cpp"} });
|
||||||
lib.addCSourceFiles(.{
|
if (upstream_) |upstream| {
|
||||||
.root = upstream.path(""),
|
lib.addCSourceFiles(.{
|
||||||
.flags = flags.items,
|
.root = upstream.path(""),
|
||||||
.files = &.{
|
.flags = flags.items,
|
||||||
"hwy/abort.cc",
|
.files = &.{
|
||||||
"hwy/aligned_allocator.cc",
|
"hwy/abort.cc",
|
||||||
"hwy/nanobenchmark.cc",
|
"hwy/aligned_allocator.cc",
|
||||||
"hwy/per_target.cc",
|
"hwy/nanobenchmark.cc",
|
||||||
"hwy/print.cc",
|
"hwy/per_target.cc",
|
||||||
"hwy/targets.cc",
|
"hwy/print.cc",
|
||||||
"hwy/timer.cc",
|
"hwy/targets.cc",
|
||||||
},
|
"hwy/timer.cc",
|
||||||
});
|
},
|
||||||
lib.installHeadersDirectory(
|
});
|
||||||
upstream.path("hwy"),
|
lib.installHeadersDirectory(
|
||||||
"hwy",
|
upstream.path("hwy"),
|
||||||
.{ .include_extensions = &.{".h"} },
|
"hwy",
|
||||||
);
|
.{ .include_extensions = &.{".h"} },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
b.installArtifact(lib);
|
b.installArtifact(lib);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
.highway = .{
|
.highway = .{
|
||||||
.url = "https://deps.files.ghostty.org/highway-66486a10623fa0d72fe91260f96c892e41aceb06.tar.gz",
|
.url = "https://deps.files.ghostty.org/highway-66486a10623fa0d72fe91260f96c892e41aceb06.tar.gz",
|
||||||
.hash = "N-V-__8AAGmZhABbsPJLfbqrh6JTHsXhY6qCaLAQyx25e0XE",
|
.hash = "N-V-__8AAGmZhABbsPJLfbqrh6JTHsXhY6qCaLAQyx25e0XE",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
.apple_sdk = .{ .path = "../apple-sdk" },
|
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const upstream = b.dependency("libxml2", .{});
|
const upstream_ = b.lazyDependency("libxml2", .{});
|
||||||
|
|
||||||
const lib = b.addLibrary(.{
|
const lib = b.addLibrary(.{
|
||||||
.name = "xml2",
|
.name = "xml2",
|
||||||
|
|
@ -16,7 +16,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
});
|
});
|
||||||
lib.linkLibC();
|
lib.linkLibC();
|
||||||
|
|
||||||
lib.addIncludePath(upstream.path("include"));
|
if (upstream_) |upstream| lib.addIncludePath(upstream.path("include"));
|
||||||
lib.addIncludePath(b.path("override/include"));
|
lib.addIncludePath(b.path("override/include"));
|
||||||
if (target.result.os.tag == .windows) {
|
if (target.result.os.tag == .windows) {
|
||||||
lib.addIncludePath(b.path("override/config/win32"));
|
lib.addIncludePath(b.path("override/config/win32"));
|
||||||
|
|
@ -97,21 +97,23 @@ pub fn build(b: *std.Build) !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lib.addCSourceFiles(.{
|
if (upstream_) |upstream| {
|
||||||
.root = upstream.path(""),
|
lib.addCSourceFiles(.{
|
||||||
.files = srcs,
|
.root = upstream.path(""),
|
||||||
.flags = flags.items,
|
.files = srcs,
|
||||||
});
|
.flags = flags.items,
|
||||||
|
});
|
||||||
|
|
||||||
lib.installHeader(
|
lib.installHeader(
|
||||||
b.path("override/include/libxml/xmlversion.h"),
|
b.path("override/include/libxml/xmlversion.h"),
|
||||||
"libxml/xmlversion.h",
|
"libxml/xmlversion.h",
|
||||||
);
|
);
|
||||||
lib.installHeadersDirectory(
|
lib.installHeadersDirectory(
|
||||||
upstream.path("include"),
|
upstream.path("include"),
|
||||||
"",
|
"",
|
||||||
.{ .include_extensions = &.{".h"} },
|
.{ .include_extensions = &.{".h"} },
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
b.installArtifact(lib);
|
b.installArtifact(lib);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
.libxml2 = .{
|
.libxml2 = .{
|
||||||
.url = "https://deps.files.ghostty.org/libxml2-2.11.5.tar.gz",
|
.url = "https://deps.files.ghostty.org/libxml2-2.11.5.tar.gz",
|
||||||
.hash = "N-V-__8AAG3RoQEyRC2Vw7Qoro5SYBf62IHn3HjqtNVY6aWK",
|
.hash = "N-V-__8AAG3RoQEyRC2Vw7Qoro5SYBf62IHn3HjqtNVY6aWK",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ pub fn build(b: *std.Build) !void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const upstream = b.dependency("spirv_cross", .{});
|
const upstream = b.lazyDependency("spirv_cross", .{});
|
||||||
|
|
||||||
const module = b.addModule("spirv_cross", .{ .root_source_file = b.path("main.zig") });
|
const module = b.addModule("spirv_cross", .{ .root_source_file = b.path("main.zig") });
|
||||||
module.addIncludePath(upstream.path(""));
|
if (upstream) |v| module.addIncludePath(v.path(""));
|
||||||
|
|
||||||
const lib = try buildSpirvCross(b, upstream, target, optimize);
|
const lib = try buildSpirvCross(b, upstream, target, optimize);
|
||||||
b.installArtifact(lib);
|
b.installArtifact(lib);
|
||||||
|
|
@ -33,7 +33,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
|
|
||||||
fn buildSpirvCross(
|
fn buildSpirvCross(
|
||||||
b: *std.Build,
|
b: *std.Build,
|
||||||
upstream: *std.Build.Dependency,
|
upstream_: ?*std.Build.Dependency,
|
||||||
target: std.Build.ResolvedTarget,
|
target: std.Build.ResolvedTarget,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
) !*std.Build.Step.Compile {
|
) !*std.Build.Step.Compile {
|
||||||
|
|
@ -62,6 +62,7 @@ fn buildSpirvCross(
|
||||||
"-fno-sanitize-trap=undefined",
|
"-fno-sanitize-trap=undefined",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const upstream = upstream_ orelse return lib;
|
||||||
lib.addCSourceFiles(.{
|
lib.addCSourceFiles(.{
|
||||||
.root = upstream.path(""),
|
.root = upstream.path(""),
|
||||||
.flags = flags.items,
|
.flags = flags.items,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
.spirv_cross = .{
|
.spirv_cross = .{
|
||||||
.url = "https://deps.files.ghostty.org/spirv_cross-1220fb3b5586e8be67bc3feb34cbe749cf42a60d628d2953632c2f8141302748c8da.tar.gz",
|
.url = "https://deps.files.ghostty.org/spirv_cross-1220fb3b5586e8be67bc3feb34cbe749cf42a60d628d2953632c2f8141302748c8da.tar.gz",
|
||||||
.hash = "N-V-__8AANb6pwD7O1WG6L5nvD_rNMvnSc9Cpg1ijSlTYywv",
|
.hash = "N-V-__8AANb6pwD7O1WG6L5nvD_rNMvnSc9Cpg1ijSlTYywv",
|
||||||
|
.lazy = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
.apple_sdk = .{ .path = "../apple-sdk" },
|
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||||
|
|
|
||||||
|
|
@ -502,38 +502,40 @@ pub fn add(
|
||||||
// Fonts
|
// Fonts
|
||||||
{
|
{
|
||||||
// JetBrains Mono
|
// JetBrains Mono
|
||||||
const jb_mono = b.dependency("jetbrains_mono", .{});
|
if (b.lazyDependency("jetbrains_mono", .{})) |jb_mono| {
|
||||||
step.root_module.addAnonymousImport(
|
step.root_module.addAnonymousImport(
|
||||||
"jetbrains_mono_regular",
|
"jetbrains_mono_regular",
|
||||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Regular.ttf") },
|
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Regular.ttf") },
|
||||||
);
|
);
|
||||||
step.root_module.addAnonymousImport(
|
step.root_module.addAnonymousImport(
|
||||||
"jetbrains_mono_bold",
|
"jetbrains_mono_bold",
|
||||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Bold.ttf") },
|
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Bold.ttf") },
|
||||||
);
|
);
|
||||||
step.root_module.addAnonymousImport(
|
step.root_module.addAnonymousImport(
|
||||||
"jetbrains_mono_italic",
|
"jetbrains_mono_italic",
|
||||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Italic.ttf") },
|
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Italic.ttf") },
|
||||||
);
|
);
|
||||||
step.root_module.addAnonymousImport(
|
step.root_module.addAnonymousImport(
|
||||||
"jetbrains_mono_bold_italic",
|
"jetbrains_mono_bold_italic",
|
||||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-BoldItalic.ttf") },
|
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-BoldItalic.ttf") },
|
||||||
);
|
);
|
||||||
step.root_module.addAnonymousImport(
|
step.root_module.addAnonymousImport(
|
||||||
"jetbrains_mono_variable",
|
"jetbrains_mono_variable",
|
||||||
.{ .root_source_file = jb_mono.path("fonts/variable/JetBrainsMono[wght].ttf") },
|
.{ .root_source_file = jb_mono.path("fonts/variable/JetBrainsMono[wght].ttf") },
|
||||||
);
|
);
|
||||||
step.root_module.addAnonymousImport(
|
step.root_module.addAnonymousImport(
|
||||||
"jetbrains_mono_variable_italic",
|
"jetbrains_mono_variable_italic",
|
||||||
.{ .root_source_file = jb_mono.path("fonts/variable/JetBrainsMono-Italic[wght].ttf") },
|
.{ .root_source_file = jb_mono.path("fonts/variable/JetBrainsMono-Italic[wght].ttf") },
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Symbols-only nerd font
|
// Symbols-only nerd font
|
||||||
const nf_symbols = b.dependency("nerd_fonts_symbols_only", .{});
|
if (b.lazyDependency("nerd_fonts_symbols_only", .{})) |nf_symbols| {
|
||||||
step.root_module.addAnonymousImport(
|
step.root_module.addAnonymousImport(
|
||||||
"nerd_fonts_symbols_only",
|
"nerd_fonts_symbols_only",
|
||||||
.{ .root_source_file = nf_symbols.path("SymbolsNerdFont-Regular.ttf") },
|
.{ .root_source_file = nf_symbols.path("SymbolsNerdFont-Regular.ttf") },
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're building an exe then we have additional dependencies.
|
// If we're building an exe then we have additional dependencies.
|
||||||
|
|
@ -615,17 +617,20 @@ fn addGtkNg(
|
||||||
"plasma_wayland_protocols",
|
"plasma_wayland_protocols",
|
||||||
.{},
|
.{},
|
||||||
);
|
);
|
||||||
|
const zig_wayland_import_ = b.lazyImport(
|
||||||
|
@import("../../build.zig"),
|
||||||
|
"zig_wayland",
|
||||||
|
);
|
||||||
|
const zig_wayland_dep_ = b.lazyDependency("zig_wayland", .{});
|
||||||
|
|
||||||
// Unwrap or return, there are no more dependencies below.
|
// Unwrap or return, there are no more dependencies below.
|
||||||
const wayland_dep = wayland_dep_ orelse break :wayland;
|
const wayland_dep = wayland_dep_ orelse break :wayland;
|
||||||
const wayland_protocols_dep = wayland_protocols_dep_ orelse break :wayland;
|
const wayland_protocols_dep = wayland_protocols_dep_ orelse break :wayland;
|
||||||
const plasma_wayland_protocols_dep = plasma_wayland_protocols_dep_ orelse break :wayland;
|
const plasma_wayland_protocols_dep = plasma_wayland_protocols_dep_ orelse break :wayland;
|
||||||
|
const zig_wayland_import = zig_wayland_import_ orelse break :wayland;
|
||||||
|
const zig_wayland_dep = zig_wayland_dep_ orelse break :wayland;
|
||||||
|
|
||||||
// Note that zig_wayland cannot be lazy because lazy dependencies
|
const Scanner = zig_wayland_import.Scanner;
|
||||||
// can't be imported since they don't exist and imports are
|
|
||||||
// resolved at compile time of the build.
|
|
||||||
const zig_wayland_dep = b.dependency("zig_wayland", .{});
|
|
||||||
const Scanner = @import("zig_wayland").Scanner;
|
|
||||||
const scanner = Scanner.create(zig_wayland_dep.builder, .{
|
const scanner = Scanner.create(zig_wayland_dep.builder, .{
|
||||||
.wayland_xml = wayland_dep.path("protocol/wayland.xml"),
|
.wayland_xml = wayland_dep.path("protocol/wayland.xml"),
|
||||||
.wayland_protocols = wayland_protocols_dep.path(""),
|
.wayland_protocols = wayland_protocols_dep.path(""),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue