kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit f3b74eda3e6e5c9ba4fd09a3fe68a4c17bc891ce
parent 2d1ed775b8b0cc4f6a224266fc80d2c62b951e85
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon, 22 Jan 2024 01:46:22 +0000

cmake: BITNESS64 and cross compilation fix

Diffstat:
MCMakeLists.txt | 24++++++++++++++++++++++++
Mcmake/target_set_arch.cmake | 4++--
Mtests/CMakeLists.txt | 2+-
3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -94,6 +94,14 @@ project( kfr VERSION ${KFR_VERSION} LANGUAGES CXX) + +if (DEBUG_CMAKE) + get_cmake_property(VARS VARIABLES) + list (SORT VARS) + foreach (VAR ${VARS}) + message(STATUS "${VAR}=${${VAR}}") + endforeach() +endif () set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -131,6 +139,12 @@ if (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64") set(X86 TRUE) endif () +if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BITNESS64 TRUE) +else () + set(BITNESS64 FALSE) +endif () + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CLANG 1) @@ -207,6 +221,16 @@ else () set(ALLOWED_ARCHS generic neon neon64) endif () +if (NOT X86) + if (KFR_ARCH IN_LIST DETECT_NAMES) + if (BITNESS64) + set(KFR_ARCH neon64) + else () + set(KFR_ARCH neon) + endif () + endif () +endif () + if (KFR_ARCH IN_LIST DETECT_NAMES) message(STATUS "Detecting ${KFR_ARCH} architecture") try_run( diff --git a/cmake/target_set_arch.cmake b/cmake/target_set_arch.cmake @@ -12,7 +12,7 @@ if (X86) set(ARCH_FLAGS_GNU_avx2 -msse4.2 -mavx2 -mfma) set(ARCH_FLAGS_GNU_avx512 -msse4.2 -mavx2 -mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) + if (BITNESS64) # SSE2 is part of x86_64 set(ARCH_FLAG_MS_SSE2) else() @@ -36,7 +36,7 @@ if (X86) endif() if (CLANG OR NOT MSVC) # Reset previous arch flags - if (CMAKE_SIZEOF_VOID_P EQUAL 8) + if (BITNESS64) target_compile_options(${TARGET} ${MODE} -mno-sse3) else() target_compile_options(${TARGET} ${MODE} -mno-sse) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt @@ -165,7 +165,7 @@ if (KFR_ARCH_TESTS) endif () if (KFR_USE_SDE) - if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + if (BITNESS64) find_program(SDE NAMES "sde64" "sde") else () find_program(SDE NAMES "sde")