diff --git a/build.zig b/build.zig index fdf5a2e..977b140 100644 --- a/build.zig +++ b/build.zig @@ -46,7 +46,7 @@ pub fn build(b: *std.Build) void { triangle_exe.linkSystemLibrary("glfw"); const example_registry = b.option([]const u8, "example-registry", "Override the path to the Vulkan registry") orelse "examples/vk.xml"; - const gen = vkgen.VkGenerateStep.create(b, example_registry, "vk.zig"); + const gen = vkgen.VkGenerateStep.create(b, example_registry); triangle_exe.addModule("vulkan", gen.getModule()); const shaders = vkgen.ShaderCompileStep.create( diff --git a/generator/vulkan/build_integration.zig b/generator/vulkan/build_integration.zig index 1a05e68..bae6d1c 100644 --- a/generator/vulkan/build_integration.zig +++ b/generator/vulkan/build_integration.zig @@ -12,15 +12,13 @@ pub const GenerateStep = struct { step: Step, builder: *Build, generated_file: std.build.GeneratedFile, - /// Name of the resulting file - output_name: []const u8, /// The path to vk.xml spec_path: []const u8, /// Initialize a Vulkan generation step, for `builder`. `spec_path` is the path to /// vk.xml, relative to the project root. The generated bindings will be placed at /// `out_path`, which is relative to the zig-cache directory. - pub fn create(builder: *Build, spec_path: []const u8, output_name: []const u8) *GenerateStep { + pub fn create(builder: *Build, spec_path: []const u8) *GenerateStep { const self = builder.allocator.create(GenerateStep) catch unreachable; self.* = .{ .step = Step.init(.custom, "vulkan-generate", builder.allocator, make), @@ -28,7 +26,6 @@ pub const GenerateStep = struct { .generated_file = .{ .step = &self.step, }, - .output_name = output_name, .spec_path = spec_path, }; return self; @@ -74,9 +71,7 @@ pub const GenerateStep = struct { // TODO: Look into whether this is the right way to be doing // this - maybe the file-level caching API has some benefits I // don't understand. - man.hash.addBytes(self.spec_path); man.hash.addBytes(spec); - man.hash.addBytes(self.output_name); const already_exists = man.hit() catch |err| @panic(switch (err) { inline else => |e| "Cache error: " ++ @errorName(e), @@ -84,7 +79,7 @@ pub const GenerateStep = struct { const digest = man.final(); const output_file_path = try self.builder.cache_root.join( self.builder.allocator, - &.{ "o", &digest, self.output_name }, + &.{ "o", &digest, "vk.zig" }, ); if (already_exists) { self.generated_file.path = output_file_path;