config_host.mk.in | 1 + config_host/config_emscripten.h.in | 2 ++ configure.ac | 16 ++++++++++++++++ solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk | 4 ++++ vcl/qt5/QtInstance.cxx | 3 ++- 5 files changed, 25 insertions(+), 1 deletion(-)
New commits: commit 20c02c4b16b43f627336db10566bd5765faaccfe Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Mon Nov 4 17:46:47 2024 +0100 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Mon Apr 14 12:38:56 2025 +0200 Add experimental support for Emscripten JSPI ...which I've seen fundamentally working when building with recent emsdk against recent Qt6 trunk (and including <https://github.com/qt/qtbase/pull/108> "Update the check for WebAssembly JSPI support") and running on recent Chrome (with JSPI enabled under <chrome://flags/>) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176031 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> (cherry picked from commit f510ce620fba08e6aa8bc40af2e47f0b51caa66d, to avoid > sc/source/filter/oox/workbookfragment.cxx:333:28: error: 'HAVE_EMSCRIPTEN_JSPI' is not defined, evaluates to 0 [-Werror,-Wundef] > 333 | #if defined EMSCRIPTEN && !HAVE_EMSCRIPTEN_JSPI > | ^ after c806d990d88bd6095cffb54ebbd95ea9cf146f33 "Emscripten: Hack to not call Application::Yield when loading xslt") Change-Id: I98c11c5ee7e95b135ddc33c95c95752055ecd4c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184137 Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> Tested-by: allotropia jenkins <jenk...@allotropia.de> diff --git a/config_host.mk.in b/config_host.mk.in index 7ff53fe30b23..617cbca48723 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -167,6 +167,7 @@ export ENABLE_DCONF=@ENABLE_DCONF@ export ENABLE_DEBUG=@ENABLE_DEBUG@ SYSTEM_DRAGONBOX=@SYSTEM_DRAGONBOX@ SYSTEM_FROZEN=@SYSTEM_FROZEN@ +export ENABLE_EMSCRIPTEN_JSPI=@ENABLE_EMSCRIPTEN_JSPI@ export ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS=@ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS@ export ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD=@ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD@ export ENABLE_EPOXY=@ENABLE_EPOXY@ diff --git a/config_host/config_emscripten.h.in b/config_host/config_emscripten.h.in index d8121613a934..c42a43c31e76 100644 --- a/config_host/config_emscripten.h.in +++ b/config_host/config_emscripten.h.in @@ -9,6 +9,8 @@ #pragma once +#define HAVE_EMSCRIPTEN_JSPI 0 + #define HAVE_EMSCRIPTEN_PROXY_POSIX_SOCKETS 0 #define HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD 0 diff --git a/configure.ac b/configure.ac index 4ac5a4fa5c4d..180fd73ee5e3 100644 --- a/configure.ac +++ b/configure.ac @@ -2161,6 +2161,14 @@ AC_ARG_WITH(wasm-module, # Don't include impress by default. Debug builds become too large for Chromium # with 'calc impress writer' enabled. (buffer source exceeds maximum size) +if test "$_os" = Emscripten; then + AC_ARG_ENABLE(emscripten-jspi, + AS_HELP_STRING([--enable-emscripten-jspi], + [Experimentally enable use of the Emscripten -sJSPI feature.])) +else + enable_emscripten_jspi= +fi + if test "$_os" = Emscripten; then AC_ARG_ENABLE(emscripten-proxy-to-pthread, AS_HELP_STRING([--disable-emscripten-proxy-to-pthread], @@ -4157,6 +4165,14 @@ AC_SUBST(ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS) AC_SUBST(ENABLE_WASM_STRIP_CALC) AC_SUBST(ENABLE_WASM_STRIP_ACCESSIBILITY) +if test "$enable_emscripten_jspi" = yes; then + ENABLE_EMSCRIPTEN_JSPI=TRUE + AC_DEFINE(HAVE_EMSCRIPTEN_JSPI) +else + ENABLE_EMSCRIPTEN_JSPI= +fi +AC_SUBST(ENABLE_EMSCRIPTEN_JSPI) + if test "$enable_emscripten_proxy_to_pthread" = yes; then ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD=TRUE AC_DEFINE(HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD) diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk index 16646fac35ee..613cb0b3b219 100644 --- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk +++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk @@ -30,6 +30,10 @@ gb_EMSCRIPTEN_LDFLAGS += -sSTACK_SIZE=131072 -sDEFAULT_PTHREAD_STACK_SIZE=65536 gb_EMSCRIPTEN_LDFLAGS += --bind -s FORCE_FILESYSTEM=1 -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","UTF8ToString","ccall","cwrap","addOnPreMain","addOnPostRun","registerType","throwBindingError","ClassHandle"$(if $(ENABLE_QT6),$(COMMA)"FS"$(COMMA)"callMain"$(COMMA)"specialHTMLTargets")] gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB +ifeq ($(ENABLE_EMSCRIPTEN_JSPI),TRUE) +gb_EMSCRIPTEN_LDFLAGS += -sJSPI +endif + ifeq ($(ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS),TRUE) gb_EMSCRIPTEN_LDFLAGS += -sPROXY_POSIX_SOCKETS -lwebsocket.js endif diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 78a070f8f107..8ac9d2bda4bd 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -48,6 +48,7 @@ #include <vclpluginapi.h> #include <tools/debug.hxx> #include <comphelper/flagguard.hxx> +#include <config_emscripten.h> #include <config_vclplug.h> #include <dndhelper.hxx> #include <vcl/sysdata.hxx> @@ -266,7 +267,7 @@ QtInstance::QtInstance(std::unique_ptr<QApplication>& pQApp) #ifndef EMSCRIPTEN m_bSupportsOpenGL = true; -#else +#elif !HAVE_EMSCRIPTEN_JSPI ImplGetSVData()->maAppData.m_bUseSystemLoop = true; #endif }