8000 meson: Add support for building with precompiled headers · anarazel/postgres@e1993d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1993d5

Browse files
committed
meson: Add support for building with precompiled headers
This substantially speeds up building for windows. A cross build with mingw goes from real 0m29.884s user 15m41.900s sys 1m58.257s to real 0m13.196s user 6m52.330s sys 1m15.140s The wins on windows are similar-ish (but I don't have a system at hand just now for actual numbers).
1 parent d4f434e commit e1993d5

File tree

27 files changed

+44
-2
lines changed

27 files changed

+44
-2
lines changed

.cirrus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ task:
11641164

11651165
configure_script:
11661166
- vcvarsall x64
1167-
- meson setup --buildtype debug --backend ninja -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
1167+
- meson setup --buildtype debug --backend ninja -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
11681168

11691169
build_script:
11701170
- vcvarsall x64
@@ -1191,7 +1191,7 @@ task:
11911191

11921192
configure_script:
11931193
- vcvarsall x64
1194-
- meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
1194+
- meson setup --buildtype debug --backend vs -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
11951195

11961196
build_script:
11971197
- vcvarsall x64

contrib/bloom/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ bloom_sources = files(
99

1010
bloom = shared_module('bloom',
1111
bloom_sources,
12+
c_pch: pch_postgres_h,
1213
kwargs: contrib_mod_args,
1314
)
1415
contrib_targets += bloom

contrib/btree_gist/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ btree_gist_sources = files(
2727

2828
btree_gist = shared_module('btree_gist',
2929
btree_gist_sources,
30+
c_pch: pch_postgres_h,
3031
kwargs: contrib_mod_args,
3132
)
3233
contrib_targets += btree_gist

contrib/hstore/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ hstore = shared_module('hstore',
1010
'hstore_op.c',
1111
'hstore_subs.c',
1212
),
13+
c_pch: pch_postgres_h,
1314
kwargs: contrib_mod_args,
1415
)
1516
contrib_targets += hstore

contrib/pg_trgm/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pg_trgm = shared_module('pg_trgm',
55
'trgm_op.c',
66
'trgm_regexp.c',
77
),
8+
c_pch: pch_postgres_h,
89
kwargs: contrib_mod_args,
910
)
1011
contrib_targets += pg_trgm

contrib/pgcrypto/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ endif
7272
pgcrypto = shared_module('pgcrypto',
7373
pgcrypto_sources,
7474
link_with: pgcrypto_link_with,
75+
c_pch: pch_postgres_h,
7576
kwargs: contrib_mod_args + {
7677
'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
7778
},

contrib/pgstattuple/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pgstattuple = shared_module('pgstattuple',
44
'pgstatindex.c',
55
'pgstattuple.c',
66
),
7+
c_pch: pch_postgres_h,
78
kwargs: contrib_mod_args,
89
)
910
contrib_targets += pgstattuple

contrib/sepgsql/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ sepgsql_sources = files(
1616

1717
sepgsql = shared_module('sepgsql',
1818
sepgsql_sources,
19+
c_pch: pch_postgres_h,
1920
kwargs: contrib_mod_args + {
2021
'dependencies': [selinux, contrib_mod_args['dependencies']],
2122
}

contrib/xml2/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ xml2 = shared_module('pgxml',
77
'xpath.c',
88
'xslt_proc.c',
99
),
10+
c_pch: pch_postgres_h,
1011
kwargs: contrib_mod_args + {
1112
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
1213
},

meson.build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ project('postgresql',
1515
meson_version: '>=0.54',
1616
default_options: [
1717
'warning_level=1', #-Wall equivalent
18+
'b_pch=false',
1819
'buildtype=release',
1920
]
2021
)
@@ -1764,6 +1765,13 @@ if cc.get_id() == 'msvc'
17641765
'/wd4267', # conversion from 'size_t' to 'type', possible loss of data
17651766
]
17661767

1768+
# Dirty hack to disable warnings due to some files defining
1769+
# UMDF_USING_NTSTATUS before including postgres.h. We need a better fix, but
1770+
# for now this allows us to see "real" warnings.
1771+
if get_option('b_pch')
1772+
cflags_warn += '/wd4005' # macro redefinition
1773+
endif
1774+
17671775
cppflags += [
17681776
'/DWIN32',
17691777
'/DWINDOWS',

0 commit comments

Comments
 (0)
0