[Libreoffice-commits] core.git: config_host.mk.in configure.ac external/skia solenv/gbuild

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 20 09:16:37 UTC 2020


 config_host.mk.in                         |    2 +
 configure.ac                              |   41 ++++++++++++++++++++++++++++++
 external/skia/Library_skia.mk             |    3 +-
 external/skia/UnpackedTarball_skia.mk     |    2 -
 external/skia/fix-sse.patch.1             |   23 ++++++++++++++++
 external/skia/msvc-vectorcall-sse.patch.1 |   25 ------------------
 solenv/gbuild/CppunitTest.mk              |    2 +
 solenv/gbuild/Executable.mk               |    2 +
 solenv/gbuild/Library.mk                  |    2 +
 solenv/gbuild/LinkTarget.mk               |   32 +++++++++++++++++++----
 solenv/gbuild/PrecompiledHeaders.mk       |    4 +-
 solenv/gbuild/StaticLibrary.mk            |    2 +
 solenv/gbuild/platform/com_GCC_class.mk   |   13 +++++++--
 solenv/gbuild/platform/com_MSC_class.mk   |   14 +++++-----
 14 files changed, 123 insertions(+), 44 deletions(-)

New commits:
commit 647499ef8151d9383983f89230a970edcb44b5bb
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Apr 17 11:34:25 2020 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Apr 20 11:16:01 2020 +0200

    prefer building Skia with Clang if possible (tdf#131697)
    
    I.e. try to find and use Clang even if the default compiler is
    something else. Skia is optimized to be built with Clang(-cl)
    and in CPU-based raster mode some operations are several times
    slower if built with something else (e.g. fmax/fmin do not get
    optimized to inline assembly).
    It is enough to select Clang to be installed in the MSVS installer.
    At this point it unclear how to handle release binaries, if it
    should work this way and enforced, or maybe Clang could be used
    for building everything, or maybe some other way.
    
    Change-Id: I6b95a0f2d5cbf176942d9e01136990b14be6dba8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92415
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/config_host.mk.in b/config_host.mk.in
index 5abb2405a3f3..d5b68a7a1851 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -65,6 +65,8 @@ export CCACHE_DEPEND_MODE=@CCACHE_DEPEND_MODE@
 export CDR_CFLAGS=$(gb_SPACE)@CDR_CFLAGS@
 export CDR_LIBS=$(gb_SPACE)@CDR_LIBS@
 @x_CFLAGS@ export CFLAGS=@CFLAGS@
+export CLANG_C=@CLANG_C@
+export CLANG_CXX=@CLANG_CXX@
 export CLANGDIR=@CLANGDIR@
 export CLANGLIBDIR=@CLANGLIBDIR@
 export CLANGSYSINCLUDE=@CLANGSYSINCLUDE@
diff --git a/configure.ac b/configure.ac
index b5cde04404d5..2c4a018b0dd8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11107,6 +11107,47 @@ else
 fi
 AC_SUBST(ENABLE_SKIA)
 
+if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
+    if test -n "$CLANG_C" -a -n "$CLANG_CXX"; then
+        AC_MSG_CHECKING([for Clang])
+        AC_MSG_RESULT([$CLANG_C / $CLANG_CXX])
+    else
+        if test "$_os" = "WINNT"; then
+            AC_MSG_CHECKING([for clang-cl])
+            if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
+                CLANG_C=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
+                if test "$BITNESS_OVERRIDE" = ""; then
+                    dnl match our MSVC default
+                    CLANG_C="$CLANG_C -arch:SSE"
+                fi
+                CLANG_CXX="$CLANG_C"
+                AC_MSG_RESULT([$CLANG_C])
+            else
+                AC_MSG_RESULT([no])
+            fi
+        else
+            AC_CHECK_PROG(CLANG_C,clang,clang,[])
+            AC_CHECK_PROG(CLANG_CXX,clang++,clang++,[])
+        fi
+    fi
+    if test -n "$CLANG_C" -a -n "$CLANG_CXX"; then
+        clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CLANG_C -E - | tail -1 | sed 's/ //g'`
+        clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
+        if test "$clang2_ver" -lt 50002; then
+            AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
+            CLANG_C=
+            CLANG_CXX=
+        fi
+    fi
+    if test -z "$CLANG_C" -o -z "$CLANG_CXX"; then
+        # So far do not require this, but release builds with Skia should possibly
+        # do so.
+        AC_MSG_WARN([Clang compiler not found.])
+    fi
+fi
+AC_SUBST(CLANG_C)
+AC_SUBST(CLANG_CXX)
+
 SYSTEM_GPGMEPP=
 
 if test "$build_for_ios" = "YES"; then
diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index 747556f2b0e6..bc653786bf4b 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -13,7 +13,8 @@ $(eval $(call gb_Library_set_warnings_disabled,skia))
 
 $(eval $(call gb_Library_use_unpacked,skia,skia))
 
-$(eval $(call gb_Library_set_precompiled_header,skia,external/skia/inc/pch/precompiled_skia))
+$(eval $(call gb_Library_use_clang,skia))
+$(eval $(call gb_Library_set_clang_precompiled_header,skia,external/skia/inc/pch/precompiled_skia))
 
 $(eval $(call gb_Library_add_defs,skia,\
     -DSKIA_IMPLEMENTATION=1 \
diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk
index 82fdbc433ece..e0841e432daa 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -23,7 +23,7 @@ skia_patches := \
     Wdeprecated-copy-dtor.patch.0 \
     fix-msvc.patch.1 \
     fix-gcc-x86.patch.1	\
-    msvc-vectorcall-sse.patch.1 \
+    fix-sse.patch.1 \
     clang11-flax-vector-conversion.patch.0 \
     clang-attributes-warning.patch.1 \
     fontconfig-get-typeface.patch.0 \
diff --git a/external/skia/fix-sse.patch.1 b/external/skia/fix-sse.patch.1
new file mode 100644
index 000000000000..8a731725e488
--- /dev/null
+++ b/external/skia/fix-sse.patch.1
@@ -0,0 +1,23 @@
+--- a/src/opts/SkRasterPipeline_opts.h
++++ b/src/opts/SkRasterPipeline_opts.h
+@@ -1047,7 +1047,7 @@ static const size_t N = sizeof(F) / sizeof(float);
+     // TODO: crashes during compilation  :(
+     #define ABI __attribute__((sysv_abi))
+     #define JUMPER_NARROW_STAGES 0
+-#elif defined(_MSC_VER)
++#elif defined(_MSC_VER) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
+     // Even if not vectorized, this lets us pass {r,g,b,a} as registers,
+     // instead of {b,a} on the stack.  Narrow stages work best for __vectorcall.
+     #define ABI __vectorcall
+--- a/include/private/SkVx.h
++++ b/include/private/SkVx.h
+@@ -515,9 +515,6 @@ static inline Vec<N,uint8_t> approx_scale(const Vec<N,uint8_t>& x, const Vec<N,u
+         static inline Vec<4,float> rcp(const Vec<4,float>& x) {
+             return bit_pun<Vec<4,float>>(_mm_rcp_ps(bit_pun<__m128>(x)));
+         }
+-        static inline Vec<4,int> lrint(const Vec<4,float>& x) {
+-            return bit_pun<Vec<4,int>>(_mm_cvtps_epi32(bit_pun<__m128>(x)));
+-        }
+ 
+         static inline Vec<2,float>  sqrt(const Vec<2,float>& x) {
+             return shuffle<0,1>( sqrt(shuffle<0,1,0,1>(x)));
diff --git a/external/skia/msvc-vectorcall-sse.patch.1 b/external/skia/msvc-vectorcall-sse.patch.1
deleted file mode 100644
index f06dca41cff3..000000000000
--- a/external/skia/msvc-vectorcall-sse.patch.1
+++ /dev/null
@@ -1,25 +0,0 @@
-From 9a75d6249ed5c5eff36d70db2a9b87000437fc09 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak at centrum.cz>
-Date: Mon, 13 Jan 2020 14:34:12 +0100
-Subject: [PATCH] MSVC's __vectorcall does not work with /arch:SSE
-
----
- src/opts/SkRasterPipeline_opts.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
-index 692530828f..7f2b473d82 100644
---- a/src/opts/SkRasterPipeline_opts.h
-+++ b/src/opts/SkRasterPipeline_opts.h
-@@ -1047,7 +1047,7 @@ static const size_t N = sizeof(F) / sizeof(float);
-     // TODO: crashes during compilation  :(
-     #define ABI __attribute__((sysv_abi))
-     #define JUMPER_NARROW_STAGES 0
--#elif defined(_MSC_VER)
-+#elif defined(_MSC_VER) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
-     // Even if not vectorized, this lets us pass {r,g,b,a} as registers,
-     // instead of {b,a} on the stack.  Narrow stages work best for __vectorcall.
-     #define ABI __vectorcall
--- 
-2.16.4
-
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 602dba107947..d90a2c89311c 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -480,5 +480,7 @@ gb_CppunitTest_set_warnings_not_errors = $(call gb_CppunitTest__forward_to_Linkt
 gb_CppunitTest_set_warnings_disabled = $(call gb_CppunitTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_CppunitTest_set_external_code = $(call gb_CppunitTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_CppunitTest_set_generated_cxx_suffix = $(call gb_CppunitTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_CppunitTest_use_clang = $(call gb_CppunitTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_CppunitTest_set_clang_precompiled_header = $(call gb_CppunitTest__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 
 # vim: set noet sw=4:
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index c782cd871856..66b44e156904 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -150,6 +150,8 @@ gb_Executable_set_warnings_not_errors = $(call gb_Executable__forward_to_Linktar
 gb_Executable_set_warnings_disabled = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_Executable_set_external_code = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_Executable_set_generated_cxx_suffix = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_Executable_use_clang = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_Executable_set_clang_precompiled_header = $(call gb_Executable__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 
 # Run-time use
 
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 932ceefcd3cd..1973249f5db4 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -236,5 +236,7 @@ gb_Library_set_warnings_not_errors = $(call gb_Library__forward_to_Linktarget,$(
 gb_Library_set_warnings_disabled = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_Library_set_external_code = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_Library_set_generated_cxx_suffix = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_Library_use_clang = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_Library_set_clang_precompiled_header = $(call gb_Library__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 
 # vim: set noet sw=4:
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 1702e881e1c0..0cb81a0a1daa 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -240,7 +240,7 @@ else
 $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%)
 	$(call gb_Output_announce,$*.c,$(true),$(if $(COMPILER_TEST),C? ,C  ),3)
 	$(call gb_Trace_StartRange,$*.c,$(if $(COMPILER_TEST),C? ,C  ))
-	$(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$<,$(call gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS))
+	$(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$<,$(call gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_C))
 	$(call gb_Trace_EndRange,$*.c,$(if $(COMPILER_TEST),C? ,C  ))
 endif
 
@@ -303,7 +303,7 @@ $(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%)
 	$(call gb_Output_announce,$*.cxx,$(true),$(if $(COMPILER_TEST),CPT,CXX),3)
 	$(call gb_Trace_StartRange,$*.cxx,$(if $(COMPILER_TEST),CPT,CXX))
 	$(eval $(gb_CxxObject__set_pchflags))
-	$(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) $(if $(COMPILER_TEST),$(gb_COMPILER_TEST_FLAGS)),$<,$(call gb_CxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS))
+	$(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) $(if $(COMPILER_TEST),$(gb_COMPILER_TEST_FLAGS)),$<,$(call gb_CxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_CXX))
 	$(call gb_Trace_EndRange,$*.cxx,$(if $(COMPILER_TEST),CPT,CXX))
 endif
 
@@ -328,7 +328,7 @@ $(call gb_GenCObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
 	$(call gb_Output_announce,$*.c,$(true),C  ,3)
 	$(call gb_Trace_StartRange,$*.c,C  )
 	test -f $(call gb_GenCObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenCObject_get_source,$*)" && false)
-	$(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$(call gb_GenCObject_get_source,$*),$(call gb_GenCObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS))
+	$(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$(call gb_GenCObject_get_source,$*),$(call gb_GenCObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_C))
 	$(call gb_Trace_EndRange,$*.c,C  )
 
 ifeq ($(gb_FULLDEPS),$(true))
@@ -353,7 +353,7 @@ $(call gb_GenCxxObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
 	$(call gb_Trace_StartRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
 	test -f $(GEN_CXX_SOURCE) || (echo "Missing generated source file $(GEN_CXX_SOURCE)" && false)
 	$(eval $(gb_CxxObject__set_pchflags))
-	$(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND),$(GEN_CXX_SOURCE),$(call gb_GenCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS))
+	$(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND),$(GEN_CXX_SOURCE),$(call gb_GenCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_SYMBOLS),$(T_CXX))
 	$(call gb_Trace_EndRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
 
 ifeq ($(gb_FULLDEPS),$(true))
@@ -836,6 +836,8 @@ $(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE :=
 $(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT :=
 $(call gb_LinkTarget_get_target,$(1)) : COMPILER_TEST :=
 $(call gb_LinkTarget_get_target,$(1)) : T_SYMBOLS := $(if $(call gb_LinkTarget__symbols_enabled,$(2)),$(true),$(false))
+$(call gb_LinkTarget_get_target,$(1)) : T_C :=
+$(call gb_LinkTarget_get_target,$(1)) : T_CXX :=
 
 ifeq ($(gb_FULLDEPS),$(true))
 ifeq (depcache:,$(filter depcache,$(.FEATURES)):$(gb_PARTIAL_BUILD))
@@ -1609,11 +1611,12 @@ $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $$(PCHOBJEX)
 
 endef
 
-# call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
+# 'compiler' set comes only from gb_LinkTarget_set_clang_precompiled_header
+# call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename,compiler
 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),$(2))
+$(call gb_PrecompiledHeader_generate_rules,$(notdir $(2)),$(1),$(4),$(2),$(5))
 endif
 ifneq ($(gb_ENABLE_PCH)$(BLOCK_PCH),)
 $(call gb_LinkTarget__add_precompiled_header_object,$(1),$(2),$(notdir $(2)),$(4))
@@ -1621,6 +1624,14 @@ endif
 
 endef
 
+# It seems complicated to forward the clang setting to the PCH rules, so use an extra
+# function to set it manually. This variant should be used if gb_LinkTarget_use_clang is used.
+# call gb_LinkTarget_set_clang_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
+define gb_LinkTarget_set_clang_precompiled_header
+$(call gb_LinkTarget_set_precompiled_header,$(1),$(2),$(3),$(4),$(CLANG_CXX))
+
+endef
+
 # call gb_LinkTarget__reuse_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
 # Use the PCH as if it was LinkTarget's own, but do nothing with the PCH itself, just depend on it.
 define gb_LinkTarget__reuse_precompiled_header_impl
@@ -1773,4 +1784,13 @@ gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1))
 
 endef
 
+# C/C++ files will be build with Clang (if possible) instead of the default compiler.
+# call gb_LinkTarget_use_clang,linktarget,,linktargetmakefilename
+define gb_LinkTarget_use_clang
+$(call gb_LinkTarget_get_target,$(1)) : T_C := $(CLANG_C)
+$(call gb_LinkTarget_get_target,$(1)) : T_CXX := $(CLANG_CXX)
+
+endef
+
+
 # vim: set noet sw=4:
diff --git a/solenv/gbuild/PrecompiledHeaders.mk b/solenv/gbuild/PrecompiledHeaders.mk
index 55dcb332312d..0a07d6588436 100644
--- a/solenv/gbuild/PrecompiledHeaders.mk
+++ b/solenv/gbuild/PrecompiledHeaders.mk
@@ -36,7 +36,7 @@ ifneq ($(gb_ENABLE_PCH),)
 # 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,pchcxxfile)
+# $(call gb_PrecompiledHeader_generate_rules,pchtarget,linktarget,linktargetmakefilename,pchcxxfile,compiler)
 define gb_PrecompiledHeader_generate_rules
 
 $(call gb_PrecompiledHeader_get_dep_target,$(1),$(3)) :
@@ -50,7 +50,7 @@ $(call gb_PrecompiledHeader_get_target,$(1),$(3)) :
 	test "$$(PCH_LINKTARGETMAKEFILENAME)" = "$(3)" \
 		 || ( echo "Error, PCH $(1) built by $$(PCH_LINKTARGETMAKEFILENAME) instead of $(3)" >&2; exit 1)
 	rm -f $$@
-	$$(call gb_PrecompiledHeader__command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(3))
+	$$(call gb_PrecompiledHeader__command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(3),$(5))
 	$$(call gb_PrecompiledHeader__sum_command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(3))
 	echo $$(sort $$(PCH_DEFS) $$(PCH_CXXFLAGS) $$(gb_PrecompiledHeader_EXCEPTIONFLAGS)) > $$(call gb_PrecompiledHeader_get_target,$(1),$(3)).flags
 ifeq ($(gb_FULLDEPS),$(true))
diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk
index 0b372043e375..ca11815b6d49 100644
--- a/solenv/gbuild/StaticLibrary.mk
+++ b/solenv/gbuild/StaticLibrary.mk
@@ -120,5 +120,7 @@ gb_StaticLibrary_set_warnings_not_errors = $(call gb_StaticLibrary__forward_to_L
 gb_StaticLibrary_set_warnings_disabled = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_StaticLibrary_set_external_code = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 gb_StaticLibrary_set_generated_cxx_suffix = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_StaticLibrary_use_clang = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3))
+gb_StaticLibrary_set_clang_precompiled_header = $(call gb_StaticLibrary__forward_to_Linktarget,$(0),$(1),$(2),$(3))
 
 # vim: set noet sw=4:
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index 29de22fe8634..f7e553dd5dc8 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -52,13 +52,20 @@ endef
 
 # CObject class
 
-# $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols)
+# $(call gb_CObject__compiler,source,compiler)
+define gb_CObject__compiler
+	$(if $(filter %.c %.m,$(1)), \
+		$(if $(2), $(2), $(gb_CC)), \
+		$(if $(2), $(2), $(gb_CXX)))
+endef
+
+# $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols,compiler)
 define gb_CObject__command_pattern
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) $(dir $(4)) && cd $(SRCDIR) && \
 	$(gb_COMPILER_SETUP) \
 	$(if $(5),$(gb_COMPILER_PLUGINS_SETUP)) \
-	$(if $(filter %.c %.m,$(3)), $(gb_CC), $(gb_CXX)) \
+	$(call gb_CObject__compiler,$(3),$(7)) \
 		$(DEFS) \
 		$(gb_LTOFLAGS) \
 		$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
@@ -116,7 +123,7 @@ $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(7))) && \
 	cd $(BUILDDIR)/ && \
 	CCACHE_DISABLE=1 $(gb_COMPILER_SETUP) \
-	$(gb_CXX) \
+	$(if $(8),$(8),$(gb_CXX)) \
 		-x c++-header \
 		$(4) $(5) \
 		$(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS)) \
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index f72c2a55f16b..848cb96397e3 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -34,13 +34,15 @@ endef
 
 # CObject class
 
-# $(call gb_CObject__compiler,flags,source)
+# $(call gb_CObject__compiler,flags,source,compiler)
 define gb_CObject__compiler
 	$(if $(filter YES,$(LIBRARY_X64)), $(CXX_X64_BINARY), \
 		$(if $(filter YES,$(PE_X86)), $(CXX_X86_BINARY), \
-			$(if $(filter %.c,$(2)), $(gb_CC), \
+			$(if $(filter %.c,$(2)), \
+				$(if $(3), $(3), $(gb_CC)), \
 				$(if $(filter -clr,$(1)), \
-					$(MSVC_CXX) -I$(SRCDIR)/solenv/clang-cl,$(gb_CXX)))))
+					$(MSVC_CXX) -I$(SRCDIR)/solenv/clang-cl,
+						$(if $(3), $(3), $(gb_CXX))))))
 endef
 
 # Avoid annoying warning D9025 about overriding command-line arguments.
@@ -50,12 +52,12 @@ gb_Helper_remove_overridden_flags = \
     $(lastword $(filter -Od -O2,$(1))) \
     $(lastword $(filter -arch:SSE -arch:SSE2 -arch:AVX -arch:AVX2,$(1)))
 
-# $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols)
+# $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols,compiler)
 define gb_CObject__command_pattern
 $(call gb_Helper_abbreviate_dirs,\
 	mkdir -p $(dir $(1)) $(dir $(4)) && \
 	unset INCLUDE && \
-	$(filter-out -arch:SSE,$(call gb_CObject__compiler,$(2),$(3))) \
+	$(filter-out -arch:SSE,$(call gb_CObject__compiler,$(2),$(3),$(7))) \
 		$(DEFS) \
 		$(gb_LTOFLAGS) \
 		$(call gb_Helper_remove_overridden_flags,$(filter -arch:SSE,$(call gb_CObject__compiler,$(2),$(3))) \
@@ -96,7 +98,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),$(7))) && \
 	unset INCLUDE && \
-	$(filter-out -arch:SSE,$(call gb_CObject__compiler,$(4) $(5),$(3))) \
+	$(filter-out -arch:SSE,$(call gb_CObject__compiler,$(4) $(5),$(3),$(8))) \
 		$(call gb_Helper_remove_overridden_flags,$(filter -arch:SSE,$(call gb_CObject__compiler,$(4) $(5),$(3))) \
 			$(4) $(5) $(if $(WARNINGS_DISABLED),$(gb_CXXFLAGS_DISABLE_WARNINGS))) \
 		-Fd$(PDBFILE) \


More information about the Libreoffice-commits mailing list