From a893f0d88079195e278a91a082906a6d8e4df505 Mon Sep 17 00:00:00 2001 From: antlilja Date: Thu, 9 Mar 2023 20:29:19 +0100 Subject: [PATCH 1/2] Export shader and generate steps in build.zig Export ShaderCompileStep and VkGenerateStep in build.zig in order to support importing the build.zig file from other build.zig files using vulkan-zig. --- build.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 1493f08..537433e 100644 --- a/build.zig +++ b/build.zig @@ -2,6 +2,9 @@ const std = @import("std"); const vkgen = @import("generator/index.zig"); const Step = std.build.Step; +pub const ShaderCompileStep = vkgen.ShaderCompileStep; +pub const VkGenerateStep = vkgen.VkGenerateStep; + pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); @@ -45,10 +48,10 @@ 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 used for the examples") orelse "examples/vk.xml"; - const gen = vkgen.VkGenerateStep.create(b, example_registry); + const gen = VkGenerateStep.create(b, example_registry); triangle_exe.addModule("vulkan", gen.getModule()); - const shaders = vkgen.ShaderCompileStep.create( + const shaders = ShaderCompileStep.create( b, &[_][]const u8{ "glslc", "--target-env=vulkan1.2" }, "-o", From ab12ecc5d4242e85f1557bc55109533112b130ce Mon Sep 17 00:00:00 2001 From: antlilja Date: Thu, 9 Mar 2023 20:32:44 +0100 Subject: [PATCH 2/2] Remove ShaderStage from generator/index.zig ShaderStage no longer exists but zig does not produce any compile error because it isn't used anywhere. --- generator/index.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/generator/index.zig b/generator/index.zig index ddb1440..05ca2fe 100644 --- a/generator/index.zig +++ b/generator/index.zig @@ -1,6 +1,5 @@ pub const generateVk = @import("vulkan/generator.zig").generate; pub const VkGenerateStep = @import("vulkan/build_integration.zig").GenerateStep; -pub const ShaderStage = @import("build_integration.zig").ShaderStage; pub const ShaderCompileStep = @import("build_integration.zig").ShaderCompileStep; test "main" {