aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-09-15 21:48:30 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2016-05-13 13:32:08 +0000
commitb6d3bae80317d854d78b5880d8d46cacd0d1a64e (patch)
tree4ecd01dac33105436efefd123247b02851918a60 /src
parent872a05475721ad771bd347d1526035e6e7479d30 (diff)
QtDeclarative fixes and workarounds for NaClwip/nacl
Make QtDeclarative run on Native Client. Some of these should be looked at more closely at a later point in time, but will do as workarounds from now. Change-Id: Ifddcb45b190c3a80c6137772a05ababb5466ea22 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/double-conversion/utils.h3
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4engine.cpp2
-rw-r--r--src/qml/qml/qqmldirparser.cpp4
-rw-r--r--src/qml/qml/qqmlimport.cpp11
-rw-r--r--src/qml/qml/qqmltypeloader.cpp5
-rw-r--r--src/qml/qml/v8/qv8engine.cpp3
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp5
9 files changed, 42 insertions, 8 deletions
diff --git a/src/3rdparty/double-conversion/utils.h b/src/3rdparty/double-conversion/utils.h
index 53eec64282..a14550c5d5 100644
--- a/src/3rdparty/double-conversion/utils.h
+++ b/src/3rdparty/double-conversion/utils.h
@@ -65,7 +65,8 @@
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
defined(__SH4__) || defined(__alpha__) || \
defined(_MIPS_ARCH_MIPS32R2) || \
- defined(__AARCH64EL__)
+ defined(__AARCH64EL__) || \
+ defined(__pnacl__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
#if defined(_WIN32)
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 273407c19d..90bdbd2b27 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,2 +1,3 @@
TEMPLATE = subdirs
-!contains(QT_CONFIG, no-qml-debug):SUBDIRS += qmltooling
+!nacl:!contains(QT_CONFIG, no-qml-debug):SUBDIRS += qmltooling
+!nacl:SUBDIRS += qmltooling
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index a6e1f47d91..83032c4dc3 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -609,7 +609,15 @@ static inline QString ToLocaleTimeString(double t)
static double getLocalTZA()
{
-#ifndef Q_OS_WIN
+#ifdef Q_OS_WIN
+ TIME_ZONE_INFORMATION tzInfo;
+ GetTimeZoneInformation(&tzInfo);
+ return -tzInfo.Bias * 60.0 * 1000.0;
+#elif defined(Q_OS_NACL_NEWLIB)
+ // ### tzset hidden behind __STRICT_ANSI__
+ qWarning("Not implemented: getLocalTZA()");
+ return 0;
+#else
struct tm t;
time_t curr;
tzset();
@@ -619,10 +627,6 @@ static double getLocalTZA()
gmtime_r(&curr, &t);
time_t globl = mktime(&t);
return (double(locl) - double(globl)) * 1000.0;
-#else
- TIME_ZONE_INFORMATION tzInfo;
- GetTimeZoneInformation(&tzInfo);
- return -tzInfo.Bias * 60.0 * 1000.0;
#endif
}
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 2560f065cf..284a9ea88a 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -113,7 +113,7 @@ QT_WARNING_DISABLE_MSVC(4172) // MSVC 2015: warning C4172: returning address of
quintptr getStackLimit()
{
quintptr stackLimit;
-#if USE(PTHREADS) && !OS(QNX)
+#if USE(PTHREADS) && !OS(QNX) && !defined(Q_OS_NACL)
# if OS(DARWIN)
pthread_t thread_self = pthread_self();
void *stackTop = pthread_get_stackaddr_np(thread_self);
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp
index 57b50733ea..ca3e620996 100644
--- a/src/qml/qml/qqmldirparser.cpp
+++ b/src/qml/qml/qqmldirparser.cpp
@@ -100,6 +100,10 @@ bool QQmlDirParser::parse(const QString &source)
_plugins.clear();
_components.clear();
_scripts.clear();
+#ifdef Q_OS_NACL
+ // ### Work around "only one module identifier" error below
+ _typeNamespace.clear();
+#endif
_designerSupported = false;
quint16 lineNumber = 0;
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index d538199520..10cb377929 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1206,6 +1206,10 @@ bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoader::QmldirConte
}
}
+#ifdef Q_OS_NACL
+ // ### This check triggers on NaCl: lowest_min/highest_min do not
+ // get set to senisble values. Disabling allows loading to continue.
+#else
if (lowest_min > vmin || highest_min < vmin) {
QQmlError error;
error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin));
@@ -1213,6 +1217,7 @@ bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoader::QmldirConte
return false;
}
+#endif
return true;
}
@@ -1565,7 +1570,13 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
// Search order is applicationDirPath(), $QML2_IMPORT_PATH, QLibraryInfo::Qml2ImportsPath
+#ifdef Q_OS_NACL
+ // Hardcode the qml imports to "qml/" relative to the app nexe.
+ // This should perhaps be set via Qml2Imports in qt.conf.
+ QString installImportsPath = QStringLiteral("qml/");
+#else
QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+#endif
addImportPath(installImportsPath);
// env import paths
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 1e671542be..dd6de8f9b3 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -1706,9 +1706,14 @@ Returns a QQmlQmldirData for \a url. The QQmlQmldirData may be cached.
*/
QQmlQmldirData *QQmlTypeLoader::getQmldir(const QUrl &url)
{
+#ifdef Q_OS_NACL
+ // ### NaCl asserts here on urls like "qml/QtQuick.2.1/qmldir",
+ // which are relative urls we want to load over the network.
+#else
Q_ASSERT(!url.isRelative() &&
(QQmlFile::urlToLocalFileOrQrc(url).isEmpty() ||
!QDir::isRelativePath(QQmlFile::urlToLocalFileOrQrc(url))));
+#endif
LockHolder<QQmlTypeLoader> holder(this);
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index dae932e705..0915b8f80b 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -123,11 +123,14 @@ QV8Engine::QV8Engine(QJSEngine* qq)
, m_xmlHttpRequestData(0)
, m_listModelData(0)
{
+
+#ifndef Q_OS_NACL
#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/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index dd6977e42e..836b043c39 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -634,6 +634,11 @@ void QSGRenderContext::initialize(QOpenGLContext *context)
m_brokenIBOs = true;
#endif
+#ifdef Q_OS_NACL
+ // Standard path fails with "glBindBuffer: buffer bound to more than 1 target"
+ m_brokenIBOs = true;
+#endif
+
emit initialized();
}