First time user of a project using a .zon declared dependency. I’m trying to depend on the Ziglua project which declares a .zon file that I make my own project depend on like below:
However, the Ziglua project exposes various project specific settings, such as which Lua version it uses. When compiling the Ziglua project and its examples, I can specify this like so:
zig build -Dversion=luau test
But how do I specify the same in my own application’s build.zig so that zig build builds the right flavor of Ziglua?
It helps to first look at what the Ziglua build.zig does, especially these two snippets of code:
What you want to do is to define similar options in your own build.zig, then include them in your args struct in your b.depdendency call to forward them to Ziglua.
The shared option is pretty simple since it’s just a boolean. For the version option you will need to import the LuaVersion enum from the Ziglua build.zig, which you should be able to do with @import("ziglua").