diff options
author | Lars Knoll <lars.knoll@qt.io> | 2022-05-10 08:39:42 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2022-05-11 08:23:28 +0200 |
commit | 79f4ba8a59079c040da91e42da4371cd5d742408 (patch) | |
tree | 8fb9cd169a52dc88b8e48bb24fe8fa971500c3dc | |
parent | aab48bc0c50bdbb1bf2b100dd512241082df6f90 (diff) |
Fix compilation of resonance audio on our supported platforms
Disable neon optimizations on QNX. I can't get
those to compile on the platform. Looks like a bug
in the arm_neon.h headers on QNX.
Define M_PI and M_SQRT2 for pffft.c if they aren't defined.
Fix the arm processor detection to be aligned with what we
have in qprocessordetection.h
Change-Id: I6f6ee2190ee6dd9c3a08d86961c39b47dd38f5cd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/3rdparty/pffft/pffft.c | 11 | ||||
-rw-r--r-- | src/3rdparty/resonance-audio/resonance_audio/base/simd_macros.h | 3 | ||||
-rw-r--r-- | src/resonance-audio/CMakeLists.txt | 5 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/3rdparty/pffft/pffft.c b/src/3rdparty/pffft/pffft.c index cf75b3752..e6018e162 100644 --- a/src/3rdparty/pffft/pffft.c +++ b/src/3rdparty/pffft/pffft.c @@ -63,6 +63,13 @@ #include <math.h> #include <assert.h> +#ifndef M_PI +#define M_PI 3.14159265358979323846264338327950288 +#endif +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880168872420969808 +#endif + /* detect compiler flavour */ #if defined(_MSC_VER) # define COMPILER_MSVC @@ -149,7 +156,9 @@ typedef __m128 v4sf; /* ARM NEON support macros */ -#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__arm__) || defined(__aarch64__) || defined(__arm64__)) +#elif !defined(PFFFT_SIMD_DISABLE) && \ + (((defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM)) && defined(__ARM_NEON__)) || \ + defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)) # include <arm_neon.h> typedef float32x4_t v4sf; # define SIMD_SZ 4 diff --git a/src/3rdparty/resonance-audio/resonance_audio/base/simd_macros.h b/src/3rdparty/resonance-audio/resonance_audio/base/simd_macros.h index a573dec72..11ae40bf4 100644 --- a/src/3rdparty/resonance-audio/resonance_audio/base/simd_macros.h +++ b/src/3rdparty/resonance-audio/resonance_audio/base/simd_macros.h @@ -32,7 +32,8 @@ typedef __m128 SimdVector; #define SIMD_RECIPROCAL_SQRT(a) _mm_rsqrt_ps(a) #define SIMD_LOAD_ONE_FLOAT(p) _mm_set1_ps(p) #elif !defined(DISABLE_SIMD) && \ - (defined(__aarch64__) || (defined(__arm__) && defined(__ARM_NEON__))) + (((defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM)) && defined(__ARM_NEON__)) || \ + defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)) // ARM NEON is enabled. #include <arm_neon.h> typedef float32x4_t SimdVector; diff --git a/src/resonance-audio/CMakeLists.txt b/src/resonance-audio/CMakeLists.txt index 81426e9a9..291b136df 100644 --- a/src/resonance-audio/CMakeLists.txt +++ b/src/resonance-audio/CMakeLists.txt @@ -1,3 +1,7 @@ +### SIMD headers (arm_neon.h) are broken on at least QNX/armv7 +if (QNX) + set(NO_SIMD_DEFINES PFFFT_SIMD_DISABLE DISABLE_SIMD) +endif () set(PFFFT_DIR "../3rdparty/pffft/" CACHE PATH "Path to pffft library") set(PFFFT_INCLUDE_DIR ${PFFFT_DIR}) @@ -194,6 +198,7 @@ qt_internal_add_3rdparty_library(BundledResonanceAudio INSTALL DEFINES EIGEN_MPL2_ONLY + ${NO_SIMD_DEFINES} SOURCES ${RA_SOURCES} ${PFFFT_SOURCE} |