Make the library accessible via build.zig#288
Make the library accessible via build.zig#288pineapplemachine wants to merge 2 commits intozigimg:masterfrom
Conversation
If I understand correctly, this will make the library easier to use as a build-time dependency
PR here to hopefully upstream: zigimg/zigimg#288
|
I don't think exposing the whole library inside the build.zig is a good idea. Back then when I wrote that code, the build system dependency system was not as evolved as it is now. It now have LazyPath for easier dependency on generated files. You should make the image conversion tools actual tools created using the host build target and add the image tool invocation as a dependency to the GBA ROM you are building. Then you'll able to pass Here how I gather the build host target in my personal game engine to build the cook tool. You can use the optimize flag you pass to the zig build or force to build it in ReleaseSafe or ReleaseFast to always have the image conversion tool be fast if you want. const build_host_target = b.resolveTargetQuery(.{
.os_tag = builtin.os.tag,
.abi = builtin.abi,
}); |
|
What is the benefit of doing it that way? I had leaned toward doing the asset processing within build.zig as it seems to have a lot of significant benefits: The interface to asset processing tools is checked through Zig's type system rather than serializing everything as strings to be passed on the command line, they can also return metadata or error information that is type checked and that does not have to be serialized and deserialized, and those tools can be more easily combined into multi-step processes without intermediate writes to disk. |
|
Hi! I would like to add my 2¢ as I also depend on FWIW Also AFAIK |
A project I've been contributing to uses zigimg as a build.zig dependency to load images as part of an asset pipeline. By exporting zigimg itself in build.zig, this project can refer to zigimg with a build.zig.zon dependency instead of having to use a git submodule. (
@import("zigimg")in a dependent project's build.zig imports the contents of zigimg's build.zig)Basically, this makes it easier to use zigimg as part of a build-time asset pipeline, not only as a runtime library.