Add wxGetCpuArchitectureName() for finding out CPU architecture

The returned value is OS-dependent and can be something
like: "x86_64", "x86", "arm64".

Closes https://github.com/wxWidgets/wxWidgets/pull/2121
This commit is contained in:
Lauri Nurmi
2020-11-19 01:02:16 +02:00
committed by Vadim Zeitlin
parent 4bd0cd40f4
commit 493cc3571e
4 changed files with 50 additions and 1 deletions

View File

@@ -86,6 +86,10 @@
#include <shellapi.h>
#endif
#ifndef PROCESSOR_ARCHITECTURE_ARM64
#define PROCESSOR_ARCHITECTURE_ARM64 12
#endif
#include <errno.h>
// For wxKillAllChildren
@@ -1269,6 +1273,34 @@ wxWinVersion wxGetWinVersion()
return wxWinVersion_Unknown;
}
wxString wxGetCpuArchitectureName()
{
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
switch (si.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64:
return "x64";
case PROCESSOR_ARCHITECTURE_ARM:
return "ARM";
case PROCESSOR_ARCHITECTURE_ARM64:
return "ARM64";
case PROCESSOR_ARCHITECTURE_IA64:
return "Itanium";
case PROCESSOR_ARCHITECTURE_INTEL:
return "x86";
case PROCESSOR_ARCHITECTURE_UNKNOWN:
default:
return "Unknown";
}
}
// ----------------------------------------------------------------------------
// sleep functions
// ----------------------------------------------------------------------------