git: 75ecc581ae83 - main - science/opensph: port to aarch64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Oct 2024 09:37:13 UTC
The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/ports/commit/?id=75ecc581ae83c4eb358f0f62e7de97b6e85ffc44 commit 75ecc581ae83c4eb358f0f62e7de97b6e85ffc44 Author: Robert Clausecker <fuz@FreeBSD.org> AuthorDate: 2024-10-15 22:07:41 +0000 Commit: Robert Clausecker <fuz@FreeBSD.org> CommitDate: 2024-10-21 09:36:01 +0000 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 --- science/opensph/Makefile | 10 +++++++--- .../patch-core_objects_containers_BasicAllocators.h | 13 +++++++++++++ .../opensph/files/patch-core_objects_geometry_Vector.h | 17 +++++++++++++++++ .../files/patch-core_objects_wrappers_AlignedStorage.h | 13 +++++++++++++ science/opensph/files/patch-core_system_Platform.cpp | 8 ++++---- 5 files changed, 54 insertions(+), 7 deletions(-) diff --git a/science/opensph/Makefile b/science/opensph/Makefile index e6251857ecac..3be2e90bfb20 100644 --- a/science/opensph/Makefile +++ b/science/opensph/Makefile @@ -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 diff --git a/science/opensph/files/patch-core_objects_containers_BasicAllocators.h b/science/opensph/files/patch-core_objects_containers_BasicAllocators.h new file mode 100644 index 000000000000..bb1fc5a255de --- /dev/null +++ b/science/opensph/files/patch-core_objects_containers_BasicAllocators.h @@ -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> diff --git a/science/opensph/files/patch-core_objects_geometry_Vector.h b/science/opensph/files/patch-core_objects_geometry_Vector.h new file mode 100644 index 000000000000..8cb10a70ecec --- /dev/null +++ b/science/opensph/files/patch-core_objects_geometry_Vector.h @@ -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 + diff --git a/science/opensph/files/patch-core_objects_wrappers_AlignedStorage.h b/science/opensph/files/patch-core_objects_wrappers_AlignedStorage.h new file mode 100644 index 000000000000..c07146ada5cc --- /dev/null +++ b/science/opensph/files/patch-core_objects_wrappers_AlignedStorage.h @@ -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> diff --git a/science/opensph/files/patch-core_system_Platform.cpp b/science/opensph/files/patch-core_system_Platform.cpp index 54324cc45a0c..6f25b44906e2 100644 --- a/science/opensph/files/patch-core_system_Platform.cpp +++ b/science/opensph/files/patch-core_system_Platform.cpp @@ -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;