summaryrefslogtreecommitdiff
path: root/solenv/gbuild/platform/com_MSC_class.mk
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-11-13 16:20:46 +0000
committerLuboš Luňák <l.lunak@collabora.com>2021-11-17 15:21:44 +0100
commitc48a5f2653f7e76421c140cbd6018deffefccaf9 (patch)
treeb3415eecc9205f5787e749d8307c40792eedca77 /solenv/gbuild/platform/com_MSC_class.mk
parent938fbac669bc59cf0b388bd0d21a2f14c4399757 (diff)
support ccache for MSVC too
There's no official MSVC support in ccache yet, but there are patches in progress of getting upstreamed. So right now it's necessary to get a patched ccache. Ccache cannot work with -Zi option, since sharing debuginfo in a .PDB cannot be cached. Added --enable-z7-symbols that gets enabled by default if ccache is detected. It works even with PCHs enabled, and externals seem to work too. I get almost 100% hit rate on a rebuild, although such a rebuild is slower than on Linux. Change-Id: I1d230ee1fccc441b9d9bec794cc2e1ec13161999 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125179 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'solenv/gbuild/platform/com_MSC_class.mk')
-rw-r--r--solenv/gbuild/platform/com_MSC_class.mk18
1 files changed, 16 insertions, 2 deletions
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index da5b682d6b8c..16eb6c2ee4d3 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -65,6 +65,7 @@ define gb_CObject__command_pattern
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(1)) $(dir $(4)) && \
unset INCLUDE && \
+ $(gb_COMPILER_SETUP) \
$(call gb_CObject__compiler,$(2),$(3),$(6)) \
$(call gb_Helper_remove_overridden_flags, \
$(DEFS) \
@@ -107,6 +108,7 @@ $(call gb_Output_announce,$(2),$(true),PCH,1)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(6))) && \
unset INCLUDE && \
+ CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
$(call gb_CObject__compiler,$(4),$(3),$(7)) \
$(call gb_Helper_remove_overridden_flags, \
$(4) $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS))) \
@@ -120,9 +122,21 @@ $(call gb_Helper_abbreviate_dirs,\
$(call gb_Trace_EndRange,$(2),PCH)
endef
-# No ccache with MSVC, no need to create a checksum for it.
-# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename)
+# MSVC does not generate the same .pch for the same input, so checksum the (preprocessed) input
+# $(call gb_PrecompiledHeader__sum_command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler)
define gb_PrecompiledHeader__sum_command
+$(call gb_Helper_abbreviate_dirs,\
+ unset INCLUDE && \
+ CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
+ $(call gb_CObject__compiler,$(4),$(3),$(7)) \
+ $(call gb_Helper_remove_overridden_flags, \
+ $(4)$(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS))) \
+ $(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \
+ $(gb_LTOFLAGS) \
+ $(5) \
+ -E $(3) \
+ 2>&1 | $(SHA256SUM) >$(1).sum \
+ )
endef
# When building a PCH, MSVC also creates a .pdb file with debug info. So for reuse