Skip to content

Instantly share code, notes, and snippets.

@thomaslmiller
Created July 19, 2018 23:14
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thomaslmiller/b97bc7c7905f6e5fdfb93ee71e2a2fc5 to your computer and use it in GitHub Desktop.
Save thomaslmiller/b97bc7c7905f6e5fdfb93ee71e2a2fc5 to your computer and use it in GitHub Desktop.
Diff for Qt5 dev branch for building Arm64 Windows Desktop Apps
Submodule qtbase 519fcb38a2..705dee9621:
diff --git a/qtbase/mkspecs/common/msvc-desktop.conf b/qtbase/mkspecs/common/msvc-desktop.conf
index b7d2eecc82..755d92149c 100644
--- a/qtbase/mkspecs/common/msvc-desktop.conf
+++ b/qtbase/mkspecs/common/msvc-desktop.conf
@@ -22,6 +22,10 @@ contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += WIN64
QMAKE_COMPILER_DEFINES += _WIN64
}
+contains(QMAKE_TARGET.arch, arm64) {
+ DEFINES += WIN64
+ QMAKE_COMPILER_DEFINES += _WIN64
+}
QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Od
QMAKE_CFLAGS_OPTIMIZE = -O2
diff --git a/qtbase/mkspecs/win32-arm64-msvc2017/qmake.conf b/qtbase/mkspecs/win32-arm64-msvc2017/qmake.conf
new file mode 100644
index 0000000000..a75112cf86
--- /dev/null
+++ b/qtbase/mkspecs/win32-arm64-msvc2017/qmake.conf
@@ -0,0 +1,15 @@
+#
+# qmake configuration for win32-msvc
+#
+# Written for Microsoft C/C++ Optimizing Compiler (all desktop versions)
+#
+
+QMAKE_TARGET.arch = arm64
+QMAKE_MSC_VER = 1910
+
+include(../common/msvc-desktop.conf)
+include(../common/msvc-version.conf)
+
+WINSDK_VER = 10.0
+
+load(qt_config)
diff --git a/qtbase/mkspecs/win32-arm64-msvc2017/qplatformdefs.h b/qtbase/mkspecs/win32-arm64-msvc2017/qplatformdefs.h
new file mode 100644
index 0000000000..de806985cb
--- /dev/null
+++ b/qtbase/mkspecs/win32-arm64-msvc2017/qplatformdefs.h
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+#ifdef UNICODE
+#ifndef _UNICODE
+#define _UNICODE
+#endif
+#endif
+
+// Get Qt defines/settings
+
+#include <QtCore/qglobal.h>
+
+#define _POSIX_
+#include <limits.h>
+#undef _POSIX_
+
+#include <tchar.h>
+#include <io.h>
+#include <direct.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+
+#ifdef QT_LARGEFILE_SUPPORT
+#define QT_STATBUF struct _stati64 // non-ANSI defs
+#define QT_STATBUF4TSTAT struct _stati64 // non-ANSI defs
+#define QT_STAT ::_stati64
+#define QT_FSTAT ::_fstati64
+#else
+#define QT_STATBUF struct _stat // non-ANSI defs
+#define QT_STATBUF4TSTAT struct _stat // non-ANSI defs
+#define QT_STAT ::_stat
+#define QT_FSTAT ::_fstat
+#endif
+#define QT_STAT_REG _S_IFREG
+#define QT_STAT_DIR _S_IFDIR
+#define QT_STAT_MASK _S_IFMT
+#if defined(_S_IFLNK)
+# define QT_STAT_LNK _S_IFLNK
+#else
+# define QT_STAT_LNK 0120000
+#endif
+#define QT_FILENO _fileno
+#define QT_OPEN ::_open
+#define QT_CLOSE ::_close
+#ifdef QT_LARGEFILE_SUPPORT
+#define QT_LSEEK ::_lseeki64
+#define QT_TSTAT ::_tstati64
+#else
+#define QT_LSEEK ::_lseek
+#define QT_TSTAT ::_tstat
+#endif
+#define QT_READ ::_read
+#define QT_WRITE ::_write
+#define QT_ACCESS ::_access
+#define QT_GETCWD ::_getcwd
+#define QT_CHDIR ::_chdir
+#define QT_MKDIR ::_mkdir
+#define QT_RMDIR ::_rmdir
+#define QT_OPEN_LARGEFILE 0
+#define QT_OPEN_RDONLY _O_RDONLY
+#define QT_OPEN_WRONLY _O_WRONLY
+#define QT_OPEN_RDWR _O_RDWR
+#define QT_OPEN_CREAT _O_CREAT
+#define QT_OPEN_TRUNC _O_TRUNC
+#define QT_OPEN_APPEND _O_APPEND
+#if defined(O_TEXT)
+# define QT_OPEN_TEXT _O_TEXT
+# define QT_OPEN_BINARY _O_BINARY
+#endif
+
+#include "../common/c89/qplatformdefs.h"
+
+#ifdef QT_LARGEFILE_SUPPORT
+#undef QT_FSEEK
+#undef QT_FTELL
+#undef QT_OFF_T
+
+#define QT_FSEEK ::_fseeki64
+#define QT_FTELL ::_ftelli64
+#define QT_OFF_T __int64
+#endif
+
+#define QT_SIGNAL_ARGS int
+
+#define QT_VSNPRINTF(buffer, count, format, arg) \
+ vsnprintf_s(buffer, count, count-1, format, arg)
+
+#define QT_SNPRINTF ::_snprintf
+
+# define F_OK 0
+# define X_OK 1
+# define W_OK 2
+# define R_OK 4
+
+typedef int mode_t;
+
+#endif // QPLATFORMDEFS_H
diff --git a/qtbase/qmake/generators/win32/msvc_nmake.cpp b/qtbase/qmake/generators/win32/msvc_nmake.cpp
index a1e3c08a7e..5bb29e195c 100644
--- a/qtbase/qmake/generators/win32/msvc_nmake.cpp
+++ b/qtbase/qmake/generators/win32/msvc_nmake.cpp
@@ -71,18 +71,30 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return MakefileGenerator::writeStubMakefile(t);
#endif
if (!project->isHostBuild()) {
+ const QString msvcVer = project->first("MSVC_VER").toQString();
+ if (msvcVer.isEmpty()) {
+ fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n");
+ return false;
+ }
+
+ bool winrtBuild = false;
+ bool crossPlatformDesktopBuild = false;
+ const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
+ QString arch;
if (project->isActiveConfig(QStringLiteral("winrt"))) {
- QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
+ winrtBuild = true;
+ arch = project->first("VCPROJ_ARCH").toQString().toLower();
+
+ // Only arm64 cross-platform builds need special consideration in the makefile generator.
+ } else if (hostArch.contains("arm64") && msvcVer == QStringLiteral("15.0")) {
+ crossPlatformDesktopBuild = true;
+ arch = QStringLiteral("arm64");
+ }
+
+ if (winrtBuild || crossPlatformDesktopBuild) {
QString compiler;
QString compilerArch;
- const QString msvcVer = project->first("MSVC_VER").toQString();
- if (msvcVer.isEmpty()) {
- fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n");
- return false;
- }
-
if (msvcVer == QStringLiteral("15.0")) {
- const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
if (hostArch.contains("x86_64"))
compiler = QStringLiteral("HostX64/");
else
@@ -93,6 +105,9 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
} else if (arch == QLatin1String("x64")) {
compiler += QStringLiteral("x64");
compilerArch = QStringLiteral("amd64");
+ } else if (hostArch.contains("arm64")) {
+ compiler += QStringLiteral("arm64");
+ compilerArch = QStringLiteral("arm64");
} else {
arch = QStringLiteral("x86");
compiler += QStringLiteral("x86");
@@ -119,11 +134,10 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
const QString targetVer = project->first("WINTARGET_VER").toQString();
- if (targetVer.isEmpty()) {
+ if (targetVer.isEmpty() && winrtBuild) {
fprintf(stderr, "Mkspec does not specify WINTARGET_VER. Cannot continue.\n");
return false;
}
-
#ifdef Q_OS_WIN
QString regKey;
if (msvcVer == QStringLiteral("15.0"))
@@ -184,7 +198,14 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/")
+ crtVersion + QStringLiteral("/Include/WinRT");
- libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store");
+ if (winrtBuild)
+ libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store");
+ else {
+ // We need the atl headers/libs if we're building a desktop project. Included by SPHelper.h
+ incDirs << toolsInstallDir + QStringLiteral("atlmfc/include");
+ libDirs << toolsInstallDir + QStringLiteral("atlmfc/lib/") + compilerArch;
+ libDirs << toolsInstallDir + QStringLiteral("lib/") + arch;
+ }
libDirs << vcInstallDir + QStringLiteral("VC/Auxiliary/VS/lib/") + arch;
diff --git a/qtbase/src/3rdparty/angle/src/common/mathutil.h b/qtbase/src/3rdparty/angle/src/common/mathutil.h
index 3de62aef10..059862daca 100644
--- a/qtbase/src/3rdparty/angle/src/common/mathutil.h
+++ b/qtbase/src/3rdparty/angle/src/common/mathutil.h
@@ -127,7 +127,7 @@ inline unsigned int unorm(float x)
inline bool supportsSSE2()
{
-#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM)
+#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
static bool checked = false;
static bool supports = false;
diff --git a/qtbase/src/3rdparty/angle/src/common/platform.h b/qtbase/src/3rdparty/angle/src/common/platform.h
index be4cb94987..10855c02e1 100644
--- a/qtbase/src/3rdparty/angle/src/common/platform.h
+++ b/qtbase/src/3rdparty/angle/src/common/platform.h
@@ -87,7 +87,7 @@
# undef far
#endif
-#if !defined(_M_ARM) && !defined(ANGLE_PLATFORM_ANDROID)
+#if !defined(_M_ARM) && !defined(_M_ARM64) && !defined(ANGLE_PLATFORM_ANDROID)
# define ANGLE_USE_SSE
#endif
diff --git a/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h b/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h
index ca7646d817..65b02c2eec 100644
--- a/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h
+++ b/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h
@@ -68,7 +68,7 @@ inline void abort_noreturn() { abort(); }
// disabled.)
// On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
#if defined(_M_X64) || defined(__x86_64__) || \
- defined(__ARMEL__) || defined(__avr32__) || _M_ARM_FP || \
+ defined(__ARMEL__) || defined(__avr32__) || _M_ARM_FP || defined(_M_ARM64) || \
defined(__hppa__) || defined(__ia64__) || \
defined(__mips__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
diff --git a/qtbase/src/corelib/global/qprocessordetection.h b/qtbase/src/corelib/global/qprocessordetection.h
index 9a3dfd776d..f35b92b4b4 100644
--- a/qtbase/src/corelib/global/qprocessordetection.h
+++ b/qtbase/src/corelib/global/qprocessordetection.h
@@ -94,8 +94,8 @@
ARM is bi-endian, detect using __ARMEL__ or __ARMEB__, falling back to
auto-detection implemented below.
*/
-#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__aarch64__) || defined(__ARM64__)
-# if defined(__aarch64__) || defined(__ARM64__)
+#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)
+# if defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
# define Q_PROCESSOR_ARM_64
# define Q_PROCESSOR_WORDSIZE 8
# else
@@ -110,7 +110,8 @@
# elif defined(__ARM64_ARCH_8__) \
|| defined(__aarch64__) \
|| defined(__ARMv8__) \
- || defined(__ARMv8_A__)
+ || defined(__ARMv8_A__) \
+ || defined(_M_ARM64)
# define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \
@@ -148,7 +149,7 @@
# else
# error "ARM architecture too old"
# endif
-# if defined(__ARMEL__)
+# if defined(__ARMEL__) || defined(_M_ARM64)
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# elif defined(__ARMEB__)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
diff --git a/qtbase/src/gui/opengl/qopenglversionfunctions.h b/qtbase/src/gui/opengl/qopenglversionfunctions.h
index 3af1ed0466..e12156cd7d 100644
--- a/qtbase/src/gui/opengl/qopenglversionfunctions.h
+++ b/qtbase/src/gui/opengl/qopenglversionfunctions.h
@@ -61,6 +61,11 @@
#include <QtCore/qpair.h>
#include <QtGui/qopengl.h>
+// Windows had the smart idea of using a #define MemoryBarrier
+// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684208(v=vs.85).aspx
+#if defined(Q_OS_WIN) && defined(MemoryBarrier)
+#undef MemoryBarrier
+#endif
QT_BEGIN_NAMESPACE
class QOpenGLContext;
Submodule qtscript contains modified content
diff --git a/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp b/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
index 1b2fd1d..e8f78ee 100644
--- a/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
+++ b/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
@@ -601,7 +601,7 @@ static inline void* currentThreadStackBase()
MOV pTib, EAX
}
return static_cast<void*>(pTib->StackBase);
-#elif OS(WINDOWS) && CPU(X86_64) && (COMPILER(MSVC) || COMPILER(GCC))
+#elif OS(WINDOWS) && (CPU(X86_64) || CPU(AARCH64)) && (COMPILER(MSVC) || COMPILER(GCC))
// FIXME: why only for MSVC?
PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb());
return reinterpret_cast<void*>(pTib->StackBase);
diff --git a/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
index 00caa6d..ddbd714 100644
--- a/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
+++ b/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
@@ -252,7 +252,7 @@
#endif
/* CPU(AARCH64) - AArch64 */
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(_M_ARM64)
#define WTF_CPU_AARCH64 1
#if defined(__AARCH64EB__)
#define WTF_CPU_BIG_ENDIAN 1
Submodule qttools contains modified content
diff --git a/qttools/src/shared/winutils/utils.cpp b/qttools/src/shared/winutils/utils.cpp
index 8f9cc198..4ecac821 100644
--- a/qttools/src/shared/winutils/utils.cpp
+++ b/qttools/src/shared/winutils/utils.cpp
@@ -840,7 +840,7 @@ inline void determineDebugAndDependentLibs(const ImageNtHeader *nth, const void
// and debug flags.
bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage,
QStringList *dependentLibrariesIn, unsigned *wordSizeIn,
- bool *isDebugIn, bool isMinGW)
+ bool *isDebugIn, bool isMinGW, unsigned *machineArchIn)
{
bool result = false;
HANDLE hFile = NULL;
@@ -889,6 +889,9 @@ bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage
determineDebugAndDependentLibs(reinterpret_cast<const IMAGE_NT_HEADERS64 *>(ntHeaders),
fileMemory, isMinGW, dependentLibrariesIn, isDebugIn, errorMessage);
}
+
+ if (machineArchIn)
+ *machineArchIn = (unsigned) ntHeaders->FileHeader.Machine;
result = true;
if (optVerboseLevel > 1) {
@@ -921,7 +924,7 @@ bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage
return result;
}
-QString findD3dCompiler(Platform platform, const QString &qtBinDir, unsigned wordSize)
+QString findD3dCompiler(Platform platform, const QString &qtBinDir, unsigned machineArch)
{
const QString prefix = QStringLiteral("D3Dcompiler_");
const QString suffix = QLatin1String(windowsSharedLibrarySuffix);
@@ -929,10 +932,9 @@ QString findD3dCompiler(Platform platform, const QString &qtBinDir, unsigned wor
const QString kitDir = QString::fromLocal8Bit(qgetenv("WindowsSdkDir"));
if (!kitDir.isEmpty()) {
QString redistDirPath = QDir::cleanPath(kitDir) + QStringLiteral("/Redist/D3D/");
- if (platform & ArmBased) {
- redistDirPath += QStringLiteral("arm");
- } else {
- redistDirPath += wordSize == 32 ? QStringLiteral("x86") : QStringLiteral("x64");
+ if (!appendArchSuffix(redistDirPath, machineArch)) {
+ std::wcerr << "Unsupported Windows architecture.\n";
+ return QString();
}
QDir redistDir(redistDirPath);
if (redistDir.exists()) {
@@ -954,12 +956,12 @@ QString findD3dCompiler(Platform platform, const QString &qtBinDir, unsigned wor
// Find the latest D3D compiler DLL in path (Windows 8.1 has d3dcompiler_47).
if (platform & IntelBased) {
QString errorMessage;
- unsigned detectedWordSize;
+ unsigned detectedMachineArch;
for (const QString &candidate : qAsConst(candidateVersions)) {
const QString dll = findInPath(candidate);
if (!dll.isEmpty()
- && readPeExecutable(dll, &errorMessage, 0, &detectedWordSize, 0)
- && detectedWordSize == wordSize) {
+ && readPeExecutable(dll, &errorMessage, 0, 0, 0, 0, &detectedMachineArch)
+ && detectedMachineArch == machineArch) {
return dll;
}
}
@@ -1032,4 +1034,25 @@ bool patchQtCore(const QString &path, QString *errorMessage)
return true;
}
+inline bool appendArchSuffix (QString &path, unsigned machineArch)
+{
+ switch (machineArch)
+ {
+ case IMAGE_FILE_MACHINE_I386:
+ path += QStringLiteral("x86");
+ return true;
+ case IMAGE_FILE_MACHINE_ARM:
+ path += QStringLiteral("arm");
+ return true;
+ case IMAGE_FILE_MACHINE_AMD64:
+ path += QStringLiteral("x64");
+ return true;
+ case IMAGE_FILE_MACHINE_ARM64:
+ path += QStringLiteral("arm64");
+ return true;
+ default:
+ return false;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/qttools/src/shared/winutils/utils.h b/qttools/src/shared/winutils/utils.h
index a5e6f01f..2d4bbb05 100644
--- a/qttools/src/shared/winutils/utils.h
+++ b/qttools/src/shared/winutils/utils.h
@@ -185,20 +185,21 @@ bool runElevatedBackgroundProcess(const QString &binary, const QStringList &args
bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage,
QStringList *dependentLibraries = 0, unsigned *wordSize = 0,
- bool *isDebug = 0, bool isMinGW = false);
+ bool *isDebug = 0, bool isMinGW = false, unsigned *machineArch = 0);
bool readElfExecutable(const QString &elfExecutableFileName, QString *errorMessage,
QStringList *dependentLibraries = 0, unsigned *wordSize = 0,
bool *isDebug = 0);
inline bool readExecutable(const QString &executableFileName, Platform platform,
QString *errorMessage, QStringList *dependentLibraries = 0,
- unsigned *wordSize = 0, bool *isDebug = 0)
+ unsigned *wordSize = 0, bool *isDebug = 0, unsigned *machineArch = 0)
{
return platform == Unix ?
readElfExecutable(executableFileName, errorMessage, dependentLibraries, wordSize, isDebug) :
readPeExecutable(executableFileName, errorMessage, dependentLibraries, wordSize, isDebug,
- (platform == WindowsDesktopMinGW));
+ (platform == WindowsDesktopMinGW), machineArch);
}
+inline bool appendArchSuffix (QString &path, unsigned machineArch);
// Return dependent modules of executable files.
diff --git a/qttools/src/windeployqt/main.cpp b/qttools/src/windeployqt/main.cpp
index efffc5d0..fad0d57a 100644
--- a/qttools/src/windeployqt/main.cpp
+++ b/qttools/src/windeployqt/main.cpp
@@ -680,13 +680,13 @@ static inline bool isQtModule(const QString &libName)
// Helper for recursively finding all dependent Qt libraries.
static bool findDependentQtLibraries(const QString &qtBinDir, const QString &binary, Platform platform,
QString *errorMessage, QStringList *result,
- unsigned *wordSize = 0, bool *isDebug = 0,
+ unsigned *wordSize = 0, bool *isDebug = 0, unsigned *machineArch = 0,
int *directDependencyCount = 0, int recursionDepth = 0)
{
QStringList dependentLibs;
if (directDependencyCount)
*directDependencyCount = 0;
- if (!readExecutable(binary, platform, errorMessage, &dependentLibs, wordSize, isDebug)) {
+ if (!readExecutable(binary, platform, errorMessage, &dependentLibs, wordSize, isDebug, machineArch)) {
errorMessage->prepend(QLatin1String("Unable to find dependent libraries of ") +
QDir::toNativeSeparators(binary) + QLatin1String(" :"));
return false;
@@ -706,7 +706,7 @@ static bool findDependentQtLibraries(const QString &qtBinDir, const QString &bin
*directDependencyCount = end - start;
// Recurse
for (int i = start; i < end; ++i)
- if (!findDependentQtLibraries(qtBinDir, result->at(i), platform, errorMessage, result, 0, 0, 0, recursionDepth + 1))
+ if (!findDependentQtLibraries(qtBinDir, result->at(i), platform, errorMessage, result, 0, 0, 0, 0, recursionDepth + 1))
return false;
return true;
}
@@ -1108,10 +1108,14 @@ static QStringList compilerRunTimeLibs(Platform platform, bool isDebug, unsigned
break;
QStringList redistFiles;
QDir vcRedistDir(vcRedistDirName);
- const QString wordSizeString(QLatin1String(wordSize > 32 ? "x64" : "x86"));
+ QString machineArchString = QStringLiteral("");
+ if (!appendArchSuffix(machineArchString, machineArch)) {
+ std::wcerr << "Unsupported Windows architecture.\n";
+ break;
+ }
if (isDebug) {
// Append DLLs from Debug_NonRedist\x??\Microsoft.VC<version>.DebugCRT.
- if (vcRedistDir.cd(vcDebugRedistDir()) && vcRedistDir.cd(wordSizeString)) {
+ if (vcRedistDir.cd(vcDebugRedistDir()) && vcRedistDir.cd(machineArchString)) {
const QStringList names = vcRedistDir.entryList(QStringList(QStringLiteral("Microsoft.VC*.DebugCRT")), QDir::Dirs);
if (!names.isEmpty() && vcRedistDir.cd(names.first())) {
const QFileInfoList &dlls = vcRedistDir.entryInfoList(QStringList(QLatin1String("*.dll")));
@@ -1125,10 +1129,10 @@ static QStringList compilerRunTimeLibs(Platform platform, bool isDebug, unsigned
if (!countryCodes.isEmpty()) // Pre MSVC2017
releaseRedistDir += QLatin1Char('/') + countryCodes.constFirst();
QFileInfo fi(releaseRedistDir + QLatin1Char('/') + QStringLiteral("vc_redist.")
- + wordSizeString + QStringLiteral(".exe"));
+ + machineArchString + QStringLiteral(".exe"));
if (!fi.isFile()) { // Pre MSVC2017/15.5
fi.setFile(releaseRedistDir + QLatin1Char('/') + QStringLiteral("vcredist_")
- + wordSizeString + QStringLiteral(".exe"));
+ + machineArchString + QStringLiteral(".exe"));
}
if (fi.isFile())
redistFiles.append(fi.absoluteFilePath());
@@ -1219,14 +1223,15 @@ static DeployResult deploy(const Options &options,
QStringList dependentQtLibs;
bool detectedDebug;
unsigned wordSize;
+ unsigned machineArch;
int directDependencyCount = 0;
if (!findDependentQtLibraries(libraryLocation, options.binaries.first(), options.platform, errorMessage, &dependentQtLibs, &wordSize,
- &detectedDebug, &directDependencyCount)) {
+ &detectedDebug, &machineArch, &directDependencyCount)) {
return result;
}
for (int b = 1; b < options.binaries.size(); ++b) {
if (!findDependentQtLibraries(libraryLocation, options.binaries.at(b), options.platform, errorMessage, &dependentQtLibs,
- nullptr, nullptr, nullptr)) {
+ Q_NULLPTR, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR)) {
return result;
}
}
@@ -1316,7 +1321,7 @@ static DeployResult deploy(const Options &options,
qmlScanResult.append(scanResult);
// Additional dependencies of QML plugins.
for (const QString &plugin : qAsConst(qmlScanResult.plugins)) {
- if (!findDependentQtLibraries(libraryLocation, plugin, options.platform, errorMessage, &dependentQtLibs, &wordSize, &detectedDebug))
+ if (!findDependentQtLibraries(libraryLocation, plugin, options.platform, errorMessage, &dependentQtLibs, &wordSize, &detectedDebug, &machineArch))
return result;
}
if (optVerboseLevel >= 1) {
@@ -1411,7 +1416,7 @@ static DeployResult deploy(const Options &options,
}
// Find the system D3d Compiler matching the D3D library.
if (options.systemD3dCompiler && !options.isWinRt()) {
- const QString d3dCompiler = findD3dCompiler(options.platform, qtBinDir, wordSize);
+ const QString d3dCompiler = findD3dCompiler(options.platform, qtBinDir, machineArch);
if (d3dCompiler.isEmpty()) {
std::wcerr << "Warning: Cannot find any version of the d3dcompiler DLL.\n";
} else {
@@ -1459,7 +1464,7 @@ static DeployResult deploy(const Options &options,
options.directory : options.libraryDirectory;
QStringList libraries = deployedQtLibraries;
if (options.compilerRunTime)
- libraries.append(compilerRunTimeLibs(options.platform, isDebug, wordSize));
+ libraries.append(compilerRunTimeLibs(options.platform, isDebug, machineArch));
for (const QString &qtLib : qAsConst(libraries)) {
if (!updateLibrary(qtLib, targetPath, options, errorMessage))
return result;
Submodule qtxmlpatterns contains modified content
diff --git a/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro b/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro
index eae2ea8..9947122 100644
--- a/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro
+++ b/qtxmlpatterns/src/xmlpatterns/xmlpatterns.pro
@@ -3,7 +3,7 @@ CONFIG += exceptions
QT = core-private network
DEFINES += QT_NO_USING_NAMESPACE QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST
-win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
+msvc:equals(QT_ARCH, i386):QMAKE_LFLAGS += /BASE:0x61000000
QMAKE_DOCS = $$PWD/doc/qtxmlpatterns.qdocconf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment