Per Module Compile Options and "-target name"

When the per module compile options was added, I assumed that the main use case was to mix module with different optimization.

However, after reading std.Build: Install Windows DLLs to `<prefix>/bin/` by default · ziglang/zig@e8f28cd · GitHub, I found that you can also have different executable formats.

What is the use case of having different executable formats in a Zig package/distribution?


I don’t know exactly, I would imagine if you have something like a console dev kit, where you have an application running on your machine, which loads a console/embedded program onto another device and runs it there?

I recently worked on a project where the main executable uses Linux’s io_uring directly, so it only makes sense to build this type of module for a Linux target. However this main executable depends on several modules that generate code and data files. These can be built and run on any target, so you can build the entire project on a Mac for example where the code and data gen parts are built and run natively but then the final main executable program is built specifically for the Linux target.