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 c33e546d32b1a53cd1092f3771e194569293f588
parent 0f77ea17d22f28e80351a5b4985c5948b4f0c6f8
Author: [email protected] <[email protected]>
Date:   Wed,  2 Nov 2022 14:04:01 +0000

Warn about CPU_ARCH

Diffstat:
MCMakeLists.txt | 40+++++++++++++++++++++++++++++++---------
Mtests/CMakeLists.txt | 21++++++++++-----------
2 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -22,6 +22,20 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS ON) +if (CPU_ARCH) + if (NOT KFR_ARCH) + message( + WARNING + "CPU_ARCH is deprecated. Use KFR_ARCH instead. KFR will use machine native architecture by default" + ) + else () + message( + WARNING + "Both KFR_ARCH and CPU_ARCH are defined. KFR will use architecture set by KFR_ARCH (${KFR_ARCH})" + ) + endif () +endif () + if (WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "" @@ -88,7 +102,10 @@ if (KFR_ARCH STREQUAL "detect" AND X86) COMPILE_OUTPUT_VARIABLE COMPILE_OUT RUN_OUTPUT_VARIABLE RUN_OUT) if (COMPILE_RESULT AND RUN_RESULT EQUAL 0) - message(STATUS "Default CPU architecture for KFR is ${RUN_OUT} (set KFR_ARCH to override)") + message( + STATUS + "Default CPU architecture for KFR is ${RUN_OUT} (set KFR_ARCH to override)" + ) set(KFR_ARCH ${RUN_OUT} CACHE STRING "Detected CPU" FORCE) @@ -99,7 +116,10 @@ if (KFR_ARCH STREQUAL "detect" AND X86) message(STATUS RUN_OUT = ${RUN_OUT}) endif () else () - message(STATUS "Default CPU architecture for KFR is ${KFR_ARCH} (set by cmake variable)") + message( + STATUS + "Default CPU architecture for KFR is ${KFR_ARCH} (set by cmake variable)" + ) endif () include(cmake/target_set_arch.cmake) @@ -141,7 +161,8 @@ if (APPLE) endif () if (NOT IOS) if (NOT MSVC OR CLANG) - target_compile_options(kfr INTERFACE "${CLANG_ARG_PREFIX}-mstackrealign") + target_compile_options(kfr + INTERFACE "${CLANG_ARG_PREFIX}-mstackrealign") endif () endif () if (MSVC) @@ -154,7 +175,7 @@ if (KFR_DISABLE_CLANG_EXTENSIONS) endif () if (KFR_STD_COMPLEX) target_compile_definitions(kfr INTERFACE -DKFR_STD_COMPLEX) -endif() +endif () if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(kfr INTERFACE -Wno-ignored-qualifiers -Wno-psabi) endif () @@ -255,13 +276,15 @@ endif () set(kfr_defines) -function(append_defines_from target) +function (append_defines_from target) get_target_property(compile_defs ${target} INTERFACE_COMPILE_DEFINITIONS) if (compile_defs) list(APPEND kfr_defines "${compile_defs}") endif () - set(kfr_defines ${kfr_defines} PARENT_SCOPE) -endfunction() + set(kfr_defines + ${kfr_defines} + PARENT_SCOPE) +endfunction () append_defines_from(kfr) if (KFR_ENABLE_DFT) @@ -297,8 +320,7 @@ install(DIRECTORY include/kfr DESTINATION include) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kfr_config.h DESTINATION include/kfr - RENAME config.h - ) + RENAME config.h) # uninstall target if (NOT TARGET uninstall) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt @@ -16,7 +16,6 @@ cmake_minimum_required(VERSION 3.10) - add_definitions(-DKFR_TESTING=1) add_definitions(-DKFR_SRC_DIR=\"${CMAKE_SOURCE_DIR}\") @@ -106,8 +105,7 @@ set(ALL_TESTS_CPP expression_test.cpp intrinsic_test.cpp io_test.cpp - ${KFR_UNITTEST_SRC} - ) + ${KFR_UNITTEST_SRC}) if (KFR_ENABLE_DFT) list(APPEND ALL_TESTS_CPP dft_test.cpp) @@ -118,7 +116,9 @@ endif () find_package(MPFR) find_package(GMP) -if (MPFR_FOUND AND GMP_FOUND AND KFR_REGENERATE_TESTS) +if (MPFR_FOUND + AND GMP_FOUND + AND KFR_REGENERATE_TESTS) message(STATUS "MPFR is found") add_executable(generate_data generate_data.cpp) target_link_libraries(generate_data kfr) @@ -260,14 +260,13 @@ if (NOT KFR_SKIP_TESTS) endforeach () endif () if (USE_SDE) - add_test(NAME all_tests COMMAND ${SDE} ${SDE_ARCH_${KFR_ARCH}} -chip_check_exe_only - -- ${PROJECT_BINARY_DIR}/bin/all_tests) - add_test(NAME all_tests_on_avx512 COMMAND ${SDE} ${SDE_ARCH_avx512} -chip_check_exe_only - -- ${PROJECT_BINARY_DIR}/bin/all_tests) + add_test(NAME all_tests + COMMAND ${SDE} ${SDE_ARCH_${KFR_ARCH}} -chip_check_exe_only -- + ${PROJECT_BINARY_DIR}/bin/all_tests) + add_test(NAME all_tests_on_avx512 + COMMAND ${SDE} ${SDE_ARCH_avx512} -chip_check_exe_only -- + ${PROJECT_BINARY_DIR}/bin/all_tests) else () add_test(NAME all_tests COMMAND ${PROJECT_BINARY_DIR}/bin/all_tests) endif () endif () - -add_executable(tensor_test tensor_test.cpp unit/base/tensor.cpp) -target_link_libraries(tensor_test kfr use_arch)