Work around uname(2) on Apple mobile OSes not returning the proper arch
Task-number: QTBUG-61205 Change-Id: Ia3e896da908f42939148fffd14c46fc991650f6f Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
parent
acaaa84d7e
commit
d56c6cf7a4
@ -86,6 +86,12 @@
|
||||
# include <sys/systeminfo.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN)
|
||||
# include <mach/machine.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <sys/utsname.h>
|
||||
#include <private/qcore_unix_p.h>
|
||||
@ -2437,6 +2443,20 @@ QString QSysInfo::currentCpuArchitecture()
|
||||
case PROCESSOR_ARCHITECTURE_IA64:
|
||||
return QStringLiteral("ia64");
|
||||
}
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
cpu_type_t type;
|
||||
size_t size = sizeof(type);
|
||||
sysctlbyname("hw.cputype", &type, &size, NULL, 0);
|
||||
switch (type) {
|
||||
case CPU_TYPE_X86:
|
||||
return QStringLiteral("i386");
|
||||
case CPU_TYPE_X86_64:
|
||||
return QStringLiteral("x86_64");
|
||||
case CPU_TYPE_ARM:
|
||||
return QStringLiteral("arm");
|
||||
case CPU_TYPE_ARM64:
|
||||
return QStringLiteral("arm64");
|
||||
}
|
||||
#elif defined(Q_OS_UNIX)
|
||||
long ret = -1;
|
||||
struct utsname u;
|
||||
|
Loading…
x
Reference in New Issue
Block a user