hand-written interface wrapper

This commit is contained in:
David Allemang
2026-05-31 16:25:04 -04:00
parent f3cef55647
commit e812180389
6 changed files with 406 additions and 120 deletions

View File

@@ -7,38 +7,39 @@ pub fn build(b: *std.Build) void {
const vk_dep = b.dependency("vk", .{});
const volk_dep = b.dependency("volk", .{});
// const volk_c = b.addTranslateC(.{
// .target = target,
// .optimize = optimize,
// .root_source_file = volk_dep.path("volk.c"),
// .link_libc = true,
// });
// volk_c.addIncludePath(vk_dep.path("include"));
const vk = b.addModule("vulkan", .{
const volk_h = b.addTranslateC(.{
.target = target,
.optimize = optimize,
.root_source_file = b.path("src/volk.zig"),
.root_source_file = volk_dep.path("volk.h"),
.link_libc = true,
});
vk.addIncludePath(vk_dep.path("include"));
vk.addIncludePath(volk_dep.path("."));
vk.addCSourceFile(.{ .file = volk_dep.path("volk.c"), .language = .c });
const mod = b.addModule("zig_vk_api_test", .{
.root_source_file = b.path("src/root.zig"),
const volk = b.addModule("volk", .{
.target = target,
.optimize = optimize,
.root_source_file = volk_h.getOutput(),
.link_libc = true,
});
volk.addIncludePath(vk_dep.path("include"));
volk.addCSourceFile(.{ .file = volk_dep.path("volk.c"), .language = .c });
const vulkan = b.addModule("vulkan", .{
.target = target,
.optimize = optimize,
.root_source_file = b.path("vk/root.zig"),
.imports = &.{
.{ .name = "volk", .module = volk },
},
});
const exe = b.addExecutable(.{
.name = "zig_vk_api_test",
.name = "main",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zig_vk_api_test", .module = mod },
.{ .name = "vk", .module = vk },
.{ .name = "vk", .module = vulkan },
},
}),
});
@@ -56,12 +57,6 @@ pub fn build(b: *std.Build) void {
run_cmd.addArgs(args);
}
const mod_tests = b.addTest(.{
.root_module = mod,
});
const run_mod_tests = b.addRunArtifact(mod_tests);
const exe_tests = b.addTest(.{
.root_module = exe.root_module,
});
@@ -69,6 +64,5 @@ pub fn build(b: *std.Build) void {
const run_exe_tests = b.addRunArtifact(exe_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
test_step.dependOn(&run_exe_tests.step);
}