mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Enables builds with ASAN to catch memory corruption
bugs faster and in CI. This is an incredibly valuable
instrument that must be used as much as possible.
Somewhat based on jade's work from Lix, though there's a lot that
we have to do differently:
19ae87e5ce
Co-authored-by: Jade Lovelace <lix@jade.fyi>
37 lines
1.2 KiB
Meson
37 lines
1.2 KiB
Meson
# This is only conditional to work around
|
|
# https://github.com/mesonbuild/meson/issues/13293. It should be
|
|
# unconditional.
|
|
if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc')
|
|
deps_private += dependency('threads')
|
|
endif
|
|
|
|
add_project_arguments(
|
|
'-Wdeprecated-copy',
|
|
'-Werror=suggest-override',
|
|
'-Werror=switch',
|
|
'-Werror=switch-enum',
|
|
'-Werror=undef',
|
|
'-Werror=unused-result',
|
|
'-Werror=sign-compare',
|
|
'-Wignored-qualifiers',
|
|
'-Wimplicit-fallthrough',
|
|
'-Wno-deprecated-declarations',
|
|
language : 'cpp',
|
|
)
|
|
|
|
# GCC doesn't benefit much from precompiled headers.
|
|
do_pch = cxx.get_id() == 'clang'
|
|
|
|
# This is a clang-only option for improving build times.
|
|
# It forces the instantiation of templates in the PCH itself and
|
|
# not every translation unit it's included in.
|
|
# It's available starting from clang 11, which is old enough to not
|
|
# bother checking the version.
|
|
# This feature helps in particular with the expensive nlohmann::json template
|
|
# instantiations in libutil and libstore.
|
|
if cxx.get_id() == 'clang'
|
|
add_project_arguments('-fpch-instantiate-templates', language : 'cpp')
|
|
endif
|
|
|
|
# Darwin ld doesn't like "X.Y.Zpre"
|
|
nix_soversion = meson.project_version().replace('pre', '')
|