zig icon indicating copy to clipboard operation
zig copied to clipboard

ConfigHeader: Add support for meson style templates

Open GalaxyShard opened this issue 7 months ago • 3 comments

Revival of https://github.com/ziglang/zig/pull/18079

I rebased the two commits and fixed the tests which now compile and run correctly.

GalaxyShard avatar May 20 '25 22:05 GalaxyShard

I've done some thorough testing of this with porting over all of the meson config headers from GTK and its several dependencies. All of the resulting headers are identical to the corresponding ones in my /usr/include (aside from the "This file was generated by ConfigHeader using the Zig Build System." comment).

GalaxyShard avatar May 24 '25 23:05 GalaxyShard

the big issue with mesondefine is that they don't strictly specify how its suppose to work and there is little to no regression testing, so a change upstream could cause interop issues with zig in subtle ways.

Jan200101 avatar May 28 '25 10:05 Jan200101

the big issue with mesondefine is that they don't strictly specify how its suppose to work and there is little to no regression testing, so a change upstream could cause interop issues with zig in subtle ways.

Meson's documentation (https://mesonbuild.com/Configuration.html) defines how mesondefine is to be expanded:

#define TOKEN     // If TOKEN is set to boolean true.
#undef TOKEN      // If TOKEN is set to boolean false.
#define TOKEN 4   // If TOKEN is set to an integer or string value.
/* undef TOKEN */ // If TOKEN has not been set to any value.

If there were regressions, it would be a bug on meson's part, and it would break many projects using meson so I doubt any accidental regressions would become "features" especially considering the logic is fairly straightforward (the only 4 possibilities are in the block above; you'd have to break almost every project by changing the behavior of any one of them).

GalaxyShard avatar May 28 '25 15:05 GalaxyShard

If someone could rerun x86_64-windows-release CI that would be great; it appears to have timed out.

GalaxyShard avatar Sep 11 '25 15:09 GalaxyShard