helics: Enable aarch64 builds (#24054)
This commit is contained in:
parent
1c3305a165
commit
89cc3dc3a5
82
mingw-w64-helics/001-aarch64-processor-name.patch
Normal file
82
mingw-w64-helics/001-aarch64-processor-name.patch
Normal file
@ -0,0 +1,82 @@
|
||||
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()
|
||||
@ -1,10 +0,0 @@
|
||||
--- a/src/helics/application_api/helicsTypes.cpp
|
||||
+++ b/src/helics/application_api/helicsTypes.cpp
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <fmt/format.h>
|
||||
+#include <fmt/ranges.h>
|
||||
#include <functional>
|
||||
#include <numeric>
|
||||
#include <regex>
|
||||
@ -4,10 +4,10 @@ _realname=helics
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=3.6.1
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Hierarchical Engine for Large-scale Infrastructure Co-Simulation (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw64' 'ucrt64' 'clang64')
|
||||
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
|
||||
url="https://github.com/GMLC-TDC/HELICS"
|
||||
license=('spdx:BSD-3-Clause')
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-zeromq"
|
||||
@ -17,8 +17,25 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
|
||||
"${MINGW_PACKAGE_PREFIX}-ninja"
|
||||
"${MINGW_PACKAGE_PREFIX}-boost")
|
||||
options=('!strip')
|
||||
source=("https://github.com/GMLC-TDC/HELICS/releases/download/v${pkgver}/HELICS-v${pkgver}-source.tar.gz")
|
||||
sha256sums=('d607c1b47dd5ae32f3076c4aa4aa584d37b6056a9bd049234494698ed95cd70f')
|
||||
source=("https://github.com/GMLC-TDC/HELICS/releases/download/v${pkgver}/HELICS-v${pkgver}-source.tar.gz"
|
||||
"001-aarch64-processor-name.patch")
|
||||
sha256sums=('d607c1b47dd5ae32f3076c4aa4aa584d37b6056a9bd049234494698ed95cd70f'
|
||||
'5853683dc368453155bf690fb9082b98e88da5d854de8f2da8f32830996f0013')
|
||||
|
||||
apply_patch_with_msg() {
|
||||
for _patch in "$@"
|
||||
do
|
||||
msg2 "Applying ${_patch}"
|
||||
patch -Nbp1 -i "${srcdir}/${_patch}"
|
||||
done
|
||||
}
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}"
|
||||
|
||||
apply_patch_with_msg \
|
||||
001-aarch64-processor-name.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
declare -a extra_config
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user