accept registry option as LazyPath

This allows passing LazyPaths obtained from dependencies to
the vulkan-zig dependency, which streamlines using vulkan-zig
with Vulkan-Headers provided by the package manager.
This commit is contained in:
Robin Voetter
2024-12-29 21:26:27 +01:00
parent dd6e61d689
commit bb470f16da
3 changed files with 36 additions and 17 deletions

View File

@@ -3,7 +3,7 @@ const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const maybe_registry: ?[]const u8 = b.option([]const u8, "registry", "Set the path to the Vulkan registry (vk.xml)");
const maybe_registry = b.option(std.Build.LazyPath, "registry", "Set the path to the Vulkan registry (vk.xml)");
const test_step = b.step("test", "Run all the tests");
// Using the package manager, this artifact can be obtained by the user
@@ -23,7 +23,7 @@ pub fn build(b: *std.Build) void {
if (maybe_registry) |registry| {
const vk_generate_cmd = b.addRunArtifact(generator_exe);
vk_generate_cmd.addArg(registry);
vk_generate_cmd.addFileArg(registry);
const vk_zig = vk_generate_cmd.addOutputFileArg("vk.zig");
const vk_zig_module = b.addModule("vulkan-zig", .{