aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/meson.build5
-rw-r--r--src/backend/snowball/meson.build1
-rw-r--r--src/bin/pg_dump/meson.build1
-rw-r--r--src/bin/pg_upgrade/meson.build1
-rw-r--r--src/bin/pgbench/meson.build1
-rw-r--r--src/bin/psql/meson.build1
-rw-r--r--src/common/meson.build2
-rw-r--r--src/fe_utils/meson.build1
-rw-r--r--src/include/meson.build1
-rw-r--r--src/include/pch/c_pch.h1
-rw-r--r--src/include/pch/meson.build4
-rw-r--r--src/include/pch/postgres_fe_pch.h1
-rw-r--r--src/include/pch/postgres_pch.h1
-rw-r--r--src/interfaces/ecpg/ecpglib/meson.build2
-rw-r--r--src/interfaces/ecpg/pgtypeslib/meson.build2
-rw-r--r--src/interfaces/ecpg/preproc/meson.build1
-rw-r--r--src/interfaces/libpq/meson.build2
-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
-rw-r--r--src/port/meson.build2
22 files changed, 34 insertions, 0 deletions
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 6f4cd6ceb09..37562bae132 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -62,6 +62,7 @@ postgres_lib = static_library('postgres_lib',
backend_sources + timezone_sources + generated_backend_sources,
link_whole: backend_link_with,
dependencies: backend_build_deps,
+ c_pch: pch_postgres_h,
kwargs: internal_lib_args,
)
@@ -81,6 +82,10 @@ if cc.get_id() == 'msvc'
backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
backend_link_depends += postgres_def
+ # Due to the way msvc and meson's precompiled headers implementation
+ # interact, we need to have symbols from the full library available. Could
+ # be restricted to b_pch=true.
+ backend_link_with += postgres_lib
elif host_system == 'aix'
# The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 974401d187e..72959fa29d6 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -66,6 +66,7 @@ endif
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
+ c_pch: pch_postgres_h,
kwargs: pg_mod_args + {
'include_directories': [stemmer_inc],
}
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 3527a25c288..e66f632b54e 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -13,6 +13,7 @@ pg_dump_common_sources = files(
pg_dump_common = static_library('libpgdump_common',
pg_dump_common_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq, zlib],
kwargs: internal_lib_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index a7b927a45c7..212bc9ce6ef 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -24,6 +24,7 @@ endif
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index 3cc393d17ea..1a3ec5d1295 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -27,6 +27,7 @@ pgbench = executable('pgbench',
pgbench_sources,
dependencies: [frontend_code, libpq, thread_dep],
include_directories: include_directories('.'),
+ c_pch: pch_postgres_fe_h,
c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
kwargs: default_bin_args,
)
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 1264fc19fbd..a4c46bf5385 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -44,6 +44,7 @@ endif
psql = executable('psql',
psql_sources,
+ c_pch: pch_postgres_fe_h,
include_directories: include_directories('.'),
dependencies: [frontend_code, libpq, readline],
kwargs: default_bin_args,
diff --git a/src/common/meson.build b/src/common/meson.build
index 23842e1ffef..1c9b8a3a018 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -147,6 +147,7 @@ foreach name, opts : pgcommon_variants
endif
c_args = opts.get('c_args', []) + common_cflags[cflagname]
cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname),
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'sources': sources,
@@ -159,6 +160,7 @@ foreach name, opts : pgcommon_variants
lib = static_library('libpgcommon@0@'.format(name),
link_with: cflag_libs,
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index 3e226c260ac..fe0b801387c 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -23,6 +23,7 @@ fe_utils_sources += psqlscan
fe_utils = static_library('libpgfeutils',
fe_utils_sources + generated_headers,
+ c_pch: pch_postgres_fe_h,
include_directories: [postgres_inc, libpq_inc],
c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
dependencies: frontend_common_code,
diff --git a/src/include/meson.build b/src/include/meson.build
index f2f7d03ff27..35c06c4856a 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -114,6 +114,7 @@ install_headers(
subdir('catalog')
subdir('nodes')
+subdir('pch')
subdir('storage')
subdir('utils')
diff --git a/src/include/pch/c_pch.h b/src/include/pch/c_pch.h
new file mode 100644
index 00000000000..f40c757ca62
--- /dev/null
+++ b/src/include/pch/c_pch.h
@@ -0,0 +1 @@
+#include "c.h"
diff --git a/src/include/pch/meson.build b/src/include/pch/meson.build
new file mode 100644
index 00000000000..2bcec49c3a2
--- /dev/null
+++ b/src/include/pch/meson.build
@@ -0,0 +1,4 @@
+# See https://github.com/mesonbuild/meson/issues/10338
+pch_c_h = meson.source_root() / meson.current_source_dir() / 'c_pch.h'
+pch_postgres_h = meson.source_root() / meson.current_source_dir() / 'postgres_pch.h'
+pch_postgres_fe_h = meson.source_root() / meson.current_source_dir() / 'postgres_fe_pch.h'
diff --git a/src/include/pch/postgres_fe_pch.h b/src/include/pch/postgres_fe_pch.h
new file mode 100644
index 00000000000..f3ea20912d3
--- /dev/null
+++ b/src/include/pch/postgres_fe_pch.h
@@ -0,0 +1 @@
+#include "postgres_fe.h"
diff --git a/src/include/pch/postgres_pch.h b/src/include/pch/postgres_pch.h
new file mode 100644
index 00000000000..71b2f35f76b
--- /dev/null
+++ b/src/include/pch/postgres_pch.h
@@ -0,0 +1 @@
+#include "postgres.h"
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 7e6e6fbf5c0..2d07da1ff4c 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -27,6 +27,7 @@ ecpglib_st = static_library('libecpg',
ecpglib_sources,
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_stlib_code, thread_dep, libpq],
link_with: [ecpg_pgtypes_st],
kwargs: default_lib_args,
@@ -37,6 +38,7 @@ ecpglib_so = shared_library('libecpg',
ecpglib_sources + ecpglib_so_sources,
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_shlib_code, libpq, thread_dep],
link_with: ecpg_pgtypes_so,
soversion: host_system != 'windows' ? '6' : '',
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 530dd2c602d..d7e1a94d24d 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -23,6 +23,7 @@ ecpg_pgtypes_st = static_library('libpgtypes',
ecpg_pgtypes_sources,
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
+ c_pch: pch_postgres_fe_h,
dependencies: frontend_stlib_code,
kwargs: default_lib_args,
)
@@ -32,6 +33,7 @@ ecpg_pgtypes_so = shared_library('libpgtypes',
ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
+ c_pch: pch_postgres_fe_h,
dependencies: frontend_shlib_code,
version: '3.' + pg_version_major.to_string(),
soversion: host_system != 'windows' ? '3' : '',
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
index 74876f039c9..3d42ee439ff 100644
--- a/src/interfaces/ecpg/preproc/meson.build
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -102,6 +102,7 @@ endif
ecpg_exe = executable('ecpg',
ecpg_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 533b2e6f773..8e696f1183c 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -58,6 +58,7 @@ libpq_st = static_library('libpq',
libpq_sources,
include_directories: [libpq_inc],
c_args: libpq_c_args,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_stlib_code, libpq_deps],
kwargs: default_lib_args,
)
@@ -66,6 +67,7 @@ libpq_so = shared_library('libpq',
libpq_sources + libpq_so_sources,
include_directories: [libpq_inc, postgres_inc],
c_args: libpq_c_args,
+ c_pch: pch_postgres_fe_h,
version: '5.' + pg_version_major.to_string(),
soversion: host_system != 'windows' ? '5' : '',
darwin_versions: ['5', '5.' + pg_version_major.to_string()],
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']],
diff --git a/src/port/meson.build b/src/port/meson.build
index ced2e014db8..c2222696f1b 100644
--- a/src/port/meson.build
+++ b/src/port/meson.build
@@ -161,6 +161,7 @@ foreach name, opts : pgport_variants
c_args = opts.get('c_args', []) + pgport_cflags[cflagname]
cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname),
sources,
+ c_pch: pch_c_h,
kwargs: opts + {
'c_args': c_args,
'build_by_default': false,
@@ -172,6 +173,7 @@ foreach name, opts : pgport_variants
lib = static_library('libpgport@0@'.format(name),
pgport_sources,
link_with: cflag_libs,
+ c_pch: pch_c_h,
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
}