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.
This commit is contained in:
Robin Voetter
2024-04-28 11:33:58 +02:00
parent e1f290399e
commit c5725dfb2e
2 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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(<name in build.zig.zon>, .{}).artifact("generator")`.
// through `b.dependency(<name in build.zig.zon>, .{}).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,