Files
MINGW-packages/mingw-w64-helics/001-aarch64-processor-name.patch
T

83 lines
2.6 KiB
Diff

diff -bur benchmarks-o/helics/helics_benchmark_util.h benchmarks/helics/helics_benchmark_util.h
--- a/benchmarks/helics/helics_benchmark_util.h 2025-04-20 04:56:10.042141600 -0600
+++ b/benchmarks/helics/helics_benchmark_util.h 2025-04-20 05:00:45.004743300 -0600
@@ -18,6 +18,29 @@
#endif
#if defined(_WIN32) || defined(WIN32)
+#ifdef _M_ARM64
+#include <Windows.h>
+inline std::string getCPUModel()
+{
+ #define BUFSIZE 128
+
+ char answer[BUFSIZE] = "";
+ char inBuffer[BUFSIZE] = "";
+ const char *csName = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
+ HKEY hKey;
+ DWORD gotType;
+ DWORD gotSize = BUFSIZ;
+ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, csName, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
+ if (!RegQueryValueExA(hKey, "ProcessorNameString", nullptr, &gotType, (PBYTE)(inBuffer), &gotSize)) {
+ if ((gotType == REG_SZ) && strlen(inBuffer)) {
+ strcpy(answer, inBuffer);
+ }
+ }
+ RegCloseKey(hKey);
+ }
+ return std::string(answer);
+}
+#else
# include <intrin.h>
// code modified from https://weseetips.wordpress.com/tag/c-get-cpu-name/
inline std::string getCPUModel()
@@ -43,6 +66,7 @@
return std::string(CPUBrandString);
}
+#endif // _M_ARM64
#elif defined(__unix__)
# include <cstdlib>
# include <cstring>
diff -bur src-o/helics/core/helicsVersion.cpp src/helics/core/helicsVersion.cpp
--- a/src/helics/core/helicsVersion.cpp 2025-04-20 05:06:45.880215400 -0600
+++ b/src/helics/core/helicsVersion.cpp 2025-04-20 05:07:49.429141100 -0600
@@ -17,6 +17,29 @@
#include <thread>
#if defined(_WIN32) || defined(WIN32)
+#ifdef _M_ARM64
+#include <Windows.h>
+inline std::string getCPUModel()
+{
+ #define BUFSIZE 128
+
+ char answer[BUFSIZE] = "";
+ char inBuffer[BUFSIZE] = "";
+ const char *csName = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
+ HKEY hKey;
+ DWORD gotType;
+ DWORD gotSize = BUFSIZ;
+ if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, csName, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
+ if (!RegQueryValueExA(hKey, "ProcessorNameString", nullptr, &gotType, (PBYTE)(inBuffer), &gotSize)) {
+ if ((gotType == REG_SZ) && strlen(inBuffer)) {
+ strcpy(answer, inBuffer);
+ }
+ }
+ RegCloseKey(hKey);
+ }
+ return std::string(answer);
+}
+#else
# include <intrin.h>
// code modified from https://weseetips.wordpress.com/tag/c-get-cpu-name/
inline std::string getCPUModel()
@@ -42,6 +65,7 @@
return std::string(CPUBrandString);
}
+#endif // _M_ARM64
#elif defined(__unix__)
# include <fstream>
inline std::string getCPUModel()