summaryrefslogtreecommitdiff
path: root/solenv/gbuild/platform/com_GCC_class.mk
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-06-22 15:09:39 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-01-18 14:56:12 +0100
commit7162d047941c721577b8719323fce7f3be5212fc (patch)
treef0c63b69bc0e042a6082a259c1c24a3ee8f34aaf /solenv/gbuild/platform/com_GCC_class.mk
parent7dc50ca94ad6cc47561662424e163250a8e5957e (diff)
add support for Clang's -building-pch-with-obj
This marks the PCH as having an accompanying object file, and this object file needs to be also built, but this allows the compiler to skip generating stuff that'd be shared by all the objects using the PCH. Currently it doesn't make much of a difference, few symbols if any, but template instantiations could be shared this way, as soon as Clang gets the necessary support (my WIP patch). Change-Id: Ib1b86338d85a47b48979558435253dc2672a0da8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87009 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'solenv/gbuild/platform/com_GCC_class.mk')
-rw-r--r--solenv/gbuild/platform/com_GCC_class.mk7
1 files changed, 6 insertions, 1 deletions
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index bf15f5e472d0..2ec7a66f3e25 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -88,7 +88,11 @@ gb_PrecompiledHeader_get_enableflags = \
gb_PrecompiledHeader_EXT := .gch
endif
-# Clang and gcc do not need any extra .o file for PCH
+# Clang supports building extra object file where it puts code that would be shared by all users of the PCH.
+# Unlike with MSVC it is built as a separate step.
+gb_PrecompiledHeader_pch_with_obj = $(BUILDING_PCH_WITH_OBJ)
+
+# This is for MSVC's object file built directly as a side-effect of building the PCH.
gb_PrecompiledHeader_get_objectfile =
define gb_PrecompiledHeader__command
@@ -105,6 +109,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
$(gb_NO_PCH_TIMESTAMP) \
+ $(gb_PrecompiledHeader_pch_with_obj) \
$(6) \
$(call gb_cxx_dep_generation_options,$(1),$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2),$(7))) \
-c $(patsubst %.cxx,%.hxx,$(3)) \