Skip to content

Commit be6c5d6

Browse files
committed
better vulkan headers options
1 parent 8216504 commit be6c5d6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

build.zig

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ pub fn build(b: *std.Build) !void {
1111
});
1212
lib.linkLibCpp();
1313

14-
if (b.option(bool, "fetch_vulkan_headers", "defaults to true") orelse true) {
14+
const install_vulkan_headers = b.option(bool, "install-vulkan-headers", "(defaults to false)") orelse false;
15+
16+
if (b.option(std.Build.LazyPath, "vulkan-headers-path", "Path to Vulkan headers (defaults to bundled headers)")) |vulkan_headers_path| {
17+
lib.addIncludePath(vulkan_headers_path);
18+
if (install_vulkan_headers) lib.installHeadersDirectory(vulkan_headers_path, "", .{});
19+
} else {
1520
if (b.lazyDependency("vulkan_headers", .{})) |vulkan_headers| {
1621
lib.linkLibrary(vulkan_headers.artifact("vulkan-headers"));
17-
lib.installLibraryHeaders(vulkan_headers.artifact("vulkan-headers"));
22+
if (install_vulkan_headers) lib.installLibraryHeaders(vulkan_headers.artifact("vulkan-headers"));
1823
}
1924
}
2025

2126
const upstream = b.dependency("VulkanMemoryAllocator", .{});
2227
lib.installHeader(upstream.path("include/vk_mem_alloc.h"), "vk_mem_alloc.h");
23-
lib.addIncludePath(upstream.path("include"));
28+
lib.addIncludePath(upstream.path("include/"));
2429

2530
lib.addCSourceFile(.{
2631
.file = b.addWriteFiles().add("vk_mem_alloc.cpp", "#include \"vk_mem_alloc.h\""),

0 commit comments

Comments
 (0)