From b597667707ce51c85504940bb6c56de574bdc137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 19:44:45 +0200 Subject: [PATCH 01/22] upgrade to conan 2, update dependencies --- .github/workflows/build_and_test.yml | 11 +- .gitignore | 4 + CMakeLists.txt | 19 +- benchmark/CMakeLists.txt | 10 +- conan.cmake | 916 ------------------ conanfile.txt | 10 + examples/CMakeLists.txt | 9 +- include/dspbb/CMakeLists.txt | 4 +- include/dspbb/Kernels/Numeric.hpp | 4 +- test/Filtering/FIR/Test_Descs.cpp | 5 +- test/Filtering/IIR/Test_BandTransforms.cpp | 5 +- test/Filtering/IIR/Test_Descs.cpp | 2 +- test/Filtering/IIR/Test_Kernels.cpp | 5 +- test/Filtering/IIR/Test_Realizations.cpp | 4 +- test/Filtering/Test_FIR.cpp | 5 +- test/Filtering/Test_IIR.cpp | 5 +- test/Filtering/Test_MeasureFilter.cpp | 6 +- test/Filtering/Test_Polyphase.cpp | 5 +- test/Filtering/Test_Resample.cpp | 19 +- test/Filtering/Test_Windowing.cpp | 5 +- test/Generators/Test_Generators.cpp | 4 +- test/Kernels/Test_Convolution.cpp | 5 +- test/Kernels/Test_Numeric.cpp | 9 +- .../Test_DiscretizationTransforms.cpp | 5 +- test/LTISystems/Test_Systems.cpp | 4 +- test/Math/Test_Convolution.cpp | 4 +- test/Math/Test_EllipticFunctions.cpp | 15 +- test/Math/Test_FFT.cpp | 6 +- test/Math/Test_Functions.cpp | 6 +- test/Math/Test_OverlapAdd.cpp | 5 +- test/Math/Test_Polynomials.cpp | 5 +- test/Math/Test_Rational.cpp | 5 +- test/Math/Test_RootTransforms.cpp | 6 +- test/Math/Test_Solvers.cpp | 6 +- test/Math/Test_Statistics.cpp | 7 +- test/Primitives/Test_Signal.cpp | 4 +- test/Primitives/Test_SignalArithmetic.cpp | 6 +- test/Primitives/Test_SignalView.cpp | 2 +- test/TestUtils.hpp | 7 +- test/Utility/Test_Interval.cpp | 2 +- test/main.cpp | 2 +- 41 files changed, 165 insertions(+), 1003 deletions(-) delete mode 100644 conan.cmake create mode 100644 conanfile.txt diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index a7b6d79..529ce07 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -48,8 +48,15 @@ jobs: - name: Install conan shell: bash + env: + CC: ${{matrix.c_compiler}} + CXX: ${{matrix.cxx_compiler}} run: | pip install conan + conan profile detect --name ci --force + sed -i 's/build_type=.*/build_type=${{ matrix.build_type }}/g' $(conan profile path ci) + echo '[conf]'' >> $(conan profile path ci) + echo 'tools.build:compiler_executables={"cpp": "${{ matrix.cxx_compiler }}", "c": "${{ matrix.c_compiler }}"}' >> $(conan profile path ci) - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -60,7 +67,9 @@ jobs: env: CC: ${{matrix.c_compiler}} CXX: ${{matrix.cxx_compiler}} - run: cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} + run: | + conan install .. --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} + cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} - name: Build working-directory: ${{runner.workspace}}/build diff --git a/.gitignore b/.gitignore index c1457e9..4e704ac 100644 --- a/.gitignore +++ b/.gitignore @@ -252,3 +252,7 @@ _Pvt_Extensions ParameterExtraction/training/saved_networks/ *.asv + +build/ + +CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 15aa482..b545f0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,9 @@ ## DSPBB CMake -project(DSPBB) +cmake_minimum_required(VERSION 3.24.0) -cmake_minimum_required(VERSION 3.15.0) +project(DSPBB) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Cpp flags enable_language(CXX) @@ -52,18 +51,6 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) link_libraries(Threads::Threads) -# Conan library dependencies -include(conan.cmake) -conan_cmake_configure( - REQUIRES - xsimd/8.0.3 - eigen/3.4.0 - catch2/2.13.4 - GENERATORS cmake_find_package -) -conan_cmake_autodetect(conan_settings) -conan_cmake_install(PATH_OR_REFERENCE . BUILD missing SETTINGS ${conan_settings} OUTPUT_QUIET) - # Output directories set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Bin) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 50bc01e..ff8f560 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -11,13 +11,5 @@ target_sources(Benchmark list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/benchmark) list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/benchmark) -conan_cmake_configure( - REQUIRES - celero/2.8.2 - GENERATORS cmake_find_package -) -conan_cmake_install(PATH_OR_REFERENCE . BUILD missing SETTINGS ${conan_settings} OUTPUT_QUIET) - - find_package(Celero REQUIRED) -target_link_libraries(Benchmark celero::celero DSPBB) \ No newline at end of file +target_link_libraries(Benchmark celero DSPBB) \ No newline at end of file diff --git a/conan.cmake b/conan.cmake deleted file mode 100644 index f4c9807..0000000 --- a/conan.cmake +++ /dev/null @@ -1,916 +0,0 @@ -# The MIT License (MIT) - -# Copyright (c) 2018 JFrog - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - - -# This file comes from: https://github.com/conan-io/cmake-conan. Please refer -# to this repository for issues and documentation. - -# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called. -# It will take CMake current settings (os, compiler, compiler version, architecture) -# and translate them to conan settings for installing and retrieving dependencies. - -# It is intended to facilitate developers building projects that have conan dependencies, -# but it is only necessary on the end-user side. It is not necessary to create conan -# packages, in fact it shouldn't be use for that. Check the project documentation. - -# version: 0.18.0-dev - -include(CMakeParseArguments) - -function(_get_msvc_ide_version result) - set(${result} "" PARENT_SCOPE) - if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) - set(${result} 8 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) - set(${result} 9 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) - set(${result} 10 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) - set(${result} 11 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) - set(${result} 12 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910) - set(${result} 14 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920) - set(${result} 15 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930) - set(${result} 16 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940) - set(${result} 17 PARENT_SCOPE) - else() - message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]") - endif() -endfunction() - -macro(_conan_detect_build_type) - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_BUILD_TYPE) - set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE}) - elseif(CMAKE_BUILD_TYPE) - set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - else() - message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") - endif() - - string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER) - if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG") - set(_CONAN_SETTING_BUILD_TYPE "Debug") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE") - set(_CONAN_SETTING_BUILD_TYPE "Release") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO") - set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL") - set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel") - endif() -endmacro() - -macro(_conan_check_system_name) - #handle -s os setting - if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") - #use default conan os setting if CMAKE_SYSTEM_NAME is not defined - set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(CONAN_SYSTEM_NAME Macos) - endif() - if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX") - set(CONAN_SYSTEM_NAME Neutrino) - endif() - set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino) - list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index) - if (${_index} GREATER -1) - #check if the cmake system is a conan supported one - set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME}) - else() - message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}") - endif() - endif() -endmacro() - -macro(_conan_check_language) - get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES) - if (";${_languages};" MATCHES ";CXX;") - set(LANGUAGE CXX) - set(USING_CXX 1) - elseif (";${_languages};" MATCHES ";C;") - set(LANGUAGE C) - set(USING_CXX 0) - else () - message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.") - endif() -endmacro() - -macro(_conan_detect_compiler) - - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_ARCH) - set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH}) - endif() - - if(USING_CXX) - set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD}) - endif() - - if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU) - # using GCC - # TODO: Handle other params - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(COMPILER_VERSION ${MAJOR}.${MINOR}) - if(${MAJOR} GREATER 4) - set(COMPILER_VERSION ${MAJOR}) - endif() - set(_CONAN_SETTING_COMPILER gcc) - set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel) - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(COMPILER_VERSION ${MAJOR}.${MINOR}) - set(_CONAN_SETTING_COMPILER intel) - set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang) - # using AppleClang - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(_CONAN_SETTING_COMPILER apple-clang) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang - AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" - AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC") - - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(_CONAN_SETTING_COMPILER clang) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) - if(APPLE) - cmake_policy(GET CMP0025 APPLE_CLANG_POLICY) - if(NOT APPLE_CLANG_POLICY STREQUAL NEW) - message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it") - set(_CONAN_SETTING_COMPILER apple-clang) - endif() - endif() - if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}) - endif() - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC - OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang - AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" - AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")) - - set(_VISUAL "Visual Studio") - _get_msvc_ide_version(_VISUAL_VERSION) - if("${_VISUAL_VERSION}" STREQUAL "") - message(FATAL_ERROR "Conan: Visual Studio not recognized") - else() - set(_CONAN_SETTING_COMPILER ${_VISUAL}) - set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION}) - endif() - - if(NOT _CONAN_SETTING_ARCH) - if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64") - set(_CONAN_SETTING_ARCH x86_64) - elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM") - message(STATUS "Conan: Using default ARM architecture from MSVC") - set(_CONAN_SETTING_ARCH armv6) - elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86") - set(_CONAN_SETTING_ARCH x86) - else () - message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]") - endif() - endif() - - conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV}) - message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}") - set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime}) - - if (CMAKE_GENERATOR_TOOLSET) - set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) - elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja")) - set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) - endif() - else() - message(FATAL_ERROR "Conan: compiler setup not recognized") - endif() - -endmacro() - -function(conan_cmake_settings result) - #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER}) - #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID}) - #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION}) - #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS}) - #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) - #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE}) - #message(STATUS "GENERATOR " ${CMAKE_GENERATOR}) - #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64}) - - message(STATUS "Conan: Automatic detection of conan settings from cmake") - - conan_parse_arguments(${ARGV}) - - _conan_detect_build_type(${ARGV}) - - _conan_check_system_name() - - _conan_check_language() - - _conan_detect_compiler(${ARGV}) - - # If profile is defined it is used - if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE}) - elseif(ARGUMENTS_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE}) - endif() - - foreach(ARG ${_APPLIED_PROFILES}) - set(_SETTINGS ${_SETTINGS} -pr=${ARG}) - endforeach() - foreach(ARG ${ARGUMENTS_PROFILE_BUILD}) - conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET) - set(_SETTINGS ${_SETTINGS} -pr:b=${ARG}) - endforeach() - - if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL") - set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version - compiler.runtime compiler.libcxx compiler.toolset) - endif() - - # remove any manually specified settings from the autodetected settings - foreach(ARG ${ARGUMENTS_SETTINGS}) - string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}") - message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.") - list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}") - endforeach() - - # Automatic from CMake - foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) - string(TOUPPER ${ARG} _arg_name) - string(REPLACE "." "_" _arg_name ${_arg_name}) - if(_CONAN_SETTING_${_arg_name}) - set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}}) - endif() - endforeach() - - foreach(ARG ${ARGUMENTS_SETTINGS}) - set(_SETTINGS ${_SETTINGS} -s ${ARG}) - endforeach() - - message(STATUS "Conan: Settings= ${_SETTINGS}") - - set(${result} ${_SETTINGS} PARENT_SCOPE) -endfunction() - - -function(conan_cmake_detect_unix_libcxx result) - # Take into account any -stdlib in compile options - get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS) - string(GENEX_STRIP "${compile_options}" compile_options) - - # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions - get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS) - string(GENEX_STRIP "${defines}" defines) - - foreach(define ${defines}) - if(define MATCHES "_GLIBCXX_USE_CXX11_ABI") - if(define MATCHES "^-D") - set(compile_options ${compile_options} "${define}") - else() - set(compile_options ${compile_options} "-D${define}") - endif() - endif() - endforeach() - - # add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable - set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER}) - if(CMAKE_CXX_COMPILER_ARG1) - # CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz" - # without this, ccache, winegcc, or other wrappers might lose all their arguments - separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1}) - list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1}) - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET) - # without --target= we may be calling the wrong underlying GCC - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}") - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) - # without --sysroot= we may find the wrong #include - if(CMAKE_SYSROOT_COMPILE) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}") - elseif(CMAKE_SYSROOT) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}") - endif() - endif() - - separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS}) - - if(CMAKE_OSX_SYSROOT) - set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}") - endif() - - execute_process( - COMMAND ${CMAKE_COMMAND} -E echo "#include " - COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM - - OUTPUT_VARIABLE string_defines - ) - - if(string_defines MATCHES "#define __GLIBCXX__") - # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake - if(DEFINED _GLIBCXX_USE_CXX11_ABI) - if(_GLIBCXX_USE_CXX11_ABI) - set(${result} libstdc++11 PARENT_SCOPE) - return() - else() - set(${result} libstdc++ PARENT_SCOPE) - return() - endif() - endif() - - if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n") - set(${result} libstdc++11 PARENT_SCOPE) - else() - # Either the compiler is missing the define because it is old, and so - # it can't use the new abi, or the compiler was configured to use the - # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS) - set(${result} libstdc++ PARENT_SCOPE) - endif() - else() - set(${result} libc++ PARENT_SCOPE) - endif() -endfunction() - -function(conan_cmake_detect_vs_runtime result) - - conan_parse_arguments(${ARGV}) - if(ARGUMENTS_BUILD_TYPE) - set(build_type "${ARGUMENTS_BUILD_TYPE}") - elseif(CMAKE_BUILD_TYPE) - set(build_type "${CMAKE_BUILD_TYPE}") - else() - message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") - endif() - - if(build_type) - string(TOUPPER "${build_type}" build_type) - endif() - set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS) - foreach(variable ${variables}) - if(NOT "${${variable}}" STREQUAL "") - string(REPLACE " " ";" flags "${${variable}}") - foreach (flag ${flags}) - if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd") - string(SUBSTRING "${flag}" 1 -1 runtime) - set(${result} "${runtime}" PARENT_SCOPE) - return() - endif() - endforeach() - endif() - endforeach() - if("${build_type}" STREQUAL "DEBUG") - set(${result} "MDd" PARENT_SCOPE) - else() - set(${result} "MD" PARENT_SCOPE) - endif() -endfunction() - -function(_collect_settings result) - set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version - compiler.runtime compiler.libcxx compiler.toolset - compiler.cppstd) - foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) - string(TOUPPER ${ARG} _arg_name) - string(REPLACE "." "_" _arg_name ${_arg_name}) - if(_CONAN_SETTING_${_arg_name}) - set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}}) - endif() - endforeach() - set(${result} ${detected_setings} PARENT_SCOPE) -endfunction() - -function(conan_cmake_autodetect detected_settings) - _conan_detect_build_type(${ARGV}) - _conan_check_system_name() - _conan_check_language() - _conan_detect_compiler(${ARGV}) - _collect_settings(collected_settings) - set(${detected_settings} ${collected_settings} PARENT_SCOPE) -endfunction() - -macro(conan_parse_arguments) - set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD) - set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND) - set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE - PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO - INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES) - cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) -endmacro() - -function(old_conan_cmake_install) - # Calls "conan install" - # Argument BUILD is equivalant to --build={missing, PkgName,...} or - # --build when argument is 'BUILD all' (which builds all packages from source) - # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source - # cmake does not identify conan as command, even if it is +x and it is in the path - conan_parse_arguments(${ARGV}) - - if(CONAN_CMAKE_MULTI) - set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi) - else() - set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake) - endif() - - set(CONAN_BUILD_POLICY "") - foreach(ARG ${ARGUMENTS_BUILD}) - if(${ARG} STREQUAL "all") - set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build) - break() - else() - set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG}) - endif() - endforeach() - if(ARGUMENTS_CONAN_COMMAND) - set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) - else() - conan_check(REQUIRED) - endif() - set(CONAN_OPTIONS "") - if(ARGUMENTS_CONANFILE) - if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE}) - set(CONANFILE ${ARGUMENTS_CONANFILE}) - else() - set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) - endif() - else() - set(CONANFILE ".") - endif() - foreach(ARG ${ARGUMENTS_OPTIONS}) - set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG}) - endforeach() - if(ARGUMENTS_UPDATE) - set(CONAN_INSTALL_UPDATE --update) - endif() - if(ARGUMENTS_NO_IMPORTS) - set(CONAN_INSTALL_NO_IMPORTS --no-imports) - endif() - set(CONAN_INSTALL_FOLDER "") - if(ARGUMENTS_INSTALL_FOLDER) - set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER}) - endif() - foreach(ARG ${ARGUMENTS_GENERATORS}) - set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG}) - endforeach() - foreach(ARG ${ARGUMENTS_ENV}) - set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG}) - endforeach() - set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS}) - - string (REPLACE ";" " " _conan_args "${conan_args}") - message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}") - - if(ARGUMENTS_OUTPUT_QUIET) - execute_process(COMMAND ${CONAN_CMD} ${conan_args} - RESULT_VARIABLE return_code - OUTPUT_VARIABLE conan_output - ERROR_VARIABLE conan_output - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - else() - execute_process(COMMAND ${CONAN_CMD} ${conan_args} - RESULT_VARIABLE return_code - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan install failed='${return_code}'") - endif() - -endfunction() - -function(conan_cmake_install) - if(DEFINED CONAN_COMMAND) - set(CONAN_CMD ${CONAN_COMMAND}) - else() - conan_check(REQUIRED) - endif() - - set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET) - set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER) - set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE - PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) - cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN}) - foreach(arg ${installOptions}) - if(ARGS_${arg}) - set(${arg} ${${arg}} ${ARGS_${arg}}) - endif() - endforeach() - foreach(arg ${installOneValueArgs}) - if(DEFINED ARGS_${arg}) - if("${arg}" STREQUAL "REMOTE") - set(flag "--remote") - elseif("${arg}" STREQUAL "LOCKFILE") - set(flag "--lockfile") - elseif("${arg}" STREQUAL "LOCKFILE_OUT") - set(flag "--lockfile-out") - elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID") - set(flag "--lockfile-node-id") - elseif("${arg}" STREQUAL "INSTALL_FOLDER") - set(flag "--install-folder") - endif() - set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) - endif() - endforeach() - foreach(arg ${installMultiValueArgs}) - if(DEFINED ARGS_${arg}) - if("${arg}" STREQUAL "GENERATOR") - set(flag "--generator") - elseif("${arg}" STREQUAL "BUILD") - set(flag "--build") - elseif("${arg}" STREQUAL "ENV") - set(flag "--env") - elseif("${arg}" STREQUAL "ENV_HOST") - set(flag "--env:host") - elseif("${arg}" STREQUAL "ENV_BUILD") - set(flag "--env:build") - elseif("${arg}" STREQUAL "OPTIONS") - set(flag "--options") - elseif("${arg}" STREQUAL "OPTIONS_HOST") - set(flag "--options:host") - elseif("${arg}" STREQUAL "OPTIONS_BUILD") - set(flag "--options:build") - elseif("${arg}" STREQUAL "PROFILE") - set(flag "--profile") - elseif("${arg}" STREQUAL "PROFILE_HOST") - set(flag "--profile:host") - elseif("${arg}" STREQUAL "PROFILE_BUILD") - set(flag "--profile:build") - elseif("${arg}" STREQUAL "SETTINGS") - set(flag "--settings") - elseif("${arg}" STREQUAL "SETTINGS_HOST") - set(flag "--settings:host") - elseif("${arg}" STREQUAL "SETTINGS_BUILD") - set(flag "--settings:build") - endif() - list(LENGTH ARGS_${arg} numargs) - foreach(item ${ARGS_${arg}}) - if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") - set(${arg} "--build") - break() - endif() - set(${arg} ${${arg}} ${flag} ${item}) - endforeach() - endif() - endforeach() - if(DEFINED UPDATE) - set(UPDATE --update) - endif() - if(DEFINED NO_IMPORTS) - set(NO_IMPORTS --no-imports) - endif() - set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} - ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} - ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) - - string(REPLACE ";" " " _install_args "${install_args}") - message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}") - - if(ARGS_OUTPUT_QUIET) - set(OUTPUT_OPT OUTPUT_QUIET) - endif() - if(ARGS_ERROR_QUIET) - set(ERROR_OPT ERROR_QUIET) - endif() - - execute_process(COMMAND ${CONAN_CMD} ${install_args} - RESULT_VARIABLE return_code - ${OUTPUT_OPT} - ${ERROR_OPT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - if(NOT "${return_code}" STREQUAL "0") - if (ARGS_ERROR_QUIET) - message(WARNING "Conan install failed='${return_code}'") - else() - message(FATAL_ERROR "Conan install failed='${return_code}'") - endif() - endif() - -endfunction() - -function(conan_cmake_setup_conanfile) - conan_parse_arguments(${ARGV}) - if(ARGUMENTS_CONANFILE) - get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME) - # configure_file will make sure cmake re-runs when conanfile is updated - configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk) - else() - conan_cmake_generate_conanfile(ON ${ARGV}) - endif() -endfunction() - -function(conan_cmake_configure) - conan_cmake_generate_conanfile(OFF ${ARGV}) -endfunction() - -# Generate, writing in disk a conanfile.txt with the requires, options, and imports -# specified as arguments -# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR) -function(conan_cmake_generate_conanfile DEFAULT_GENERATOR) - - conan_parse_arguments(${ARGV}) - - set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt") - file(WRITE ${_FN} "") - - if(DEFINED ARGUMENTS_REQUIRES) - file(APPEND ${_FN} "[requires]\n") - foreach(REQUIRE ${ARGUMENTS_REQUIRES}) - file(APPEND ${_FN} ${REQUIRE} "\n") - endforeach() - endif() - - if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS) - file(APPEND ${_FN} "[generators]\n") - if (DEFAULT_GENERATOR) - file(APPEND ${_FN} "cmake\n") - endif() - if (DEFINED ARGUMENTS_GENERATORS) - foreach(GENERATOR ${ARGUMENTS_GENERATORS}) - file(APPEND ${_FN} ${GENERATOR} "\n") - endforeach() - endif() - endif() - - if(DEFINED ARGUMENTS_BUILD_REQUIRES) - file(APPEND ${_FN} "[build_requires]\n") - foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES}) - file(APPEND ${_FN} ${BUILD_REQUIRE} "\n") - endforeach() - endif() - - if(DEFINED ARGUMENTS_IMPORTS) - file(APPEND ${_FN} "[imports]\n") - foreach(IMPORTS ${ARGUMENTS_IMPORTS}) - file(APPEND ${_FN} ${IMPORTS} "\n") - endforeach() - endif() - - if(DEFINED ARGUMENTS_OPTIONS) - file(APPEND ${_FN} "[options]\n") - foreach(OPTION ${ARGUMENTS_OPTIONS}) - file(APPEND ${_FN} ${OPTION} "\n") - endforeach() - endif() - -endfunction() - - -macro(conan_load_buildinfo) - if(CONAN_CMAKE_MULTI) - set(_CONANBUILDINFO conanbuildinfo_multi.cmake) - else() - set(_CONANBUILDINFO conanbuildinfo.cmake) - endif() - if(ARGUMENTS_INSTALL_FOLDER) - set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER}) - else() - set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR}) - endif() - # Checks for the existence of conanbuildinfo.cmake, and loads it - # important that it is macro, so variables defined at parent scope - if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}") - message(STATUS "Conan: Loading ${_CONANBUILDINFO}") - include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}) - else() - message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}") - endif() -endmacro() - - -macro(conan_cmake_run) - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES) - message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators") - elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE) - message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.") - endif() - - if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED - AND NOT ARGUMENTS_BUILD_TYPE) - set(CONAN_CMAKE_MULTI ON) - if (NOT ARGUMENTS_CONFIGURATION_TYPES) - set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug") - endif() - message(STATUS "Conan: Using cmake-multi generator") - else() - set(CONAN_CMAKE_MULTI OFF) - endif() - - if(NOT CONAN_EXPORTED) - conan_cmake_setup_conanfile(${ARGV}) - if(CONAN_CMAKE_MULTI) - foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES}) - set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE}) - conan_cmake_settings(settings ${ARGV}) - old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) - endforeach() - set(CMAKE_BUILD_TYPE) - else() - conan_cmake_settings(settings ${ARGV}) - old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) - endif() - endif() - - if (NOT ARGUMENTS_NO_LOAD) - conan_load_buildinfo() - endif() - - if(ARGUMENTS_BASIC_SETUP) - foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD) - if(ARGUMENTS_${_option}) - if(${_option} STREQUAL "CMAKE_TARGETS") - list(APPEND _setup_options "TARGETS") - else() - list(APPEND _setup_options ${_option}) - endif() - endif() - endforeach() - conan_basic_setup(${_setup_options}) - endif() -endmacro() - -macro(conan_check) - # Checks conan availability in PATH - # Arguments REQUIRED, DETECT_QUIET and VERSION are optional - # Example usage: - # conan_check(VERSION 1.0.0 REQUIRED) - set(options REQUIRED DETECT_QUIET) - set(oneValueArgs VERSION) - cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN}) - if(NOT CONAN_DETECT_QUIET) - message(STATUS "Conan: checking conan executable") - endif() - - find_program(CONAN_CMD conan) - if(NOT CONAN_CMD AND CONAN_REQUIRED) - message(FATAL_ERROR "Conan executable not found! Please install conan.") - endif() - if(NOT CONAN_DETECT_QUIET) - message(STATUS "Conan: Found program ${CONAN_CMD}") - endif() - execute_process(COMMAND ${CONAN_CMD} --version - RESULT_VARIABLE return_code - OUTPUT_VARIABLE CONAN_VERSION_OUTPUT - ERROR_VARIABLE CONAN_VERSION_OUTPUT) - - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan --version failed='${return_code}'") - endif() - - if(NOT CONAN_DETECT_QUIET) - string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT) - message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}") - endif() - - if(DEFINED CONAN_VERSION) - string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO - "${CONAN_VERSION_OUTPUT}") - if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION}) - message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \ - required: ${CONAN_VERSION}. Consider updating via 'pip \ - install conan==${CONAN_VERSION}'.") - endif() - endif() -endmacro() - -function(conan_add_remote) - # Adds a remote - # Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional - # Example usage: - # conan_add_remote(NAME bincrafters INDEX 1 - # URL https://api.bintray.com/conan/bincrafters/public-conan - # VERIFY_SSL True) - set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL) - cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) - - if(DEFINED CONAN_INDEX) - set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") - endif() - if(DEFINED CONAN_COMMAND) - set(CONAN_CMD ${CONAN_COMMAND}) - else() - conan_check(REQUIRED DETECT_QUIET) - endif() - set(CONAN_VERIFY_SSL_ARG "True") - if(DEFINED CONAN_VERIFY_SSL) - set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL}) - endif() - message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})") - execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG} - RESULT_VARIABLE return_code) - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan remote failed='${return_code}'") - endif() -endfunction() - -macro(conan_config_install) - # install a full configuration from a local or remote zip file - # Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional - # Example usage: - # conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git - # TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false) - set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL) - set(multiValueArgs ARGS) - cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - find_program(CONAN_CMD conan) - if(NOT CONAN_CMD AND CONAN_REQUIRED) - message(FATAL_ERROR "Conan executable not found!") - endif() - - if(DEFINED CONAN_VERIFY_SSL) - set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}") - endif() - - if(DEFINED CONAN_TYPE) - set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}") - endif() - - if(DEFINED CONAN_ARGS) - set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"") - endif() - - if(DEFINED CONAN_SOURCE) - set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}") - endif() - - if(DEFINED CONAN_TARGET) - set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}") - endif() - - set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG} - ${CONAN_TYPE_ARG} - ${CONAN_ARGS_ARGS} - ${CONAN_SOURCE_ARGS} - ${CONAN_TARGET_ARGS}) - - message(STATUS "Conan: Installing config from ${CONAN_ITEM}") - execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS} - RESULT_VARIABLE return_code) - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan config failed='${return_code}'") - endif() -endmacro() diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..897ecf6 --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,10 @@ +[requires] +xsimd/11.1.0 +eigen/3.4.0 +catch2/3.3.2 +celero/2.8.2 +libsndfile/1.2.0 + +[generators] +CMakeDeps +CMakeToolchain \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 433d312..0aef36a 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -6,13 +6,6 @@ add_executable(04_FIR_Filtering "04_FIR_Filtering.cpp" "RtAudio/RtAudio.cpp" "To list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/examples) list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/examples) -conan_cmake_configure( - REQUIRES - libsndfile/1.0.31 - GENERATORS cmake_find_package -) -conan_cmake_install(PATH_OR_REFERENCE . BUILD missing SETTINGS ${conan_settings} OUTPUT_QUIET) - if (${CMAKE_CXX_COMPILER} MATCHES "MSVC") target_compile_options(01_Basics PRIVATE "/bigobj") target_compile_options(02_FFT PRIVATE "/bigobj") @@ -25,7 +18,7 @@ find_package(SndFile REQUIRED) target_link_libraries(01_Basics DSPBB) target_link_libraries(02_FFT DSPBB) target_link_libraries(03_IIR_Filtering DSPBB) -target_link_libraries(04_FIR_Filtering DSPBB SndFile::SndFile) +target_link_libraries(04_FIR_Filtering DSPBB SndFile::sndfile) set(DSPBB_EXAMPLES_DATA "\"${CMAKE_CURRENT_SOURCE_DIR}/data/\"") target_compile_definitions(02_FFT PRIVATE "-DDSPBB_EXAMPLES_DATA=${DSPBB_EXAMPLES_DATA}") diff --git a/include/dspbb/CMakeLists.txt b/include/dspbb/CMakeLists.txt index f7954bc..275dbc5 100644 --- a/include/dspbb/CMakeLists.txt +++ b/include/dspbb/CMakeLists.txt @@ -5,7 +5,7 @@ target_include_directories(DSPBB INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/..") find_package(xsimd REQUIRED) find_package(Eigen3 REQUIRED) -target_link_libraries(DSPBB INTERFACE xsimd::xsimd) -target_link_libraries(DSPBB INTERFACE Eigen3::Eigen3) +target_link_libraries(DSPBB INTERFACE xsimd) +target_link_libraries(DSPBB INTERFACE Eigen3::Eigen) target_compile_features(DSPBB INTERFACE cxx_std_17) \ No newline at end of file diff --git a/include/dspbb/Kernels/Numeric.hpp b/include/dspbb/Kernels/Numeric.hpp index 4b716cf..f3787e8 100644 --- a/include/dspbb/Kernels/Numeric.hpp +++ b/include/dspbb/Kernels/Numeric.hpp @@ -172,12 +172,12 @@ Init ReduceBatch(const xsimd::batch& batch, Init init, ReduceOp reduceO template Init ReduceBatch(const xsimd::batch& batch, Init init, plus_compensated) { - return init + xsimd::hadd(batch); + return init + xsimd::reduce_add(batch); } template Init ReduceBatch(const xsimd::batch& batch, Init init, std::plus) { - return init + xsimd::hadd(batch); + return init + xsimd::reduce_add(batch); } template diff --git a/test/Filtering/FIR/Test_Descs.cpp b/test/Filtering/FIR/Test_Descs.cpp index 7997db7..69e3a3d 100644 --- a/test/Filtering/FIR/Test_Descs.cpp +++ b/test/Filtering/FIR/Test_Descs.cpp @@ -1,9 +1,12 @@ #include -#include +#include +#include using namespace dspbb; +using Catch::Approx; + //------------------------------------------------------------------------------ // Windowed diff --git a/test/Filtering/IIR/Test_BandTransforms.cpp b/test/Filtering/IIR/Test_BandTransforms.cpp index a897196..797f58c 100644 --- a/test/Filtering/IIR/Test_BandTransforms.cpp +++ b/test/Filtering/IIR/Test_BandTransforms.cpp @@ -1,10 +1,13 @@ #include #include -#include +#include +#include using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; + const DiscreteZeroPoleGain prototype = { 0.166666672f, diff --git a/test/Filtering/IIR/Test_Descs.cpp b/test/Filtering/IIR/Test_Descs.cpp index e9c3b54..e351067 100644 --- a/test/Filtering/IIR/Test_Descs.cpp +++ b/test/Filtering/IIR/Test_Descs.cpp @@ -1,6 +1,6 @@ #include -#include +#include using namespace dspbb; diff --git a/test/Filtering/IIR/Test_Kernels.cpp b/test/Filtering/IIR/Test_Kernels.cpp index d6cdc57..1833a18 100644 --- a/test/Filtering/IIR/Test_Kernels.cpp +++ b/test/Filtering/IIR/Test_Kernels.cpp @@ -2,10 +2,13 @@ #include #include -#include +#include +#include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; TEST_CASE("Butterworth even", "[IIR Kernels]") { diff --git a/test/Filtering/IIR/Test_Realizations.cpp b/test/Filtering/IIR/Test_Realizations.cpp index 37e2683..c09a63c 100644 --- a/test/Filtering/IIR/Test_Realizations.cpp +++ b/test/Filtering/IIR/Test_Realizations.cpp @@ -4,12 +4,14 @@ #include #include -#include +#include +#include using namespace dspbb; using namespace std::complex_literals; using real_t = double; +using Catch::Approx; const DiscreteZeroPoleGain sys = { diff --git a/test/Filtering/Test_FIR.cpp b/test/Filtering/Test_FIR.cpp index 76ec311..7a2a2af 100644 --- a/test/Filtering/Test_FIR.cpp +++ b/test/Filtering/Test_FIR.cpp @@ -7,9 +7,12 @@ #include #include -#include +#include +#include + using namespace dspbb; +using Catch::Approx; //------------------------------------------------------------------------------ diff --git a/test/Filtering/Test_IIR.cpp b/test/Filtering/Test_IIR.cpp index 32c61ff..57f4cb4 100644 --- a/test/Filtering/Test_IIR.cpp +++ b/test/Filtering/Test_IIR.cpp @@ -4,9 +4,12 @@ #include #include -#include +#include +#include + using namespace dspbb; +using Catch::Approx; //------------------------------------------------------------------------------ diff --git a/test/Filtering/Test_MeasureFilter.cpp b/test/Filtering/Test_MeasureFilter.cpp index 829d8ed..b865be4 100644 --- a/test/Filtering/Test_MeasureFilter.cpp +++ b/test/Filtering/Test_MeasureFilter.cpp @@ -3,11 +3,13 @@ #include #include -#include +#include +#include #include -using namespace dspbb; +using namespace dspbb; +using Catch::Approx; //------------------------------------------------------------------------------ diff --git a/test/Filtering/Test_Polyphase.cpp b/test/Filtering/Test_Polyphase.cpp index d9fdca5..24d48a6 100644 --- a/test/Filtering/Test_Polyphase.cpp +++ b/test/Filtering/Test_Polyphase.cpp @@ -1,9 +1,12 @@ #include "dspbb/Generators/Waveforms.hpp" #include -#include +#include +#include + using namespace dspbb; +using Catch::Approx; TEST_CASE("Polyphase view filter non-uniform", "[Polyphase]") { diff --git a/test/Filtering/Test_Resample.cpp b/test/Filtering/Test_Resample.cpp index 8f05517..7004e15 100644 --- a/test/Filtering/Test_Resample.cpp +++ b/test/Filtering/Test_Resample.cpp @@ -3,10 +3,13 @@ #include #include -#include +#include +#include #include + using namespace dspbb; +using Catch::Approx; template @@ -48,7 +51,7 @@ TEST_CASE("Interpolation full", "[Interpolation]") { const auto reference = InterpolateRefImpl(signal, filter, interpRate, 0, length); const auto answer = Interpolate(signal, polyphase, 0, length); - INFO("filterSize=" << filterSize) + INFO("filterSize=" << filterSize); REQUIRE(reference.size() == answer.size()); REQUIRE(Max(Abs(reference - answer)) < 1e-6f); } @@ -67,7 +70,7 @@ TEST_CASE("Interpolation central", "[Interpolation]") { const auto reference = InterpolateRefImpl(signal, filter, interpRate, filterSize - 1, length); const auto answer = Interpolate(signal, polyphase, filterSize - 1, length); - INFO("filterSize=" << filterSize) + INFO("filterSize=" << filterSize); REQUIRE(reference.size() == answer.size()); REQUIRE(Max(Abs(reference - answer)) < 1e-6f); } @@ -259,7 +262,7 @@ TEST_CASE("Resampling spectrum invariance - upsample mild", "[Interpolation]") { const auto resampled = Resample(signal, polyphase, { inputRate, outputRate }, { 0, 1 }, floor(length)); const auto similarity = ResampledSimilarity({ inputRate, outputRate }, signal, resampled); - INFO("filterSize=" << filterSize) + INFO("filterSize=" << filterSize); REQUIRE(similarity > 0.98f); } } @@ -280,7 +283,7 @@ TEST_CASE("Resampling spectrum invariance - upsample strong", "[Interpolation]") const auto resampled = Resample(signal, polyphase, { inputRate, outputRate }, { 0, 1 }, floor(length)); const auto similarity = ResampledSimilarity({ inputRate, outputRate }, signal, resampled); - INFO("filterSize=" << filterSize) + INFO("filterSize=" << filterSize); REQUIRE(similarity > 0.98f); } } @@ -301,7 +304,7 @@ TEST_CASE("Resampling spectrum invariance - downsample mild", "[Interpolation]") const auto resampled = Resample(signal, polyphase, { inputRate, outputRate }, { 0, 1 }, floor(length)); const auto similarity = ResampledSimilarity({ inputRate, outputRate }, signal, resampled); - INFO("filterSize=" << filterSize) + INFO("filterSize=" << filterSize); REQUIRE(similarity > 0.98f); } } @@ -322,7 +325,7 @@ TEST_CASE("Resampling spectrum invariance - downsample strong", "[Interpolation] const auto resampled = Resample(signal, polyphase, { inputRate, outputRate }, { 0, 1 }, floor(length)); const auto similarity = ResampledSimilarity({ inputRate, outputRate }, signal, resampled); - INFO("filterSize=" << filterSize) + INFO("filterSize=" << filterSize); REQUIRE(similarity > 0.98f); } } @@ -368,7 +371,7 @@ TEST_CASE("Resampling delay - upsample mild", "[Interpolation]") { const auto resamplingDelay = ResampleDelay(filterSize, supersamplingRate, { inputRate, outputRate }); const double crossingExpected = double(resamplingDelay) + crossingSignal * outputRate / inputRate; - INFO("filterSize=" << filterSize) + INFO("filterSize=" << filterSize); REQUIRE(crossingExpected == Approx(crossingResampled)); } } diff --git a/test/Filtering/Test_Windowing.cpp b/test/Filtering/Test_Windowing.cpp index 9e4d5f9..29e0718 100644 --- a/test/Filtering/Test_Windowing.cpp +++ b/test/Filtering/Test_Windowing.cpp @@ -4,9 +4,12 @@ #include #include -#include +#include +#include + using namespace dspbb; +using Catch::Approx; TEST_CASE("Coherent gain", "[WindowFunctions]") { diff --git a/test/Generators/Test_Generators.cpp b/test/Generators/Test_Generators.cpp index cc8e57f..3c9e636 100644 --- a/test/Generators/Test_Generators.cpp +++ b/test/Generators/Test_Generators.cpp @@ -4,10 +4,12 @@ #include #include -#include +#include +#include using namespace dspbb; +using Catch::Approx; constexpr int sampleRate = 44100; diff --git a/test/Kernels/Test_Convolution.cpp b/test/Kernels/Test_Convolution.cpp index 83ba116..a61edf8 100644 --- a/test/Kernels/Test_Convolution.cpp +++ b/test/Kernels/Test_Convolution.cpp @@ -1,9 +1,12 @@ #include #include -#include +#include +#include + using namespace dspbb; +using Catch::Approx; constexpr std::array ur = { 1, 3, 7, 2, 9, 2, 5, 3, 7, 2, 4, 7, 3, 6, 3, 9, 3, 5, 3, 5 }; diff --git a/test/Kernels/Test_Numeric.cpp b/test/Kernels/Test_Numeric.cpp index 866c466..c726d14 100644 --- a/test/Kernels/Test_Numeric.cpp +++ b/test/Kernels/Test_Numeric.cpp @@ -2,10 +2,13 @@ #include #include -#include +#include +#include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; //------------------------------------------------------------------------------ @@ -137,7 +140,7 @@ TEST_CASE("InnerProduct float", "[Kernels - Numeric]") { std::iota(b.begin(), b.end(), 3.0f); for (auto it = a.begin(); it != a.end(); ++it) { - INFO(it - a.begin()) + INFO(it - a.begin()); const auto reference = std::inner_product(a.begin(), it, b.begin(), 5.0f, std::plus<>{}, std::multiplies<>{}); const auto value = kernels::InnerProduct(a.begin(), it, b.begin(), 5.0f, std::plus<>{}, std::multiplies<>{}); REQUIRE(reference == value); @@ -151,7 +154,7 @@ TEST_CASE("InnerProduct double", "[Kernels - Numeric]") { std::iota(b.begin(), b.end(), 3.0); for (auto it = a.begin(); it != a.end(); ++it) { - INFO(it - a.begin()) + INFO(it - a.begin()); const auto reference = std::inner_product(a.begin(), it, b.begin(), 5.0, std::plus<>{}, std::multiplies<>{}); const auto value = kernels::InnerProduct(a.begin(), it, b.begin(), 5.0, std::plus<>{}, std::multiplies<>{}); REQUIRE(reference == value); diff --git a/test/LTISystems/Test_DiscretizationTransforms.cpp b/test/LTISystems/Test_DiscretizationTransforms.cpp index 6f8bcf8..494a140 100644 --- a/test/LTISystems/Test_DiscretizationTransforms.cpp +++ b/test/LTISystems/Test_DiscretizationTransforms.cpp @@ -1,10 +1,13 @@ #include #include -#include +#include +#include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; TEST_CASE("Bilinear C->D", "[DiscreteizationTransforms]") { diff --git a/test/LTISystems/Test_Systems.cpp b/test/LTISystems/Test_Systems.cpp index 7901484..08815b0 100644 --- a/test/LTISystems/Test_Systems.cpp +++ b/test/LTISystems/Test_Systems.cpp @@ -3,11 +3,13 @@ #include #include -#include +#include +#include using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; template diff --git a/test/Math/Test_Convolution.cpp b/test/Math/Test_Convolution.cpp index 5aeb26f..934338c 100644 --- a/test/Math/Test_Convolution.cpp +++ b/test/Math/Test_Convolution.cpp @@ -1,12 +1,14 @@ #include #include -#include +#include #include + using namespace dspbb; using namespace std::complex_literals; + constexpr std::array ur = { 1, 3, 7, 2, 9, 2, 5, 3, 7, 2, 4, 7, 3, 6, 3, 9, 3, 5, 3, 5 }; constexpr std::array vr = { 4, 3, 5, 2, 6, 3, 2, 7, 8, 5, 3, 3 }; constexpr std::array urvr_central = { 227, 244, 238, 207, 270, 219, 242, 223, 259 }; diff --git a/test/Math/Test_EllipticFunctions.cpp b/test/Math/Test_EllipticFunctions.cpp index d24b4f2..c500267 100644 --- a/test/Math/Test_EllipticFunctions.cpp +++ b/test/Math/Test_EllipticFunctions.cpp @@ -3,11 +3,14 @@ #include #include -#include +#include +#include using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; + //------------------------------------------------------------------------------ // Carlson symmetric forms @@ -137,7 +140,7 @@ TEST_CASE("Elliptic SNCNDN special values", "[Elliptic functions]") { for (auto& value : values) { INFO("z=" << value.z << "|" - << "k=" << value.k) + << "k=" << value.k); auto [ysn, ycn, ydn] = EllipticSNCNDN(value.z, value.k); ysn = abs(ysn) > 1e+8 ? inf : ysn; ycn = abs(ysn) > 1e+8 ? inf : ycn; @@ -199,7 +202,7 @@ TEST_CASE("Elliptic SNCNDN degeneration at k=1 - tiny", "[Elliptic functions]") TEST_CASE("Elliptic SNCNDN half argument identity", "[Elliptic functions]") { const double k = 0.17; for (auto& z : zs) { - INFO("z=" << z) + INFO("z=" << z); const auto [halfsn, halfcn, halfdn] = EllipticSNCNDN(z / 2.0, k); const auto [fullsn, fullcn, fulldn] = EllipticSNCNDN(z, k); REQUIRE(halfsn * halfsn == ApproxComplex((1.0 - fullcn) / (1.0 + fulldn)).margin(1e-15)); @@ -211,7 +214,7 @@ TEST_CASE("Elliptic SNCNDN half argument identity", "[Elliptic functions]") { TEST_CASE("Elliptic SNCNDN imaginary transformations identity", "[Elliptic functions]") { const double k = 0.17; for (auto& z : zs) { - INFO("z=" << z) + INFO("z=" << z); const auto [rotsn, rotcn, rotdn] = EllipticSNCNDN(1.0i * z, k); const auto [ysn, ycn, ydn] = EllipticSNCNDN(z, std::sqrt(1.0 - k * k)); REQUIRE(rotsn == ApproxComplex(1.0i * ysn / ycn).margin(1e-15)); @@ -225,7 +228,7 @@ TEST_CASE("Elliptic SNCNDN descending Landen transformations identity", "[Ellipt const double kp = std::sqrt(1.0 - k * k); const double k1 = (1.0 - kp) / (1.0 + kp); for (auto& z : zs) { - INFO("z=" << z) + INFO("z=" << z); const auto [ysn, ycn, ydn] = EllipticSNCNDN(z, k); const auto [ysn1, ycn1, ydn1] = EllipticSNCNDN(z / (1.0 + k1), k1); REQUIRE(ysn == ApproxComplex((1.0 + k1) * ysn1 / (1.0 + k1 * ysn1 * ysn1)).margin(1e-15)); @@ -239,7 +242,7 @@ TEST_CASE("Elliptic SNCNDN ascending Landen transformations identity", "[Ellipti const double k2 = 2.0 * std::sqrt(k) / (1.0 + k); const double k2p = (1.0 - k) / (1.0 + k); for (auto& z : zs) { - INFO("z=" << z) + INFO("z=" << z); const auto [ysn, ycn, ydn] = EllipticSNCNDN(z, k); const auto [ysn2, ycn2, ydn2] = EllipticSNCNDN(z / (1.0 + k2p), k2); REQUIRE(ysn == ApproxComplex((1.0 + k2p) * ysn2 * ycn2 / ydn2).margin(1e-15f)); diff --git a/test/Math/Test_FFT.cpp b/test/Math/Test_FFT.cpp index e01cfd5..20593ae 100644 --- a/test/Math/Test_FFT.cpp +++ b/test/Math/Test_FFT.cpp @@ -8,9 +8,13 @@ #include #include -#include +#include +#include + using namespace dspbb; +using Catch::Approx; + constexpr uint64_t sampleRate = 16000; constexpr float frequency = 2000; diff --git a/test/Math/Test_Functions.cpp b/test/Math/Test_Functions.cpp index 14ff2c7..ab34b66 100644 --- a/test/Math/Test_Functions.cpp +++ b/test/Math/Test_Functions.cpp @@ -1,12 +1,16 @@ #include #include -#include +#include +#include #include #include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; + template auto iden(T arg) { diff --git a/test/Math/Test_OverlapAdd.cpp b/test/Math/Test_OverlapAdd.cpp index f7c1eb1..8ec6c26 100644 --- a/test/Math/Test_OverlapAdd.cpp +++ b/test/Math/Test_OverlapAdd.cpp @@ -4,10 +4,13 @@ #include #include -#include +#include +#include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; TEST_CASE("OLA real-real central", "[OverlapAdd]") { diff --git a/test/Math/Test_Polynomials.cpp b/test/Math/Test_Polynomials.cpp index d0dce7a..afa7ad2 100644 --- a/test/Math/Test_Polynomials.cpp +++ b/test/Math/Test_Polynomials.cpp @@ -2,10 +2,13 @@ #include -#include +#include +#include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; TEST_CASE("empty polynomial", "[Polynomials]") { diff --git a/test/Math/Test_Rational.cpp b/test/Math/Test_Rational.cpp index 08ae4d3..3e12824 100644 --- a/test/Math/Test_Rational.cpp +++ b/test/Math/Test_Rational.cpp @@ -1,10 +1,13 @@ #include -#include +#include +#include #include using namespace dspbb; +using Catch::Approx; + TEST_CASE("Rational create whole", "[Rational]") { constexpr Rational r{ 6 }; diff --git a/test/Math/Test_RootTransforms.cpp b/test/Math/Test_RootTransforms.cpp index 487a5ee..3d3980f 100644 --- a/test/Math/Test_RootTransforms.cpp +++ b/test/Math/Test_RootTransforms.cpp @@ -3,11 +3,15 @@ #include #include -#include +#include +#include #include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; + const FactoredPolynomial rootsDouble = { 1.0f, 2.0f, 3.0f + 2.0if, 3.0f - 2.0if diff --git a/test/Math/Test_Solvers.cpp b/test/Math/Test_Solvers.cpp index bd70b5c..f3c0726 100644 --- a/test/Math/Test_Solvers.cpp +++ b/test/Math/Test_Solvers.cpp @@ -1,9 +1,13 @@ #include "dspbb/Utility/Numbers.hpp" #include -#include +#include +#include + using namespace dspbb; +using Catch::Approx; + TEST_CASE("Bisect exponential", "[Solvers]") { const auto f = [](auto x) { return std::exp(x) - 2; }; diff --git a/test/Math/Test_Statistics.cpp b/test/Math/Test_Statistics.cpp index 1d49028..d6e76c7 100644 --- a/test/Math/Test_Statistics.cpp +++ b/test/Math/Test_Statistics.cpp @@ -1,11 +1,16 @@ #include #include -#include +#include +#include #include +#include + using namespace dspbb; using namespace std::complex_literals; +using Catch::Approx; + TEST_CASE("CentralMoment #0 and #1", "[Statistics]") { Signal s = { 2, 4, 4, 4, 5, 5, 7, 9 }; diff --git a/test/Primitives/Test_Signal.cpp b/test/Primitives/Test_Signal.cpp index cb5535d..c5ec64d 100644 --- a/test/Primitives/Test_Signal.cpp +++ b/test/Primitives/Test_Signal.cpp @@ -1,11 +1,13 @@ #include -#include +#include #include + using namespace dspbb; using namespace std::complex_literals; + TEST_CASE("Signal - Default construct", "[Signal]") { Signal s; Signal> c; diff --git a/test/Primitives/Test_SignalArithmetic.cpp b/test/Primitives/Test_SignalArithmetic.cpp index 0a7bc7a..0cdfa47 100644 --- a/test/Primitives/Test_SignalArithmetic.cpp +++ b/test/Primitives/Test_SignalArithmetic.cpp @@ -5,10 +5,14 @@ #include #include -#include +#include +#include +#include + using namespace dspbb; + static_assert(is_mutable_signal_v>, ""); static_assert(is_mutable_signal_v&>, ""); static_assert(is_mutable_signal_v&&>, ""); diff --git a/test/Primitives/Test_SignalView.cpp b/test/Primitives/Test_SignalView.cpp index eb0e328..a0879c1 100644 --- a/test/Primitives/Test_SignalView.cpp +++ b/test/Primitives/Test_SignalView.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include using namespace dspbb; diff --git a/test/TestUtils.hpp b/test/TestUtils.hpp index ad7275d..8443ded 100644 --- a/test/TestUtils.hpp +++ b/test/TestUtils.hpp @@ -3,7 +3,8 @@ #include #include -#include +#include +#include #include #include @@ -54,8 +55,8 @@ class ApproxComplex { template , T>>::type> friend bool operator==(const T& lhs, ApproxComplex const& rhs) { auto lhs_v = static_cast>(lhs); - return Catch::Detail::Approx(rhs.m_value.real()).epsilon(rhs.m_epsilon).margin(rhs.m_margin).scale(rhs.m_scale) == lhs_v.real() - && Catch::Detail::Approx(rhs.m_value.imag()).epsilon(rhs.m_epsilon).margin(rhs.m_margin).scale(rhs.m_scale) == lhs_v.imag(); + return Catch::Approx(rhs.m_value.real()).epsilon(rhs.m_epsilon).margin(rhs.m_margin).scale(rhs.m_scale) == lhs_v.real() + && Catch::Approx(rhs.m_value.imag()).epsilon(rhs.m_epsilon).margin(rhs.m_margin).scale(rhs.m_scale) == lhs_v.imag(); } template , T>>::type> diff --git a/test/Utility/Test_Interval.cpp b/test/Utility/Test_Interval.cpp index b91bfe4..282de82 100644 --- a/test/Utility/Test_Interval.cpp +++ b/test/Utility/Test_Interval.cpp @@ -1,6 +1,6 @@ #include -#include +#include using namespace dspbb; diff --git a/test/main.cpp b/test/main.cpp index 2e4156d..1508180 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,5 +1,5 @@ #define CATCH_CONFIG_RUNNER -#include +#include int main(int argc, char* argv[]) { From d9aca878c1aca54af63b72fe022d779f3320acb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 19:49:47 +0200 Subject: [PATCH 02/22] fix workflow --- .github/workflows/build_and_test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 529ce07..aa00f9a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -55,7 +55,8 @@ jobs: pip install conan conan profile detect --name ci --force sed -i 's/build_type=.*/build_type=${{ matrix.build_type }}/g' $(conan profile path ci) - echo '[conf]'' >> $(conan profile path ci) + sed -i 's/compiler.cppstd=.*/compiler.cppstd=${{ matrix.cxx_standard }}/g' $(conan profile path ci) + echo '[conf]' >> $(conan profile path ci) echo 'tools.build:compiler_executables={"cpp": "${{ matrix.cxx_compiler }}", "c": "${{ matrix.c_compiler }}"}' >> $(conan profile path ci) - name: Create Build Environment @@ -68,7 +69,7 @@ jobs: CC: ${{matrix.c_compiler}} CXX: ${{matrix.cxx_compiler}} run: | - conan install .. --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} + conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} - name: Build From 601cda8776e0daebd1c521058003702950b69651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 19:55:38 +0200 Subject: [PATCH 03/22] fix workflow --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index aa00f9a..96e187a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -70,7 +70,7 @@ jobs: CXX: ${{matrix.cxx_compiler}} run: | conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} - cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }} + cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake - name: Build working-directory: ${{runner.workspace}}/build From 332b5f7e9e41c1e7d89a392385783e8d77b65da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 20:37:53 +0200 Subject: [PATCH 04/22] tmate debug --- .github/workflows/build_and_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 96e187a..88e14df 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -46,6 +46,9 @@ jobs: - uses: seanmiddleditch/gha-setup-ninja@v3 - uses: seanmiddleditch/gha-setup-vsdevenv@master + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + - name: Install conan shell: bash env: From 95d7f5349d8b4f3dd9e901739e6dbbd78b898911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 20:53:27 +0200 Subject: [PATCH 05/22] asd --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 88e14df..6e83dc0 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -52,8 +52,8 @@ jobs: - name: Install conan shell: bash env: - CC: ${{matrix.c_compiler}} - CXX: ${{matrix.cxx_compiler}} + CC: "${{ matrix.c_compiler != 'cl' && 'matrix.c_compiler' || '' }}" + CXX: "${{ matrix.cxx_compiler != 'cl' && 'matrix.cxx_compiler' || '' }}" run: | pip install conan conan profile detect --name ci --force From 4ccd763b28d495d66dc97b2f28d2f0d957e30863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 20:54:20 +0200 Subject: [PATCH 06/22] asd --- .github/workflows/build_and_test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6e83dc0..e01db64 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -46,9 +46,6 @@ jobs: - uses: seanmiddleditch/gha-setup-ninja@v3 - uses: seanmiddleditch/gha-setup-vsdevenv@master - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - - name: Install conan shell: bash env: From 14c9b2f75c592ca8699e739726ef815be10466fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 20:56:28 +0200 Subject: [PATCH 07/22] asd --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e01db64..f754573 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -49,8 +49,8 @@ jobs: - name: Install conan shell: bash env: - CC: "${{ matrix.c_compiler != 'cl' && 'matrix.c_compiler' || '' }}" - CXX: "${{ matrix.cxx_compiler != 'cl' && 'matrix.cxx_compiler' || '' }}" + CC: "${{ matrix.c_compiler != 'cl' && matrix.c_compiler || '' }}" + CXX: "${{ matrix.cxx_compiler != 'cl' && matrix.cxx_compiler || '' }}" run: | pip install conan conan profile detect --name ci --force From 172cba10d1dd74058cffcfaf60afb2f1334ffe2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 21:12:38 +0200 Subject: [PATCH 08/22] asd --- .github/workflows/build_and_test.yml | 5 +---- support/update-conan-profile.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 support/update-conan-profile.py diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f754573..aa8fce0 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -54,10 +54,7 @@ jobs: run: | pip install conan conan profile detect --name ci --force - sed -i 's/build_type=.*/build_type=${{ matrix.build_type }}/g' $(conan profile path ci) - sed -i 's/compiler.cppstd=.*/compiler.cppstd=${{ matrix.cxx_standard }}/g' $(conan profile path ci) - echo '[conf]' >> $(conan profile path ci) - echo 'tools.build:compiler_executables={"cpp": "${{ matrix.cxx_compiler }}", "c": "${{ matrix.c_compiler }}"}' >> $(conan profile path ci) + python $GITHUB_WORKSPACE/support/update-conan-profile $(conan profile path ci) ${{matrix.build_type}} ${{matrix.c_compiler}} ${{matrix.cxx_compiler}} ${{matrix.cxx_standard}} - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build diff --git a/support/update-conan-profile.py b/support/update-conan-profile.py new file mode 100644 index 0000000..9fb37d3 --- /dev/null +++ b/support/update-conan-profile.py @@ -0,0 +1,17 @@ +import pathlib +import sys +import re + +path = pathlib.Path(sys.argv[1]) +build_type = sys.argv[2] +c_compiler = sys.argv[3] +cxx_compiler = sys.argv[4] +cxx_standard = sys.argv[5] + +text = path.read_text() +text = re.sub("build_type=.*", f"build_type={build_type}", text) +text = re.sub("compiler.cppstd=.*", f"compiler.cppstd={cxx_standard}", text) +text = text + "\n[conf]" +text = "tools.build:compiler_executables={\"cpp\": \"{cxx_compiler}\", \"c\": \"{ c_compiler }\"}" +path.unlink() +path.write_text(text) \ No newline at end of file From 025a6dac76fdca66851c2c0acdd9e912f49f1675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 21:13:24 +0200 Subject: [PATCH 09/22] asd --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index aa8fce0..136f315 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -54,7 +54,7 @@ jobs: run: | pip install conan conan profile detect --name ci --force - python $GITHUB_WORKSPACE/support/update-conan-profile $(conan profile path ci) ${{matrix.build_type}} ${{matrix.c_compiler}} ${{matrix.cxx_compiler}} ${{matrix.cxx_standard}} + python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) ${{matrix.build_type}} ${{matrix.c_compiler}} ${{matrix.cxx_compiler}} ${{matrix.cxx_standard}} - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build From a90e738803269e5b0bc269a909491123ff7c769f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 21:14:41 +0200 Subject: [PATCH 10/22] asd --- support/update-conan-profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/update-conan-profile.py b/support/update-conan-profile.py index 9fb37d3..790a401 100644 --- a/support/update-conan-profile.py +++ b/support/update-conan-profile.py @@ -12,6 +12,6 @@ text = re.sub("build_type=.*", f"build_type={build_type}", text) text = re.sub("compiler.cppstd=.*", f"compiler.cppstd={cxx_standard}", text) text = text + "\n[conf]" -text = "tools.build:compiler_executables={\"cpp\": \"{cxx_compiler}\", \"c\": \"{ c_compiler }\"}" +text = f"tools.build:compiler_executables={{\"cpp\": \"{cxx_compiler}\", \"c\": \"{ c_compiler }\"}}" path.unlink() path.write_text(text) \ No newline at end of file From 5a68d82533e83c0d5e5621fac548a8c6537485bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Fri, 16 Jun 2023 21:19:47 +0200 Subject: [PATCH 11/22] asd --- support/update-conan-profile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/update-conan-profile.py b/support/update-conan-profile.py index 790a401..c92832e 100644 --- a/support/update-conan-profile.py +++ b/support/update-conan-profile.py @@ -12,6 +12,6 @@ text = re.sub("build_type=.*", f"build_type={build_type}", text) text = re.sub("compiler.cppstd=.*", f"compiler.cppstd={cxx_standard}", text) text = text + "\n[conf]" -text = f"tools.build:compiler_executables={{\"cpp\": \"{cxx_compiler}\", \"c\": \"{ c_compiler }\"}}" +text = text + f"\ntools.build:compiler_executables={{\"cpp\": \"{cxx_compiler}\", \"c\": \"{ c_compiler }\"}}" path.unlink() path.write_text(text) \ No newline at end of file From 4abff782ecd97fe005c30e7fa0bdf829e61cb287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 15:31:26 +0200 Subject: [PATCH 12/22] asd --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 136f315..3c5e8da 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -67,7 +67,7 @@ jobs: CXX: ${{matrix.cxx_compiler}} run: | conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} - cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake + cmake $GITHUB_WORKSPACE --preset conan-${{ matrix.build_type.toLowerCase() }} - name: Build working-directory: ${{runner.workspace}}/build From 5f239c87667d47a823494aa7353ee5c1a3f1abb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 15:43:46 +0200 Subject: [PATCH 13/22] remove faulty test, make pocketfft system header --- include/dspbb/Math/FFT.hpp | 4 +++- include/dspbb/PocketFFT/pocketfft_hdronly.h | 10 ++++++++++ test/Math/Test_Functions.cpp | 6 +++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/dspbb/Math/FFT.hpp b/include/dspbb/Math/FFT.hpp index 60245a6..8f612d7 100644 --- a/include/dspbb/Math/FFT.hpp +++ b/include/dspbb/Math/FFT.hpp @@ -1,10 +1,12 @@ #pragma once #include "../Math/Functions.hpp" -#include "../PocketFFT/pocketfft_hdronly.h" #include "../Primitives/Signal.hpp" #include "../Primitives/SignalView.hpp" +#pragma warning +#include "../PocketFFT/pocketfft_hdronly.h" + #include diff --git a/include/dspbb/PocketFFT/pocketfft_hdronly.h b/include/dspbb/PocketFFT/pocketfft_hdronly.h index ab82b6b..792a9ee 100644 --- a/include/dspbb/PocketFFT/pocketfft_hdronly.h +++ b/include/dspbb/PocketFFT/pocketfft_hdronly.h @@ -36,6 +36,16 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef _MSC_VER +#pragma system_header +#endif +#ifdef __GCC__ +#pragma GCC system_header +#endif +#ifdef __clang__ +#pragma clang system_header +#endif + #ifndef POCKETFFT_HDRONLY_H #define POCKETFFT_HDRONLY_H diff --git a/test/Math/Test_Functions.cpp b/test/Math/Test_Functions.cpp index ab34b66..e68ea49 100644 --- a/test/Math/Test_Functions.cpp +++ b/test/Math/Test_Functions.cpp @@ -115,6 +115,10 @@ TEST_CASE_FUNCTION_CPLX("Atanh", Atanh, atanh); // Hyperbolic functions TEST_CASE_FUNCTION_REAL("Erf", Erf, erf); -TEST_CASE_FUNCTION_REAL("Erfc", Erfc, erfc); +TEST_CASE("Erfc real", "[Functions]") { + SKIP("Skipped due to a bug in XSimd."); + // The actual test should be: + // TEST_CASE_FUNCTION_REAL("Erfc", Erfc, erfc); +} TEST_CASE_FUNCTION_REAL("TGamma", TGamma, tgamma); TEST_CASE_FUNCTION_REAL("LGamma", LGamma, lgamma); \ No newline at end of file From f8e2044903b50fd72e60f49677662e0ae90c870f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 15:57:10 +0200 Subject: [PATCH 14/22] asd --- .github/workflows/build_and_test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 3c5e8da..6824a2a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -29,6 +29,10 @@ jobs: test_name: .\Bin\UnitTest.exe - os: ubuntu-latest test_name: ./Bin/UnitTest + - build_type: Debug + conan_preset: "conan-debug" + - build_type: Release + conan_preset: "conan-release" exclude: - os: windows-latest c_compiler: gcc @@ -67,7 +71,7 @@ jobs: CXX: ${{matrix.cxx_compiler}} run: | conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} - cmake $GITHUB_WORKSPACE --preset conan-${{ matrix.build_type.toLowerCase() }} + cmake $GITHUB_WORKSPACE --preset ${{ matrix.conan_preset }} - name: Build working-directory: ${{runner.workspace}}/build From f686eec0143f5a1300f3d1e8ce1f571cb54dad0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 16:07:48 +0200 Subject: [PATCH 15/22] asd --- support/update-conan-profile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/support/update-conan-profile.py b/support/update-conan-profile.py index c92832e..bf5e0d9 100644 --- a/support/update-conan-profile.py +++ b/support/update-conan-profile.py @@ -13,5 +13,6 @@ text = re.sub("compiler.cppstd=.*", f"compiler.cppstd={cxx_standard}", text) text = text + "\n[conf]" text = text + f"\ntools.build:compiler_executables={{\"cpp\": \"{cxx_compiler}\", \"c\": \"{ c_compiler }\"}}" +text = text + "\ntools.cmake.cmaketoolchain:generator=Ninja" path.unlink() path.write_text(text) \ No newline at end of file From a7f59e6406e969b69e161a68c852902328e6ca6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 16:26:00 +0200 Subject: [PATCH 16/22] sonarqube --- .github/workflows/sonarqube.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 242f705..de33db6 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -30,8 +30,13 @@ jobs: java-version: 11 - name: Install conan shell: bash + env: + CC: clang + CXX: clang++ run: | pip install conan + conan profile detect --name ci --force + python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) Debug $CC $CXX 17 - name: Download and set up sonar-scanner env: @@ -59,7 +64,9 @@ jobs: env: CC: clang CXX: clang++ - run: cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_LLVM_COV=ON + run: | + conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=Debug + cmake $GITHUB_WORKSPACE --preset conan-debug - name: Run build-wrapper run: | From d1c43f553269ca8f4a065dc546bd3e78bc47b8df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 16:36:26 +0200 Subject: [PATCH 17/22] asd --- .github/workflows/sonarqube.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index de33db6..a687235 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -20,10 +20,6 @@ jobs: - uses: seanmiddleditch/gha-setup-vsdevenv@master with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - uses: KyleMayes/install-llvm-action@v1 - with: - version: "10.0" - directory: ${{ runner.temp }}/llvm - name: Set up JDK 11 uses: actions/setup-java@v1 with: From 2497620dcae3ef28dda46936628a41c948aa8f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 17:23:20 +0200 Subject: [PATCH 18/22] asd --- .github/workflows/sonarqube.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index a687235..a0db2ee 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -20,6 +20,10 @@ jobs: - uses: seanmiddleditch/gha-setup-vsdevenv@master with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: KyleMayes/install-llvm-action@v1 + with: + version: "15.0" + directory: ${{ runner.temp }}/llvm - name: Set up JDK 11 uses: actions/setup-java@v1 with: From a8b4684fdc849241c181be79e018b13818db0b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 17:35:15 +0200 Subject: [PATCH 19/22] asd --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index a0db2ee..ad154ee 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -66,7 +66,7 @@ jobs: CXX: clang++ run: | conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=Debug - cmake $GITHUB_WORKSPACE --preset conan-debug + cmake $GITHUB_WORKSPACE --preset conan-debug -DENABLE_LLVM_COV:BOOL=ON - name: Run build-wrapper run: | From 93a14f02615601056426aeac6c9ca7d9bcf06ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Wed, 21 Jun 2023 18:15:01 +0200 Subject: [PATCH 20/22] clang-format --- test/Filtering/IIR/Test_BandTransforms.cpp | 2 +- test/Filtering/IIR/Test_Kernels.cpp | 2 +- test/Filtering/IIR/Test_Realizations.cpp | 2 +- test/Filtering/Test_FIR.cpp | 2 +- test/Filtering/Test_IIR.cpp | 2 +- test/Filtering/Test_MeasureFilter.cpp | 2 +- test/Filtering/Test_Polyphase.cpp | 2 +- test/Filtering/Test_Resample.cpp | 2 +- test/Filtering/Test_Windowing.cpp | 2 +- test/Generators/Test_Generators.cpp | 2 +- test/Kernels/Test_Convolution.cpp | 2 +- test/Kernels/Test_Numeric.cpp | 2 +- test/LTISystems/Test_DiscretizationTransforms.cpp | 2 +- test/LTISystems/Test_Systems.cpp | 2 +- test/Math/Test_EllipticFunctions.cpp | 2 +- test/Math/Test_FFT.cpp | 2 +- test/Math/Test_Functions.cpp | 2 +- test/Math/Test_OverlapAdd.cpp | 2 +- test/Math/Test_Polynomials.cpp | 2 +- test/Math/Test_Rational.cpp | 2 +- test/Math/Test_RootTransforms.cpp | 2 +- test/Math/Test_Solvers.cpp | 2 +- test/Math/Test_Statistics.cpp | 2 +- test/Primitives/Test_SignalArithmetic.cpp | 4 ++-- test/TestUtils.hpp | 2 +- 25 files changed, 26 insertions(+), 26 deletions(-) diff --git a/test/Filtering/IIR/Test_BandTransforms.cpp b/test/Filtering/IIR/Test_BandTransforms.cpp index 797f58c..4dffd6d 100644 --- a/test/Filtering/IIR/Test_BandTransforms.cpp +++ b/test/Filtering/IIR/Test_BandTransforms.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include using namespace dspbb; using namespace std::complex_literals; diff --git a/test/Filtering/IIR/Test_Kernels.cpp b/test/Filtering/IIR/Test_Kernels.cpp index 1833a18..bae8aa1 100644 --- a/test/Filtering/IIR/Test_Kernels.cpp +++ b/test/Filtering/IIR/Test_Kernels.cpp @@ -2,8 +2,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Filtering/IIR/Test_Realizations.cpp b/test/Filtering/IIR/Test_Realizations.cpp index c09a63c..dcf0f6e 100644 --- a/test/Filtering/IIR/Test_Realizations.cpp +++ b/test/Filtering/IIR/Test_Realizations.cpp @@ -4,8 +4,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Filtering/Test_FIR.cpp b/test/Filtering/Test_FIR.cpp index 7a2a2af..4148842 100644 --- a/test/Filtering/Test_FIR.cpp +++ b/test/Filtering/Test_FIR.cpp @@ -7,8 +7,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Filtering/Test_IIR.cpp b/test/Filtering/Test_IIR.cpp index 57f4cb4..7393c81 100644 --- a/test/Filtering/Test_IIR.cpp +++ b/test/Filtering/Test_IIR.cpp @@ -4,8 +4,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Filtering/Test_MeasureFilter.cpp b/test/Filtering/Test_MeasureFilter.cpp index b865be4..a70ba40 100644 --- a/test/Filtering/Test_MeasureFilter.cpp +++ b/test/Filtering/Test_MeasureFilter.cpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include #include diff --git a/test/Filtering/Test_Polyphase.cpp b/test/Filtering/Test_Polyphase.cpp index 24d48a6..4eebfd3 100644 --- a/test/Filtering/Test_Polyphase.cpp +++ b/test/Filtering/Test_Polyphase.cpp @@ -1,8 +1,8 @@ #include "dspbb/Generators/Waveforms.hpp" #include -#include #include +#include using namespace dspbb; diff --git a/test/Filtering/Test_Resample.cpp b/test/Filtering/Test_Resample.cpp index 7004e15..fe083e7 100644 --- a/test/Filtering/Test_Resample.cpp +++ b/test/Filtering/Test_Resample.cpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include #include diff --git a/test/Filtering/Test_Windowing.cpp b/test/Filtering/Test_Windowing.cpp index 29e0718..a099c91 100644 --- a/test/Filtering/Test_Windowing.cpp +++ b/test/Filtering/Test_Windowing.cpp @@ -4,8 +4,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Generators/Test_Generators.cpp b/test/Generators/Test_Generators.cpp index 3c9e636..0fc6bff 100644 --- a/test/Generators/Test_Generators.cpp +++ b/test/Generators/Test_Generators.cpp @@ -4,8 +4,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Kernels/Test_Convolution.cpp b/test/Kernels/Test_Convolution.cpp index a61edf8..a9ef20f 100644 --- a/test/Kernels/Test_Convolution.cpp +++ b/test/Kernels/Test_Convolution.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Kernels/Test_Numeric.cpp b/test/Kernels/Test_Numeric.cpp index c726d14..16dba72 100644 --- a/test/Kernels/Test_Numeric.cpp +++ b/test/Kernels/Test_Numeric.cpp @@ -2,8 +2,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/LTISystems/Test_DiscretizationTransforms.cpp b/test/LTISystems/Test_DiscretizationTransforms.cpp index 494a140..0e4d24e 100644 --- a/test/LTISystems/Test_DiscretizationTransforms.cpp +++ b/test/LTISystems/Test_DiscretizationTransforms.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/LTISystems/Test_Systems.cpp b/test/LTISystems/Test_Systems.cpp index 08815b0..9281cba 100644 --- a/test/LTISystems/Test_Systems.cpp +++ b/test/LTISystems/Test_Systems.cpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Math/Test_EllipticFunctions.cpp b/test/Math/Test_EllipticFunctions.cpp index c500267..29f71c1 100644 --- a/test/Math/Test_EllipticFunctions.cpp +++ b/test/Math/Test_EllipticFunctions.cpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Math/Test_FFT.cpp b/test/Math/Test_FFT.cpp index 20593ae..2b9317f 100644 --- a/test/Math/Test_FFT.cpp +++ b/test/Math/Test_FFT.cpp @@ -8,8 +8,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Math/Test_Functions.cpp b/test/Math/Test_Functions.cpp index e68ea49..ca61981 100644 --- a/test/Math/Test_Functions.cpp +++ b/test/Math/Test_Functions.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include #include diff --git a/test/Math/Test_OverlapAdd.cpp b/test/Math/Test_OverlapAdd.cpp index 8ec6c26..4441df1 100644 --- a/test/Math/Test_OverlapAdd.cpp +++ b/test/Math/Test_OverlapAdd.cpp @@ -4,8 +4,8 @@ #include #include -#include #include +#include using namespace dspbb; diff --git a/test/Math/Test_Polynomials.cpp b/test/Math/Test_Polynomials.cpp index afa7ad2..c398b06 100644 --- a/test/Math/Test_Polynomials.cpp +++ b/test/Math/Test_Polynomials.cpp @@ -2,8 +2,8 @@ #include -#include #include +#include using namespace dspbb; diff --git a/test/Math/Test_Rational.cpp b/test/Math/Test_Rational.cpp index 3e12824..62e584a 100644 --- a/test/Math/Test_Rational.cpp +++ b/test/Math/Test_Rational.cpp @@ -1,7 +1,7 @@ #include -#include #include +#include #include diff --git a/test/Math/Test_RootTransforms.cpp b/test/Math/Test_RootTransforms.cpp index 3d3980f..4f26eb3 100644 --- a/test/Math/Test_RootTransforms.cpp +++ b/test/Math/Test_RootTransforms.cpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include #include diff --git a/test/Math/Test_Solvers.cpp b/test/Math/Test_Solvers.cpp index f3c0726..3444ac6 100644 --- a/test/Math/Test_Solvers.cpp +++ b/test/Math/Test_Solvers.cpp @@ -1,8 +1,8 @@ #include "dspbb/Utility/Numbers.hpp" #include -#include #include +#include using namespace dspbb; diff --git a/test/Math/Test_Statistics.cpp b/test/Math/Test_Statistics.cpp index d6e76c7..d7223ca 100644 --- a/test/Math/Test_Statistics.cpp +++ b/test/Math/Test_Statistics.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include #include diff --git a/test/Primitives/Test_SignalArithmetic.cpp b/test/Primitives/Test_SignalArithmetic.cpp index 0cdfa47..184d90a 100644 --- a/test/Primitives/Test_SignalArithmetic.cpp +++ b/test/Primitives/Test_SignalArithmetic.cpp @@ -5,9 +5,9 @@ #include #include -#include -#include #include +#include +#include using namespace dspbb; diff --git a/test/TestUtils.hpp b/test/TestUtils.hpp index 8443ded..5980ae3 100644 --- a/test/TestUtils.hpp +++ b/test/TestUtils.hpp @@ -3,8 +3,8 @@ #include #include -#include #include +#include #include #include From 94f4b064cd807eca5d000a7fc432ba154d65092a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Thu, 22 Jun 2023 13:38:00 +0200 Subject: [PATCH 21/22] cache conan packages --- .github/workflows/build_and_test.yml | 8 ++++++++ .github/workflows/sonarqube.yml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6824a2a..d7bc733 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -60,6 +60,13 @@ jobs: conan profile detect --name ci --force python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) ${{matrix.build_type}} ${{matrix.c_compiler}} ${{matrix.cxx_compiler}} ${{matrix.cxx_standard}} + - name: Cache conan packages + id: cache-conan + uses: actions/cache@v3 + with: + path: ~/.conan/p + key: conan-cache-packages-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ matrix.cxx_standard }} + - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -71,6 +78,7 @@ jobs: CXX: ${{matrix.cxx_compiler}} run: | conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} + conan cache clean cmake $GITHUB_WORKSPACE --preset ${{ matrix.conan_preset }} - name: Build diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index ad154ee..75a14de 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -38,6 +38,13 @@ jobs: conan profile detect --name ci --force python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) Debug $CC $CXX 17 + - name: Cache conan packages + id: cache-conan + uses: actions/cache@v3 + with: + path: ~/.conan/p + key: conan-cache-packages-sonarqube + - name: Download and set up sonar-scanner env: SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip @@ -66,6 +73,7 @@ jobs: CXX: clang++ run: | conan install $GITHUB_WORKSPACE --output-folder=. --build=missing -pr ci -pr:b ci -s build_type=Debug + conan cache clean cmake $GITHUB_WORKSPACE --preset conan-debug -DENABLE_LLVM_COV:BOOL=ON - name: Run build-wrapper From 86fb4561dd6b0fe3fb2f1c5a3a34badff070f613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Thu, 22 Jun 2023 13:54:33 +0200 Subject: [PATCH 22/22] new hash --- .github/workflows/build_and_test.yml | 2 +- .github/workflows/sonarqube.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d7bc733..9129484 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -64,7 +64,7 @@ jobs: id: cache-conan uses: actions/cache@v3 with: - path: ~/.conan/p + path: ~/.conan2/p key: conan-cache-packages-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ matrix.cxx_standard }} - name: Create Build Environment diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 75a14de..d79c210 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -42,7 +42,7 @@ jobs: id: cache-conan uses: actions/cache@v3 with: - path: ~/.conan/p + path: ~/.conan2/p key: conan-cache-packages-sonarqube - name: Download and set up sonar-scanner