meson: Add headerscheck and cpluspluscheck targets

Author: Miłosz Bieniek <bieniek.milosz0@gmail.com>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com
This commit is contained in:
Peter Eisentraut 2026-03-18 11:25:47 +01:00
parent 720c9b504e
commit e82fc27e09
3 changed files with 23 additions and 0 deletions

View file

@ -17,6 +17,8 @@ Developer Targets:
reformat-dat-files Rewrite catalog data files into standard format
expand-dat-files Expand all data files to include defaults
update-unicode Update Unicode data to new version
headerscheck Check that all headers compile standalone
cpluspluscheck Check that all headers compile as C++
Documentation Targets:
html Build documentation in multi-page HTML format

View file

@ -4022,6 +4022,21 @@ add_test_setup('running',
###############################################################
# headerscheck
###############################################################
headerscheck = files('src/tools/pginclude/headerscheck')
run_target('headerscheck',
command: [headerscheck, meson.project_source_root(), meson.project_build_root()]
)
run_target('cpluspluscheck',
command: [headerscheck, '--cplusplus', meson.project_source_root(), meson.project_build_root()]
)
###############################################################
# Pseudo targets
###############################################################

View file

@ -62,6 +62,9 @@ have included at least
in your configure options, else you're likely to get errors about
related headers not being found.
When using meson, run "meson compile -C build headerscheck" or "ninja
-C build headerscheck".
A limitation of the current script is that it doesn't know exactly which
headers are for frontend or backend; when in doubt it uses postgres.h as
prerequisite, even if postgres_fe.h or c.h would be more appropriate.
@ -89,6 +92,9 @@ have included at least
in your configure options, else you're likely to get errors about
related headers not being found.
When using meson, run "meson compile -C build cpluspluscheck" or
"ninja -C build cpluspluscheck".
If you are using a non-g++-compatible C++ compiler, you may need to
override the script's CXXFLAGS setting by setting a suitable environment
value.