mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
meson: Disable PCH for GCC
GCC doesn't really benefit as much as Clang does from using precompiled headers. Another aspect to consider is that clangd doesn't really like GCC's PCH flags in the compilation database, so GCC based devshells would continue to work with clangd. This also has the slight advantage of ensuring that our includes are in order, since we build with both Clang and GCC.
This commit is contained in:
parent
bbd14173b5
commit
5db50e3f77
6 changed files with 8 additions and 5 deletions
|
|
@ -19,6 +19,9 @@ add_project_arguments(
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ this_library = library(
|
|||
link_args: linker_export_flags,
|
||||
prelink : true, # For C++ static initializers
|
||||
install : true,
|
||||
cpp_pch : ['pch/precompiled-headers.hh']
|
||||
cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : []
|
||||
)
|
||||
|
||||
install_headers(headers, subdir : 'nix/cmd', preserve_path : true)
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ this_library = library(
|
|||
link_args: linker_export_flags,
|
||||
prelink : true, # For C++ static initializers
|
||||
install : true,
|
||||
cpp_pch : ['pch/precompiled-headers.hh']
|
||||
cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : []
|
||||
)
|
||||
|
||||
install_headers(headers, subdir : 'nix/expr', preserve_path : true)
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ this_library = library(
|
|||
link_args: linker_export_flags,
|
||||
prelink : true, # For C++ static initializers
|
||||
install : true,
|
||||
cpp_pch : ['pch/precompiled-headers.hh']
|
||||
cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : []
|
||||
)
|
||||
|
||||
install_headers(headers, subdir : 'nix/store', preserve_path : true)
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ this_library = library(
|
|||
link_args: linker_export_flags,
|
||||
prelink : true, # For C++ static initializers
|
||||
install : true,
|
||||
cpp_pch : 'pch/precompiled-headers.hh'
|
||||
cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : []
|
||||
)
|
||||
|
||||
install_headers(headers, subdir : 'nix/util', preserve_path : true)
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ this_exe = executable(
|
|||
include_directories : include_dirs,
|
||||
link_args: linker_export_flags,
|
||||
install : true,
|
||||
cpp_pch : ['pch/precompiled-headers.hh']
|
||||
cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : []
|
||||
)
|
||||
|
||||
meson.override_find_program('nix', this_exe)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue