1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

science/opensph: port to aarch64

- use sse2neon to build this port on aarch64
 - armv7 might work too, but I can't test it due to dependent ports not
   building right now

Approved by:	yuri (maintainer)
Differential Revision:	https://reviews.freebsd.org/D47140
This commit is contained in:
Robert Clausecker 2024-10-16 00:07:41 +02:00
parent dfeab5d385
commit 75ecc581ae
5 changed files with 54 additions and 7 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= OpenSPH
DISTVERSION= 0.4.1
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= science
MAINTAINER= yuri@FreeBSD.org
@ -10,9 +10,11 @@ WWW= https://gitlab.com/sevecekp/sph
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
ONLY_FOR_ARCHS= amd64 i386
ONLY_FOR_ARCHS= aarch64 amd64 i386
ONLY_FOR_ARCHS_REASON= unconditional use of -msse4.1 and inclusion of immintrin.h
BUILD_DEPENDS_aarch64= ${LOCALBASE}/include/sse2neon.h:devel/sse2neon
BUILD_DEPENDS+= ${BUILD_DEPENDS_${ARCH}}
TEST_DEPENDS= catch>0:devel/catch
USES= compiler:c++17-lang qmake qt:5
@ -28,6 +30,8 @@ QMAKE_SOURCE_PATH= ${WRKSRC}/sph.pro
QMAKE_ARGS= CONFIG+=release
CXXFLAGS+= -DSPH_CONFIG_SET
CXXFLAGS_amd64= -msse4.1
CXXFLAGS_i386= -msse4.1
TEST_WRKSRC= ${WRKDIR}/test
@ -63,7 +67,7 @@ VDB_LIB_DEPENDS= libImath.so:math/Imath \
libtbb.so:devel/onetbb
post-patch: # workaround for https://gitlab.com/sevecekp/sph/-/issues/48
@${FIND} ${WRKSRC} -name "*.pro" | ${XARGS} ${REINPLACE_CMD} -e 's|c++14|c++17|'
@${FIND} ${WRKSRC} -name "*.pro" | ${XARGS} ${REINPLACE_CMD} -e 's|c++14|c++17|' -e 's|-msse4.1||'
do-test:
@${REINPLACE_CMD} -e 's|Path(.*|Path("${TEST_WRKSRC}");|' ${WRKSRC}/test/utils/Config.h

View File

@ -0,0 +1,13 @@
--- core/objects/containers/BasicAllocators.h.orig 2024-10-15 17:04:09 UTC
+++ core/objects/containers/BasicAllocators.h
@@ -6,7 +6,9 @@
/// \date 2016-2021
#include "common/Assert.h"
-#ifndef SPH_WIN
+#if defined(__arm__) || defined(__aarch64__)
+#include <sse2neon.h>
+#elif !defined(SPH_WIN)
#include <mm_malloc.h>
#else
#include <malloc.h>

View File

@ -0,0 +1,17 @@
--- core/objects/geometry/Vector.h.orig 2024-10-15 17:00:09 UTC
+++ core/objects/geometry/Vector.h
@@ -9,9 +9,13 @@
#include "objects/containers/Tuple.h"
#include "objects/geometry/Generic.h"
#include "objects/wrappers/Interval.h"
-#include <immintrin.h>
#include <iomanip>
+#if defined(__arm__) || defined(__aarch64__)
+#include <sse2neon.h>
+#else
+#include <immintrin.h>
#include <smmintrin.h>
+#endif
NAMESPACE_SPH_BEGIN

View File

@ -0,0 +1,13 @@
--- core/objects/wrappers/AlignedStorage.h.orig 2024-10-15 17:05:35 UTC
+++ core/objects/wrappers/AlignedStorage.h
@@ -7,7 +7,9 @@
#include "common/Assert.h"
#include "common/Traits.h"
-#ifndef SPH_WIN
+#if defined(__arm__) || defined(__aarch64__)
+#include <sse2neon.h>
+#elif !defined(SPH_WIN)
#include <mm_malloc.h>
#else
#include <malloc.h>

View File

@ -1,6 +1,6 @@
--- core/system/Platform.cpp.orig 2021-04-08 21:23:28 UTC
--- core/system/Platform.cpp.orig 2022-11-16 12:31:25 UTC
+++ core/system/Platform.cpp
@@ -102,14 +106,18 @@ class CpuUsage { (private)
@@ -117,14 +117,18 @@ class CpuUsage { (public)
public:
CpuUsage() {
@ -20,7 +20,7 @@
file = fopen("/proc/cpuinfo", "r");
numProcessors = 0;
while (fgets(line, 128, file) != NULL) {
@@ -117,6 +125,8 @@ class CpuUsage { (private)
@@ -132,6 +136,8 @@ class CpuUsage { (public)
numProcessors++;
}
fclose(file);
@ -29,7 +29,7 @@
}
Optional<Float> getUsage() {
@@ -150,7 +160,7 @@ bool isDebuggerPresent() {
@@ -176,7 +182,7 @@ bool isDebuggerPresent() {
char buf[1024];
bool debuggerPresent = false;