summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndres Freund2022-10-07 00:19:30 +0000
committerAndres Freund2022-10-07 00:19:30 +0000
commite5555657ba860f2ac25fb7ef9c921a32c6e70c75 (patch)
tree987cfa6b57bb0f47b58f52bd46193ab266b85cf3 /contrib
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 <[email protected]> Reviewed-by: Justin Pryzby <[email protected]> Discussion: https://postgr.es/m/CA+hUKG+50eOUbN++ocDc0Qnp9Pvmou23DSXu=ZA6fepOcftKqA@mail.gmail.com Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/20190826054000.GE7005%40paquier.xyz
Diffstat (limited to 'contrib')
-rw-r--r--contrib/bloom/meson.build1
-rw-r--r--contrib/btree_gist/meson.build1
-rw-r--r--contrib/hstore/meson.build1
-rw-r--r--contrib/pg_trgm/meson.build1
-rw-r--r--contrib/pgcrypto/meson.build1
-rw-r--r--contrib/pgstattuple/meson.build1
-rw-r--r--contrib/sepgsql/meson.build1
-rw-r--r--contrib/xml2/meson.build1
8 files changed, 8 insertions, 0 deletions
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 16f3b83e4d2..163a93c98fb 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -15,6 +15,7 @@ endif
bloom = shared_module('bloom',
bloom_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += bloom
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index e98c91dacc8..bfb7865d213 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -33,6 +33,7 @@ endif
btree_gist = shared_module('btree_gist',
btree_gist_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gist
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 2bb26bb772b..a2a4ec36cb0 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -18,6 +18,7 @@ endif
hstore = shared_module('hstore',
hstore_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index c8c7c07b308..839d6c4a7f6 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -13,6 +13,7 @@ endif
pg_trgm = shared_module('pg_trgm',
pg_trgm_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index 7fc7bbc7ca1..cc782578b49 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -78,6 +78,7 @@ endif
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
},
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 05e4cd46a5c..42d0b0e6ce9 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -12,6 +12,7 @@ endif
pgstattuple = shared_module('pgstattuple',
pgstattuple_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 8bef239e3c2..1ac0fa388ab 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -22,6 +22,7 @@ endif
sepgsql = shared_module('sepgsql',
sepgsql_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [selinux, contrib_mod_args['dependencies']],
}
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 89b0d677516..92ab3368428 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -15,6 +15,7 @@ endif
xml2 = shared_module('pgxml',
xml2_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},