mirror of
https://github.com/NixOS/nix.git
synced 2025-11-22 18:29:36 +01:00
meson: Add option for controlling PCH
In practice it turns out that turning off PCH is pretty useful when debugging incorrect includes. I didn't want to add this option initially because of the sheer amount of copy-pasta that meson requires. But considering that this is useful and the cost of copying the option a single time is not too high this seems acceptable.
This commit is contained in:
parent
fb117e0cac
commit
c105846646
11 changed files with 106 additions and 2 deletions
|
|
@ -27,3 +27,13 @@ option(
|
||||||
value : false,
|
value : false,
|
||||||
description : 'Build benchmarks (requires gbenchmark)',
|
description : 'Build benchmarks (requires gbenchmark)',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Emulating 'auto' options, since we don't want auto_features to affect this
|
||||||
|
# and there's no other way of conditionally defaulting the value.
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,11 @@ add_project_arguments(
|
||||||
)
|
)
|
||||||
|
|
||||||
# GCC doesn't benefit much from precompiled headers.
|
# GCC doesn't benefit much from precompiled headers.
|
||||||
do_pch = cxx.get_id() == 'clang'
|
if get_option('pch') == 'auto'
|
||||||
|
do_pch = cxx.get_id() == 'clang'
|
||||||
|
else
|
||||||
|
do_pch = get_option('pch') == 'enabled'
|
||||||
|
endif
|
||||||
|
|
||||||
# This is a clang-only option for improving build times.
|
# This is a clang-only option for improving build times.
|
||||||
# It forces the instantiation of templates in the PCH itself and
|
# It forces the instantiation of templates in the PCH itself and
|
||||||
|
|
@ -38,7 +42,7 @@ do_pch = cxx.get_id() == 'clang'
|
||||||
# bother checking the version.
|
# bother checking the version.
|
||||||
# This feature helps in particular with the expensive nlohmann::json template
|
# This feature helps in particular with the expensive nlohmann::json template
|
||||||
# instantiations in libutil and libstore.
|
# instantiations in libutil and libstore.
|
||||||
if cxx.get_id() == 'clang'
|
if cxx.get_id() == 'clang' and do_pch
|
||||||
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
|
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,13 @@ option(
|
||||||
value : 'editline',
|
value : 'editline',
|
||||||
description : 'Which library to use for nice line editing with the Nix language REPL',
|
description : 'Which library to use for nice line editing with the Nix language REPL',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
||||||
10
src/libexpr-tests/meson.options
Normal file
10
src/libexpr-tests/meson.options
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# vim: filetype=meson
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
@ -3,3 +3,13 @@ option(
|
||||||
type : 'feature',
|
type : 'feature',
|
||||||
description : 'enable garbage collection in the Nix expression evaluator (requires Boehm GC)',
|
description : 'enable garbage collection in the Nix expression evaluator (requires Boehm GC)',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
||||||
10
src/libfetchers/meson.options
Normal file
10
src/libfetchers/meson.options
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# vim: filetype=meson
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
@ -7,3 +7,13 @@ option(
|
||||||
description : 'Build benchmarks (requires gbenchmark)',
|
description : 'Build benchmarks (requires gbenchmark)',
|
||||||
yield : true,
|
yield : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,3 +40,13 @@ option(
|
||||||
value : 'disabled',
|
value : 'disabled',
|
||||||
description : 'Enable curl-based S3 binary cache store support (requires aws-crt-cpp and curl >= 7.75.0)',
|
description : 'Enable curl-based S3 binary cache store support (requires aws-crt-cpp and curl >= 7.75.0)',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
||||||
10
src/libutil-tests/meson.options
Normal file
10
src/libutil-tests/meson.options
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# vim: filetype=meson
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
@ -5,3 +5,13 @@ option(
|
||||||
type : 'feature',
|
type : 'feature',
|
||||||
description : 'determine microarchitecture levels with libcpuid (only relevant on x86_64)',
|
description : 'determine microarchitecture levels with libcpuid (only relevant on x86_64)',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,13 @@ option(
|
||||||
value : 'etc/profile.d',
|
value : 'etc/profile.d',
|
||||||
description : 'the path to install shell profile files',
|
description : 'the path to install shell profile files',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'pch',
|
||||||
|
type : 'combo',
|
||||||
|
choices : [ 'auto', 'enabled', 'disabled' ],
|
||||||
|
value : 'auto',
|
||||||
|
description : 'Use C++ Precompiled Headers to speed up compilation',
|
||||||
|
yield : true,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue