Swap out zglfw for custom bindings in castle

This commit is contained in:
2026-10-15 01:28:06 +02:00
parent 2330c17e3b
commit 0aca6247f0
103 changed files with 80 additions and 58212 deletions

View File

@@ -7,6 +7,11 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});
const llvm = b.option(bool, "llvm", "Use LLVM and LLD") orelse false;
const glfw_dep = b.dependency("glfw", .{
.target = target,
.optimize = optimize,
});
const media_dep = b.dependency("media", .{
.target = target,
});
@@ -21,20 +26,12 @@ pub fn build(b: *std.Build) !void {
.registry = b.path("vendor/vk.xml"),
});
const zglfw_dep = b.dependency("zglfw", .{
.target = target,
.optimize = optimize,
.import_vulkan = true,
});
const glfw_mod = glfw_dep.module("glfw");
const media_mod = media_dep.module("media");
const vecmath_mod = vecmath_dep.module("vecmath");
const vulkan_mod = vulkan_dep.module("vulkan-zig");
const zglfw_mod = zglfw_dep.module("root");
zglfw_mod.addImport("vulkan", vulkan_mod);
const zglfw_lib = zglfw_dep.artifact("glfw");
glfw_mod.addImport("vulkan", vulkan_mod);
const exe_mod = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
@@ -42,11 +39,10 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});
exe_mod.addImport("glfw", glfw_mod);
exe_mod.addImport("media", media_mod);
exe_mod.addImport("vecmath", vecmath_mod);
exe_mod.addImport("vulkan", vulkan_mod);
exe_mod.addImport("zglfw", zglfw_mod);
exe_mod.linkLibrary(zglfw_lib);
try addShaders(b, exe_mod);