diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2018-06-04 11:33:45 +0200 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2018-09-05 00:00:00 +0000 |
commit | eb6201b2af725d64e5e92f19a512b1ff23ceba51 (patch) | |
tree | 5ad1717b096f70b90a6ef031de8e5253d64361d8 | |
parent | f5ad1a13e5ce9ce1389ea7731829ea455259a4db (diff) |
WebAssembly for QtDeclarative
This is the squashed diff from wip/webassembly to 5.12.
Done-with: Lorn Potter <lorn.potter@gmail.com>
Change-Id: Ieef34accefef38018a66d3c39bfacb825af4bea6
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r-- | src/plugins/plugins.pro | 2 | ||||
-rw-r--r-- | src/qml/configure.json | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/v8/qv8engine.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgdefaultrendercontext.cpp | 3 | ||||
-rw-r--r-- | tools/tools.pro | 2 |
7 files changed, 20 insertions, 9 deletions
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 0afd71767e..86fdf87650 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs QT_FOR_CONFIG += qml -qtConfig(qml-debug):SUBDIRS += qmltooling +qtConfig(thread):qtConfig(qml-debug):SUBDIRS += qmltooling qtHaveModule(quick):SUBDIRS += scenegraph diff --git a/src/qml/configure.json b/src/qml/configure.json index 481cc553ae..1e3ac65f2a 100644 --- a/src/qml/configure.json +++ b/src/qml/configure.json @@ -32,10 +32,8 @@ "section": "QML", "condition": [ "features.commandlineparser", - "features.localserver", - "features.process", "features.qml-debug", - "features.qml-network", + "features.qml-network && features.localserver", "features.xmlstreamwriter" ], "output": [ "privateFeature" ] @@ -46,7 +44,7 @@ "section": "QML", "condition": [ "features.commandlineparser", - "features.localserver", + "features.qml-network && features.localserver", "features.process", "features.qml-debug" ], diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 1c37894751..035deea980 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1770,8 +1770,14 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) { filePluginPath << QLatin1String("."); // Search order is applicationDirPath(), qrc:/qt-project.org/imports, $QML2_IMPORT_PATH, QLibraryInfo::Qml2ImportsPath +#ifndef Q_OS_WASM + QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); +#else + // Hardcode the qml imports to "qml/" relative to the app exe. + // This should perhaps be set via Qml2Imports in qt.conf. + QString installImportsPath = QStringLiteral("qml/"); +#endif - QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath); addImportPath(installImportsPath); // env import paths diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 739280bbfe..929285d0fa 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1755,10 +1755,14 @@ Returns a QQmlQmldirData for \a url. The QQmlQmldirData may be cached. */ QQmlRefPointer<QQmlQmldirData> QQmlTypeLoader::getQmldir(const QUrl &url) { +#ifndef Q_OS_WASM Q_ASSERT(!url.isRelative() && (QQmlFile::urlToLocalFileOrQrc(url).isEmpty() || !QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url)))); - +#else + // ### wasm asserts on urls like "qml/QtQuick.2.1/qmldir", + // which are relative urls we want to load over the network. +#endif LockHolder<QQmlTypeLoader> holder(this); QQmlQmldirData *qmldirData = m_qmldirCache.value(url); diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 78c9fe822b..d76344b613 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -138,11 +138,13 @@ QV8Engine::QV8Engine(QV4::ExecutionEngine *v4) , m_xmlHttpRequestData(nullptr) #endif { +#ifndef Q_OS_WASM // wasm does not have working simd QTBUG-63924 #ifdef Q_PROCESSOR_X86_32 if (!qCpuHasFeature(SSE2)) { qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer"); } #endif +#endif QML_MEMORY_SCOPE_STRING("QV8Engine::QV8Engine"); qMetaTypeId<QJSValue>(); diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index 22e97a2dc9..73b79c6300 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -325,7 +325,8 @@ bool QSGDefaultRenderContext::separateIndexBuffer() const // lifetime. An attempt to bind a buffer object to the other // target will generate an INVALID_OPERATION error, and the // current binding will remain untouched. - static const bool isWebGL = qGuiApp->platformName().compare(QLatin1String("webgl")) == 0; + static const bool isWebGL = (qGuiApp->platformName().compare(QLatin1String("webgl")) == 0 + || qGuiApp->platformName().compare(QLatin1String("wasm")) == 0); return isWebGL; } diff --git a/tools/tools.pro b/tools/tools.pro index 22544d60d3..3f5f23eb32 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -9,7 +9,7 @@ qtConfig(qml-devtools) { qtConfig(commandlineparser):qtConfig(xmlstreamwriter): SUBDIRS += qmlcachegen } -!android|android_app { +qtConfig(thread):!android|android_app { SUBDIRS += \ qml |