standardize names for step creation and obtaining packages

stdlib style is to use `create` for step creation and `getPackage`/`getSource`
to provide generated sources as package/file.
This commit is contained in:
Robin Voetter
2022-12-30 00:43:29 +01:00
parent f7a4e4346e
commit 08dc9f508c
3 changed files with 23 additions and 24 deletions

View File

@@ -34,13 +34,13 @@ pub fn build(b: *Builder) void {
const exe = b.addExecutable("my-executable", "src/main.zig");
// Create a step that generates vk.zig (stored in zig-cache) from the provided vulkan registry.
const gen = vkgen.VkGenerateStep.init(b, "path/to/vk.xml", "vk.zig");
const gen = vkgen.VkGenerateStep.create(b, "path/to/vk.xml", "vk.zig");
// Add the generated file as package to the final executable
exe.addPackage(gen.package);
exe.addPackage(gen.getPackage("vulkan"));
}
```
This reads vk.xml, parses its contents, and renders the Vulkan bindings to "vk.zig", which is then formatted and placed in `zig-cache`. The resulting file can then be added to an executable by using `addPackage`, after which the bindings will be made available to the executable under the name `vulkan`.
This reads vk.xml, parses its contents, and renders the Vulkan bindings to "vk.zig", which is then formatted and placed in `zig-cache`. The resulting file can then be added to an executable by using `addPackage`, after which the bindings will be made available to the executable under the name passed to `getPackage`.
### Function & field renaming
Functions and fields are renamed to be more or less in line with [Zig's standard library style](https://ziglang.org/documentation/master/#Style-Guide):