From 0ad448f89009e87fc3f22a85b0af53de5ebf8355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabr=C3=ADel=20Arth=C3=BAr=20P=C3=A9tursson?= Date: Sun, 6 Aug 2017 22:02:45 +0000 Subject: Pass -fpch-preprocess to GCC when precompiled headers are used CCache requires this flag when building with precompiled headers. Without it, the preprocessor fails and CCache fallbacks to running the real compiler. Users still need to set 'sloppiness' to 'pch_defines,time_macros' in their ccache.conf file for CCache to cache builds that use precompiled headers. See the CCache manual for more info: https://ccache.samba.org/manual.html#_precompiled_headers --- mesonbuild/compilers/c.py | 3 +++ mesonbuild/compilers/cpp.py | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 018c353..ec16134 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -777,6 +777,9 @@ class GnuCCompiler(GnuCompiler, CCompiler): def get_std_shared_lib_link_args(self): return ['-shared'] + def get_pch_use_args(self, pch_dir, header): + return ['-fpch-preprocess', '-include', os.path.split(header)[-1]] + class IntelCCompiler(IntelCompiler, CCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None): diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index a933f0e..a9093b3 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os.path + from .. import coredata from ..mesonlib import version_compare @@ -126,6 +128,9 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): return options['cpp_winlibs'].value[:] return [] + def get_pch_use_args(self, pch_dir, header): + return ['-fpch-preprocess', '-include', os.path.split(header)[-1]] + class IntelCPPCompiler(IntelCompiler, CPPCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrap): -- cgit v1.1