forked from qt-creator/qt-creator
Detect "native" host architecture when running in x86 emulation on Windows on ARM
When Creator is run as an x64 executable on a Windows on ARM machine, the auto detection of debuggers and compilers will not work as expected without this patch. Change-Id: I8b0b303b1db097f8cd95bb419c6a21b9a15e1ac8 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
This commit is contained in:
@@ -31,7 +31,23 @@ bool HostOsInfo::m_useOverrideFileNameCaseSensitivity = false;
|
||||
|
||||
OsArch HostOsInfo::hostArchitecture()
|
||||
{
|
||||
static const OsArch arch = osArchFromString(QSysInfo::currentCpuArchitecture());
|
||||
#ifdef Q_OS_WIN
|
||||
// Workaround for Creator running in x86 emulation mode on ARM machines
|
||||
static const OsArch arch = []() {
|
||||
const HANDLE procHandle = GetCurrentProcess();
|
||||
ushort processMachine;
|
||||
ushort nativeMachine;
|
||||
if (IsWow64Process2(procHandle, &processMachine, &nativeMachine)
|
||||
&& nativeMachine == IMAGE_FILE_MACHINE_ARM64) {
|
||||
return OsArchArm64;
|
||||
}
|
||||
|
||||
return osArchFromString(QSysInfo::currentCpuArchitecture());
|
||||
}();
|
||||
#else
|
||||
static const OsArch arch = osArchFromString(QSysInfo::currentCpuArchitecture());
|
||||
#endif
|
||||
|
||||
return arch;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user