vulkan-zig
vulkan-zig copied to clipboard
Adding Vulkan-Headers as a dependency?
Instead of embedding vk.xml, maybe we can add Vulkan-Headers as a submodule, or otherwise add another build function that can fetch the file from GitHub using http. Benefits:
- Cross platform (no system dependent path is required, not even the Vulkan SDK)
- Beginner friendly (no need to figure out the path manually)
- Up to date automatically
- Easier time for downstream projects, no need to include Vulkan-Headers as a submodule in their projects.
I dont think adding a dependency is nice here. The vk.xml provided in the repository is really as example, it is explicitly not intended as source.
That said, Im fine with adding a link to a generated vk.zig. The CI already uploads this as artefact, but I think there is no predictable URL to download it, hence I could not provide a link in the readme. Ideally there should be a link to the zig file corresponding to the latest SDK version.
The CI already uploads this as artefact, but I think there is no predictable URL to download it, hence I could not provide a link in the readme.
There is no direct way to get a workflows artifact URL, but there is a service for it: https://nightly.link (read what is said on the website) Here is the example link: https://nightly.link/Snektron/vulkan-zig/workflows/build/master/vk.zig.zip Workflow artifacts wont work for people that want to get this file through Zigs package manager.
You could also publish vk.zig as a part of github releases. Ash for Rust seems to directly embed generated files in their repository, that doesn't seem ideal.
It looks like there are ways to create a release from github CI directly. I think ideally it should be as follows:
- Automatically generate a release when a new Vulkan SDK version is released.
- Manually create releases whenever the Zig compiler is updated in a breaking way.
That leaves the question of what to do with older versions and nightly versions of vk.xml. Im not sure that creating a release every day is a good option, but its an option.
There is an option to also create a separate repo for releases like nim does https://github.com/nim-lang/nightlies/releases
But I don't think this is really needed.
In the future package manager could solve these problems, one could get vk.xml through a package manager, we just have to see how it evolves.
I just pushed a new build.zig for the example that shows you how to do it. For now I haven't yet added it as a dependency to the main build.zig, though I'd be open for it if it can be integrated with dependabot or something. See example build.zig. I've also updated the README with a description of how to do it. I believe that should be sufficient to close this issue.