Re: [PATCH v2 3/4] meson: add support for 'hdr-check'
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Apr 14, 2025, 14:25 UTC
- Message-ID
- <CAOLa=ZQTwqyAU2cSFCQL4Ofc+dVyT5h6x5Ojyi=Bo6uYqze3Vg@mail.gmail.com>
- In-Reply-To
- <87mscj5dxe.fsf@iotcl.com>
Toon Claes <toon@iotcl.com> writes:
Show 38 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>> The Makefile supports a target called 'hdr-check', which checks if
>> individual header files can be independently compiled. Let's port this
>> functionality to meson, our new build system too. The implementation
>> resembles that of the Makefile and provides the same check.
>>
>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
>> ---
>> meson.build | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 107 insertions(+)
>>
>> diff --git a/meson.build b/meson.build
>> index 790d178007..6fce1aa618 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -655,6 +655,12 @@ if git.found()
>> endforeach
>> endif
>>
>> +headers_generated = [
>> + 'command-list.h',
>> + 'config-list.h',
>> + 'hook-list.h'
>> +]
>
> Can we maybe compose this list by instead doing:
>
> generated_headers = []
> foreach f : builtin_sources + libgit_sources + third_party_sources
> if f.endswith(".h")
> generated_headers += f
> endif
> endforeach
>
> (This would take `third_party_sources` into account as suggested by
> Patrick[1]).
>This does make sense, but this also feels like an overkill to only get three headers.
Show 18 quoted lines
> If we consider that too much magic, I would suggest: > > generated_headers = [] > builtin_sources += custom_target( > output: 'config-list.h', > command: [ > shell, > meson.current_source_dir() + '/generate-configlist.sh', > meson.current_source_dir(), > '@OUTPUT@', > ], > env: script_environment, > ) > generated_headers += 'config-list.h' > > I hope this would reduce the chance to forget to add more headers to > this list (assuming people copy the code blurb from another location). >
This looks nice, Let me modify accordingly!
> -- > Toon