[Libreoffice-commits] core.git: 2 commits - config_host.mk.in configure.ac Repository.mk slideshow/CppunitTest_slideshow.mk slideshow/Library_slideshow.mk solenv/gbuild solenv/qa

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 18 13:56:48 UTC 2020


 Repository.mk                           |    1 +
 config_host.mk.in                       |    1 +
 configure.ac                            |   15 +++++++++++++++
 slideshow/CppunitTest_slideshow.mk      |    1 +
 slideshow/Library_slideshow.mk          |    1 +
 solenv/gbuild/LinkTarget.mk             |   22 +++++++++++++++++++---
 solenv/gbuild/PrecompiledHeaders.mk     |    2 +-
 solenv/gbuild/platform/com_GCC_class.mk |    7 ++++++-
 solenv/qa/python/gbuildtojson.py        |    1 +
 9 files changed, 46 insertions(+), 5 deletions(-)

New commits:
commit 68c934c08401d1edbd89746dd0d554d7fc80665b
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Nov 8 21:00:48 2019 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Jan 18 14:56:25 2020 +0100

    make Library_slideshow explicitly link svl
    
    It already links svxcore, which pulls in svl, so make it explicit.
    This fixes a tricky linking problem when using -fmodules-codegen.
    
    Change-Id: I2422519cd87e0aeff2de2bdbb4fe33e6fd55f311
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87010
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/slideshow/CppunitTest_slideshow.mk b/slideshow/CppunitTest_slideshow.mk
index 030a4baa1fa5..ae17f66d8452 100644
--- a/slideshow/CppunitTest_slideshow.mk
+++ b/slideshow/CppunitTest_slideshow.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_libraries,slideshow,\
     cppuhelper \
     sal \
     salhelper \
+    svl \
     svt \
     svx \
     svxcore \
diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk
index 23b8b86ac311..58e169a05cbb 100644
--- a/slideshow/Library_slideshow.mk
+++ b/slideshow/Library_slideshow.mk
@@ -51,6 +51,7 @@ $(eval $(call gb_Library_use_libraries,slideshow,\
     cppuhelper \
     sal \
     salhelper \
+    svl \
     svt \
     svxcore \
     tl \
commit 7162d047941c721577b8719323fce7f3be5212fc
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sat Jun 22 15:09:39 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sat Jan 18 14:56:12 2020 +0100

    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 at collabora.com>

diff --git a/Repository.mk b/Repository.mk
index 88941099db72..7372a01319eb 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -542,6 +542,7 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE, \
 	scqahelper \
 	unowinreg \
 	wpftqahelper \
+	precompiled_system \
 	$(if $(filter MSC,$(COM)),cli_cppuhelper) \
 	$(if $(filter $(OS),ANDROID),lo-bootstrap) \
 	$(if $(filter $(OS),MACOSX),OOoSpotlightImporter) \
diff --git a/config_host.mk.in b/config_host.mk.in
index 1cf941b4a5da..e1cddb295964 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -55,6 +55,7 @@ export BUILD_UNOWINREG=@BUILD_UNOWINREG@
 export BUILD_VER_STRING=@BUILD_VER_STRING@
 export BUILD_X64=@BUILD_X64@
 export BUILD_X86=@BUILD_X86@
+export BUILDING_PCH_WITH_OBJ=@BUILDING_PCH_WITH_OBJ@
 export BZIP2_CFLAGS=$(gb_SPACE)@BZIP2_CFLAGS@
 export BZIP2_LIBS=$(gb_SPACE)@BZIP2_LIBS@
 export CAIRO_CFLAGS=$(gb_SPACE)@CAIRO_CFLAGS@
diff --git a/configure.ac b/configure.ac
index 04e110bc6133..1f7eb690b6cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5187,6 +5187,21 @@ if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_
     fi
 fi
 
+BUILDING_PCH_WITH_OBJ=
+if test -n "$ENABLE_PCH"; then
+    AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
+    save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
+    CFLAGS=$save_CFLAGS
+    if test -n "$BUILDING_PCH_WITH_OBJ"; then
+        AC_MSG_RESULT(yes)
+    else
+        AC_MSG_RESULT(no)
+    fi
+fi
+AC_SUBST(BUILDING_PCH_WITH_OBJ)
+
 TAB=`printf '\t'`
 
 AC_MSG_CHECKING([the GNU Make version])
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 0cfa5a25c145..f3fa447a57bf 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -268,12 +268,14 @@ gb_CxxObject_get_source = $(1)/$(2).cxx
 # compiled with different flags and link that in rather than mixing different
 # flags in one linktarget. If OBJECT_HAS_EXTRA_CXXFLAGS is set, the object
 # has explicitly set additional CXXFLAGS, so in that case avoid using the PCH.
+# T_PCH_EXTRA_CXXFLAGS is used when some object requires extra flags when using
+# the PCH, but they are intended (gb_PrecompiledHeader_pch_with_obj).
 define gb_CxxObject__set_pchflags
 ifneq ($(gb_ENABLE_PCH),)
 ifneq ($(strip $$(PCH_NAME)),)
 ifeq ($(OBJECT_HAS_EXTRA_CXXFLAGS),)
 ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS)),$$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
-$$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME),$$(PCH_LINKTARGETMAKEFILENAME))
+$$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME),$$(PCH_LINKTARGETMAKEFILENAME)) $$(T_PCH_EXTRA_CXXFLAGS)
 else
 $$(warning No precompiled header available for $$*.cxx .)
 $$(info precompiled header flags : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS)))
@@ -785,6 +787,7 @@ $(call gb_LinkTarget_get_target,$(1)) : PCH_LINKTARGETMAKEFILENAME :=
 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX :=
 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJNOEX :=
+$(call gb_LinkTarget_get_target,$(1)) : T_PCH_EXTRA_CXXFLAGS :=
 $(call gb_LinkTarget_get_target,$(1)) : PE_X86 :=
 $(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
 $(call gb_LinkTarget_get_target,$(1)) : TARGETGUI :=
@@ -1131,10 +1134,12 @@ $(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target
 $(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3) $(5)
 $(call gb_CxxObject_get_target,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS := $(if $(strip $(3)),1)
 $(call gb_CxxObject_get_target,$(2)) : \
-	OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
+	OBJECTOWNER := $(if $(6),,$(call gb_Object__owner,$(2),$(1)))
 ifneq ($(gb_ENABLE_PCH),)
+ifeq ($(6),)
 $(call gb_CxxObject_get_target,$(2)) : $(call gb_LinkTarget_get_pch_timestamp,$(4))
 endif
+endif
 
 ifeq ($(gb_FULLDEPS),$(true))
 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS += $(2)
@@ -1551,6 +1556,11 @@ $(call gb_LinkTarget_get_pch_timestamp,$(4)) : $(call gb_PrecompiledHeader_get_t
 
 $(call gb_LinkTarget__set_precompiled_header_variables,$(1),$(2),$(3),$(4))
 
+ifneq ($(BUILDING_PCH_WITH_OBJ),)
+$(call gb_LinkTarget_add_exception_object,$(1),$(2),,$(4))
+$(call gb_CxxObject_get_target,$(2)) : T_PCH_EXTRA_CXXFLAGS += $(gb_PrecompiledHeader_pch_with_obj)
+endif
+
 ifeq ($(gb_FULLDEPS),$(true))
 -include $(call gb_PrecompiledHeader_get_dep_target,$(3),$(4))
 endif
@@ -1561,7 +1571,7 @@ endef
 define gb_LinkTarget_set_precompiled_header
 ifneq ($(gb_ENABLE_PCH),)
 $(call gb_LinkTarget__set_precompiled_header_impl,$(1),$(2),$(notdir $(2)),$(4))
-$(call gb_PrecompiledHeader_generate_rules,$(notdir $(2)),$(1),$(4))
+$(call gb_PrecompiledHeader_generate_rules,$(notdir $(2)),$(1),$(4),$(2))
 endif
 
 endef
@@ -1581,6 +1591,12 @@ $(call gb_LinkTarget_get_pch_reuse_timestamp,$(4)) : $(call gb_PrecompiledHeader
 	$$(call gb_PrecompiledHeader__copy_reuse_files,$(1),$(3),$(4))
 	mkdir -p $$(dir $$@) && touch $$@
 
+ifneq ($(BUILDING_PCH_WITH_OBJ),)
+# We need to link in also the PCH's object file. Again, rely on a special for_reuse target for dependencies.
+$(if $(wildcard $(call gb_CxxObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_CxxObject_get_source,$(SRCDIR),$(2)))))
+$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
+endif
+
 endef
 
 
diff --git a/solenv/gbuild/PrecompiledHeaders.mk b/solenv/gbuild/PrecompiledHeaders.mk
index 77c07e65e2a4..1ea64140c50c 100644
--- a/solenv/gbuild/PrecompiledHeaders.mk
+++ b/solenv/gbuild/PrecompiledHeaders.mk
@@ -29,7 +29,7 @@ gb_PrecompiledHeader__get_debugdir = $(if $(call gb_LinkTarget__symbols_enabled,
 # for $(1)'s and things that are constant.
 # The defines are needed to get the right version of gb_PrecompiledHeader__get_debugdir.
 
-# $(call gb_PrecompiledHeader_generate_rules,pchtarget,linktarget,linktargetmakefilename)
+# $(call gb_PrecompiledHeader_generate_rules,pchtarget,linktarget,linktargetmakefilename,pchcxxfile)
 define gb_PrecompiledHeader_generate_rules
 
 $(call gb_PrecompiledHeader_get_dep_target,$(1),$(3)) :
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)) \
diff --git a/solenv/qa/python/gbuildtojson.py b/solenv/qa/python/gbuildtojson.py
index 6d93b6ff2369..a9888690af77 100644
--- a/solenv/qa/python/gbuildtojson.py
+++ b/solenv/qa/python/gbuildtojson.py
@@ -117,6 +117,7 @@ class CheckGbuildToJsonModules(unittest.TestCase):
         shutil.copyfile(os.path.join(self.srcdirnative, 'RepositoryFixes.mk'), os.path.join(self.tempsrc, 'RepositoryFixes.mk'))
         #print('copytree from _%s_ to _%s_' % (os.path.join(self.srcdirnative, 'solenv').replace('\\', '#').replace('/', '!'), os.path.join(self.tempsrc, 'solenv').replace('\\', '#').replace('/', '!')))
         shutil.copytree(os.path.join(self.srcdirnative, 'solenv'),  os.path.join(self.tempsrc, 'solenv'))
+        shutil.copytree(os.path.join(self.srcdirnative, 'pch'),  os.path.join(self.tempsrc, 'pch'))
 
     def tearDown(self):
         shutil.rmtree(self.tempsrc)


More information about the Libreoffice-commits mailing list