From c5725dfb2e32dd463e02b4ca239de5ad74437b64 Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Sun, 28 Apr 2024 11:33:58 +0200 Subject: [PATCH] rename 'generator' binary to 'vulkan-zig-generator' This changes the name of the generator binary from something very generic to something a little more descriptive. If using the package manager method to use the generator, this will require updating to the new name. --- README.md | 4 ++-- build.zig | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4a5874d..33065b2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ vulkan-zig aims to be always compatible with the ever-changing Zig master branch ### CLI-interface A CLI-interface is provided to generate vk.zig from the [Vulkan XML registry](https://github.com/KhronosGroup/Vulkan-Docs/blob/main/xml), which is built by default when invoking `zig build` in the project root. To generate vk.zig, simply invoke the program as follows: ``` -$ zig-out/bin/generator path/to/vk.xml output/path/to/vk.zig +$ zig-out/bin/vulkan-zig-generator path/to/vk.xml output/path/to/vk.zig ``` This reads the xml file, parses its contents, renders the Vulkan bindings, and formats file, before writing the result to the output path. While the intended usage of vulkan-zig is through direct generation from build.zig (see below), the CLI-interface can be used for one-off generation and vendoring the result. NOTE: you need to replace `path/to/vk.xml` with the spec path from whatever source you prefer, here are some examples orderered from the most recommended: @@ -77,7 +77,7 @@ That will allow you to `@import("vulkan-zig")` in your executable's source. In the event you have a specific need for it, the generator executable is made available through the dependency, allowing you to run the executable as a build step in your own build.zig file. Doing so should look a bit like this: ```zig -const vk_gen = b.dependency("vulkan_zig", .{}).artifact("generator"); // get generator executable reference +const vk_gen = b.dependency("vulkan_zig", .{}).artifact("vulkan-zig-generator"); // get generator executable reference const generate_cmd = b.addRunArtifact(vk_gen); generate_cmd.addArg(b.pathFromRoot("vk.xml")); // path to xml file to use when generating the bindings diff --git a/build.zig b/build.zig index 1433e56..3ee2219 100644 --- a/build.zig +++ b/build.zig @@ -10,11 +10,11 @@ pub fn build(b: *std.Build) void { const vk_xml_path: ?[]const u8 = b.option([]const u8, "registry", "Override the path to the Vulkan registry"); // using the package manager, this artifact can be obtained by the user - // through `b.dependency(, .{}).artifact("generator")`. + // through `b.dependency(, .{}).artifact("vulkan-zig-generator")`. // with that, the user need only `.addArg("path/to/vk.xml")`, and then obtain // a file source to the generated code with `.addOutputArg("vk.zig")` const generator_exe = b.addExecutable(.{ - .name = "generator", + .name = "vulkan-zig-generator", .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize,