forked from mirror/vulkan-zig
Merge pull request #93 from Henrik-N/patch-1
Updated example "Manual generation with the package manager from buil…
This commit is contained in:
13
README.md
13
README.md
@@ -70,14 +70,15 @@ 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.
|
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:
|
Doing so should look a bit like this:
|
||||||
```zig
|
```zig
|
||||||
const vkzig_dep = b.dependency("vulkan_zig", .{}); // passing the registry argument here not necessary when using the executable directly
|
const vk_gen = b.dependency("vulkan_zig", .{}).artifact("generator"); // get generator executable reference
|
||||||
const vkzig_generator = vkzig_dep.artifact("generator");
|
|
||||||
|
|
||||||
vkzig_generator.addArg("path/to/vk.xml");
|
const generate_cmd = b.addRunArtifact(vk_gen);
|
||||||
const vkzig_src = vkzig_generator.addOutputFileArg("vk.zig"); // this is the FileSource representing the generated bindings
|
generate_cmd.addArg(b.pathFromRoot("vk.xml")); // path to xml file to use when generating the bindings
|
||||||
|
|
||||||
const vkzig_bindings = b.createModule("vulkan-zig", .{ .source_file = vkzig_src });
|
const vulkan_zig = b.addModule("vulkan-zig", .{
|
||||||
exe.addModule("vulkan-zig", vkzig_bindings);
|
.source_file = generate_cmd.addOutputFileArg("vk.zig"), // this is the FileSource representing the generated bindings
|
||||||
|
});
|
||||||
|
exe.addModule("vulkan-zig", vulkan_zig);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Function & field renaming
|
### Function & field renaming
|
||||||
|
|||||||
Reference in New Issue
Block a user