summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorAndres Freund2022-10-07 00:19:30 +0000
committerAndres Freund2022-10-07 00:19:30 +0000
commite5555657ba860f2ac25fb7ef9c921a32c6e70c75 (patch)
tree987cfa6b57bb0f47b58f52bd46193ab266b85cf3 /src/pl
parente0b0142959066f3a9de1c6867f4ec8d41d104f33 (diff)
meson: Add support for building with precompiled headers
This substantially speeds up building for windows, due to the vast amount of headers included via windows.h. A cross build from linux targetting mingw goes from 994.11user 136.43system 0:31.58elapsed 3579%CPU to 422.41user 89.05system 0:14.35elapsed 3562%CPU The wins on windows are similar-ish (but I don't have a system at hand just now for actual numbers). Targetting other operating systems the wins are far smaller (tested linux, macOS, FreeBSD). For now precompiled headers are disabled by default, it's not clear how well they work on all platforms. E.g. on FreeBSD gcc doesn't seem to have working support, but clang does. When doing a full build precompiled headers are only beneficial for targets with multiple .c files, as meson builds a separate precompiled header for each target (so that different compilation options take effect). This commit therefore only changes target with at least two .c files to use precompiled headers. Because this commit adds b_pch=false to the default_options new build directories will have precompiled headers disabled by default, however existing build directories will continue use the default value of b_pch, which is true. Note that using precompiled headers with ccache requires setting CCACHE_SLOPPINESS=pch_defines,time_macros to get hits. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> Discussion: https://postgr.es/m/CA+hUKG+50eOUbN++ocDc0Qnp9Pvmou23DSXu=ZA6fepOcftKqA@mail.gmail.com Discussion: https://postgr.es/m/c5736f70-bb6d-8d25-e35c-e3d886e4e905@enterprisedb.com Discussion: https://postgr.es/m/20190826054000.GE7005%40paquier.xyz
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plperl/meson.build1
-rw-r--r--src/pl/plpgsql/src/meson.build1
-rw-r--r--src/pl/plpython/meson.build1
-rw-r--r--src/pl/tcl/meson.build1
4 files changed, 4 insertions, 0 deletions
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 535660085dd..cd3894e6a73 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -45,6 +45,7 @@ endif
plperl = shared_module('plperl',
plperl_sources,
+ c_pch: pch_postgres_h,
include_directories: [plperl_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [perl_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index c46c0a1da2a..27b2f5ef529 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -48,6 +48,7 @@ endif
plpgsql = shared_module('plpgsql',
plpgsql_sources,
+ c_pch: pch_postgres_h,
include_directories: include_directories('.'),
kwargs: pg_mod_args,
)
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 40888386b5f..7bd683580e8 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -36,6 +36,7 @@ endif
plpython = shared_module('plpython3',
plpython_sources,
+ c_pch: pch_postgres_h,
include_directories: [plpython_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [python3_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index f09bb14c950..7a708776c99 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -22,6 +22,7 @@ endif
pltcl = shared_module('pltcl',
pltcl_sources,
+ c_pch: pch_postgres_h,
include_directories: [include_directories('.'), postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [tcl_dep, pg_mod_args['dependencies']],