Skip to content
Permalink
Browse files

KFR 3.0.5

  • Loading branch information...
dlevin256 committed Feb 21, 2019
1 parent da99a81 commit b6320ef16497bcbfe26f0bd107c3f4b9ca3278a3
Showing with 16,747 additions and 11,259 deletions.
  1. +1 −1 .gitignore
  2. +22 −0 CHANGELOG.md
  3. +122 −53 CMakeLists.txt
  4. +14 −12 azure-pipelines.yml
  5. +3 −1 cmake/arm.cmake
  6. +9 −0 cmake/detect_cpu.cpp
  7. +56 −0 cmake/target_set_arch.cmake
  8. +0 −3 cmake/test_toolset/CMakeLists.txt
  9. +11 −12 examples/CMakeLists.txt
  10. +2 −0 examples/biquads.cpp
  11. +2 −0 examples/fir.cpp
  12. +2 −0 examples/sample_rate_conversion.cpp
  13. +2 −0 examples/window.cpp
  14. +0 −1 include/kfr/all.hpp
  15. +4 −29 include/kfr/base.hpp
  16. +130 −90 include/kfr/base/basic_expressions.hpp
  17. +0 −136 include/kfr/base/bitwise.hpp
  18. +0 −967 include/kfr/base/complex.hpp
  19. +0 −299 include/kfr/base/constants.hpp
  20. +8 −4 include/kfr/base/conversion.hpp
  21. +107 −112 include/kfr/base/expression.hpp
  22. +6 −3 include/kfr/base/filter.hpp
  23. +1 −2 include/kfr/base/fraction.hpp
  24. +0 −268 include/kfr/base/function.hpp
  25. +30 −0 include/kfr/base/function_expressions.hpp
  26. +48 −38 include/kfr/base/generators.hpp
  27. +0 −126 include/kfr/base/impl/abs.hpp
  28. +0 −289 include/kfr/base/impl/logical.hpp
  29. +0 −232 include/kfr/base/impl/min_max.hpp
  30. +0 −255 include/kfr/base/impl/round.hpp
  31. +0 −192 include/kfr/base/impl/saturation.hpp
  32. +0 −261 include/kfr/base/impl/select.hpp
  33. +0 −18 include/kfr/base/intrinsics.h
  34. +0 −46 include/kfr/base/kfr.h
  35. +37 −29 include/kfr/base/memory.hpp
  36. +0 −552 include/kfr/base/operators.hpp
  37. +0 −186 include/kfr/base/platform.hpp
  38. +52 −43 include/kfr/base/pointer.hpp
  39. +45 −41 include/kfr/base/random.hpp
  40. +40 −32 include/kfr/base/reduce.hpp
  41. +0 −350 include/kfr/base/simd_clang.hpp
  42. +0 −392 include/kfr/base/simd_intrin.hpp
  43. +0 −272 include/kfr/base/simd_x86.hpp
  44. +3 −4 include/kfr/base/small_buffer.hpp
  45. +11 −7 include/kfr/base/sort.hpp
  46. +0 −429 include/kfr/base/types.hpp
  47. +74 −59 include/kfr/base/univector.hpp
  48. +0 −1,171 include/kfr/base/vec.hpp
  49. +62 −16 include/kfr/cident.h
  50. +439 −121 include/kfr/cometa.hpp
  51. +33 −32 include/kfr/cometa/array.hpp
  52. +25 −25 include/kfr/cometa/cstring.hpp
  53. +17 −6 include/kfr/cometa/ctti.hpp
  54. +17 −17 include/kfr/cometa/function.hpp
  55. +2 −2 include/kfr/cometa/named_arg.hpp
  56. +194 −0 include/kfr/cometa/numeric.hpp
  57. +18 −15 include/kfr/cometa/range.hpp
  58. +7 −6 include/kfr/cometa/result.hpp
  59. +4 −4 include/kfr/cometa/string.hpp
  60. +3 −0 include/kfr/dft/cache.hpp
  61. +15 −13 include/kfr/dft/convolution.hpp
  62. 0 include/kfr/{ → dft}/data/bitrev.hpp
  63. +2 −2 include/kfr/{ → dft}/data/sincos.hpp
  64. +30 −19 include/kfr/dft/fft.hpp
  65. +24 −21 include/kfr/dft/impl/bitrev.hpp
  66. +14 −12 include/kfr/dft/impl/convolution-impl.cpp
  67. +123 −0 include/kfr/dft/impl/dft-fft.hpp
  68. +84 −1,227 include/kfr/dft/impl/dft-impl.hpp
  69. +12 −12 include/kfr/dft/impl/dft-src.cpp
  70. +6 −12 include/kfr/dft/impl/dft-templates.hpp
  71. +29 −0 include/kfr/dft/impl/fft-impl-f32.cpp
  72. +29 −0 include/kfr/dft/impl/fft-impl-f64.cpp
  73. +1,148 −0 include/kfr/dft/impl/fft-impl.hpp
  74. +50 −0 include/kfr/dft/impl/fft-templates.hpp
  75. +237 −225 include/kfr/dft/impl/ft.hpp
  76. +4 −4 include/kfr/dft/reference_dft.hpp
  77. +0 −1 include/kfr/dsp.hpp
  78. +72 −56 include/kfr/dsp/biquad.hpp
  79. +12 −9 include/kfr/dsp/biquad_design.hpp
  80. +5 −2 include/kfr/dsp/dcremove.hpp
  81. +32 −25 include/kfr/dsp/delay.hpp
  82. +43 −15 include/kfr/dsp/ebu.hpp
  83. +32 −25 include/kfr/dsp/fir.hpp
  84. +35 −32 include/kfr/dsp/fir_design.hpp
  85. +6 −2 include/kfr/dsp/fracdelay.hpp
  86. +14 −10 include/kfr/dsp/goertzel.hpp
  87. +8 −4 include/kfr/dsp/mixdown.hpp
  88. +50 −46 include/kfr/dsp/oscillators.hpp
  89. +80 −60 include/kfr/dsp/sample_rate_conversion.hpp
  90. +4 −1 include/kfr/dsp/speaker.hpp
  91. +12 −8 include/kfr/dsp/special.hpp
  92. +29 −26 include/kfr/dsp/units.hpp
  93. +12 −8 include/kfr/dsp/waveshaper.hpp
  94. +19 −15 include/kfr/dsp/weighting.hpp
  95. +74 −54 include/kfr/dsp/window.hpp
  96. +0 −86 include/kfr/ext/double_double.hpp
  97. +29 −25 include/kfr/io/audiofile.hpp
  98. +24 −3 include/kfr/io/file.hpp
  99. +4 −0 include/kfr/io/impl/audiofile-impl.cpp
  100. +10 −10 include/kfr/io/python_plot.hpp
  101. +50 −3 include/kfr/io/tostring.hpp
  102. +70 −0 include/kfr/kfr.h
  103. +21 −1 include/kfr/math.hpp
  104. +8 −3 include/kfr/{base → math}/abs.hpp
  105. +9 −5 include/kfr/{base → math}/asin_acos.hpp
  106. +12 −9 include/kfr/{base → math}/atan.hpp
  107. +8 −5 include/kfr/{base → math}/clamp.hpp
  108. +3 −3 include/kfr/{base → math}/compiletime.hpp
  109. +410 −0 include/kfr/math/complex_math.hpp
  110. +8 −5 include/kfr/{base → math}/gamma.hpp
  111. +16 −13 include/kfr/{base → math}/hyperbolic.hpp
  112. +138 −0 include/kfr/math/impl/abs.hpp
  113. +12 −12 include/kfr/{base → math}/impl/asin_acos.hpp
  114. +26 −25 include/kfr/{base → math}/impl/atan.hpp
  115. +7 −8 include/kfr/{base → math}/impl/clamp.hpp
  116. +10 −11 include/kfr/{base → math}/impl/gamma.hpp
  117. +22 −23 include/kfr/{base → math}/impl/hyperbolic.hpp
  118. +88 −68 include/kfr/{base → math}/impl/log_exp.hpp
  119. +278 −0 include/kfr/math/impl/logical.hpp
  120. +236 −0 include/kfr/math/impl/min_max.hpp
  121. +7 −8 include/kfr/{base → math}/impl/modzerobessel.hpp
  122. +282 −0 include/kfr/math/impl/round.hpp
  123. +205 −0 include/kfr/math/impl/saturation.hpp
  124. +329 −0 include/kfr/math/impl/select.hpp
  125. +70 −98 include/kfr/{base → math}/impl/sin_cos.hpp
  126. +20 −19 include/kfr/{base → math}/impl/sqrt.hpp
  127. +50 −42 include/kfr/{base → math}/impl/tan.hpp
  128. +11 −9 include/kfr/{dsp → math}/interpolation.hpp
  129. +45 −42 include/kfr/{base → math}/log_exp.hpp
  130. +7 −3 include/kfr/{base → math}/logical.hpp
  131. +17 −13 include/kfr/{base → math}/min_max.hpp
  132. +6 −3 include/kfr/{base → math}/modzerobessel.hpp
  133. +27 −22 include/kfr/{base → math}/round.hpp
  134. +8 −5 include/kfr/{base → math}/saturation.hpp
  135. +7 −5 include/kfr/{base → math}/select.hpp
  136. +56 −53 include/kfr/{base → math}/sin_cos.hpp
  137. +6 −3 include/kfr/{base → math}/sqrt.hpp
  138. +8 −5 include/kfr/{base → math}/tan.hpp
  139. +2 −2 include/kfr/{cpuid.hpp → runtime.hpp}
  140. +12 −9 include/kfr/{cpuid → runtime}/cpuid.hpp
  141. +8 −6 include/kfr/{cpuid → runtime}/cpuid_auto.hpp
  142. +36 −0 include/kfr/simd.hpp
  143. +19 −16 include/kfr/{base → simd}/comparison.hpp
  144. +468 −0 include/kfr/simd/complex.hpp
  145. +160 −0 include/kfr/simd/constants.hpp
  146. +8 −5 include/kfr/{base → simd}/digitreverse.hpp
  147. +40 −21 include/kfr/{base → simd}/horizontal.hpp
  148. +79 −0 include/kfr/simd/impl/backend.hpp
  149. +228 −0 include/kfr/simd/impl/backend_clang.hpp
  150. +1,080 −0 include/kfr/simd/impl/backend_generic.hpp
  151. +178 −0 include/kfr/simd/impl/basicoperators_clang.hpp
  152. +1,674 −0 include/kfr/simd/impl/basicoperators_generic.hpp
  153. +295 −0 include/kfr/simd/impl/function.hpp
  154. +50 −0 include/kfr/simd/impl/intrinsics.h
  155. +164 −0 include/kfr/simd/impl/operators.hpp
  156. +183 −0 include/kfr/simd/impl/simd.hpp
  157. +19 −12 include/kfr/{base → simd/impl}/specializations.i
  158. +155 −0 include/kfr/simd/mask.hpp
  159. +810 −0 include/kfr/simd/operators.hpp
  160. +286 −0 include/kfr/simd/platform.hpp
  161. +32 −28 include/kfr/{base → simd}/read_write.hpp
  162. +179 −235 include/kfr/{base → simd}/shuffle.hpp
  163. +372 −0 include/kfr/simd/types.hpp
  164. +1,283 −0 include/kfr/simd/vec.hpp
  165. +4 −1 include/kfr/testo/assert.hpp
  166. +32 −6 include/kfr/testo/comparison.hpp
  167. +5 −1 include/kfr/{ext → testo}/console_colors.hpp
  168. +170 −0 include/kfr/testo/double_double.hpp
  169. +92 −26 include/kfr/testo/testo.hpp
  170. +1 −2 include/kfr/version.hpp
  171. +111 −60 sources.cmake
  172. +82 −39 tests/CMakeLists.txt
  173. +19 −1 tests/all_tests.cpp
  174. +25 −0 tests/all_tests_merged.cpp
  175. +213 −0 tests/asm_test.cpp
  176. +5 −341 tests/base_test.cpp
  177. +8 −10 tests/complex_test.cpp
  178. BIN tests/data/acos_double_fuzz
  179. BIN tests/data/acos_double_narrow
  180. BIN tests/data/acos_float_fuzz
  181. BIN tests/data/acos_float_narrow
  182. BIN tests/data/asin_double_fuzz
  183. BIN tests/data/asin_double_narrow
  184. BIN tests/data/asin_float_fuzz
  185. BIN tests/data/asin_float_narrow
  186. BIN tests/data/atan2_double_fuzz
  187. BIN tests/data/atan2_double_narrow
  188. BIN tests/data/atan2_float_fuzz
  189. BIN tests/data/atan2_float_narrow
  190. BIN tests/data/atan_double_fuzz
  191. BIN tests/data/atan_double_narrow
  192. BIN tests/data/atan_float_fuzz
  193. BIN tests/data/atan_float_narrow
  194. BIN tests/data/cbrt_double_fuzz
  195. BIN tests/data/cbrt_double_narrow
  196. BIN tests/data/cbrt_float_fuzz
  197. BIN tests/data/cbrt_float_narrow
  198. BIN tests/data/cos_double_fuzz
  199. BIN tests/data/cos_double_narrow
  200. BIN tests/data/cos_float_fuzz
  201. BIN tests/data/cos_float_narrow
  202. BIN tests/data/cosh_double_fuzz
  203. BIN tests/data/cosh_double_narrow
  204. BIN tests/data/cosh_float_fuzz
  205. BIN tests/data/cosh_float_narrow
  206. BIN tests/data/coth_double_fuzz
  207. BIN tests/data/coth_double_narrow
  208. BIN tests/data/coth_float_fuzz
  209. BIN tests/data/coth_float_narrow
  210. BIN tests/data/exp10_double_fuzz
  211. BIN tests/data/exp10_double_narrow
  212. BIN tests/data/exp10_float_fuzz
  213. BIN tests/data/exp10_float_narrow
  214. BIN tests/data/exp2_double_fuzz
  215. BIN tests/data/exp2_double_narrow
  216. BIN tests/data/exp2_float_fuzz
  217. BIN tests/data/exp2_float_narrow
  218. BIN tests/data/exp_double_fuzz
  219. BIN tests/data/exp_double_narrow
  220. BIN tests/data/exp_float_fuzz
  221. BIN tests/data/exp_float_narrow
  222. BIN tests/data/gamma_double_fuzz
  223. BIN tests/data/gamma_double_narrow
  224. BIN tests/data/gamma_float_fuzz
  225. BIN tests/data/gamma_float_narrow
  226. BIN tests/data/log10_double_fuzz
  227. BIN tests/data/log10_double_narrow
  228. BIN tests/data/log10_float_fuzz
  229. BIN tests/data/log10_float_narrow
  230. BIN tests/data/log2_double_fuzz
  231. BIN tests/data/log2_double_narrow
  232. BIN tests/data/log2_float_fuzz
  233. BIN tests/data/log2_float_narrow
  234. BIN tests/data/log_double_fuzz
  235. BIN tests/data/log_double_narrow
  236. BIN tests/data/log_float_fuzz
  237. BIN tests/data/log_float_narrow
  238. BIN tests/data/sin_double_fuzz
  239. BIN tests/data/sin_double_narrow
  240. BIN tests/data/sin_float_fuzz
  241. BIN tests/data/sin_float_narrow
  242. BIN tests/data/sinh_double_fuzz
  243. BIN tests/data/sinh_double_narrow
  244. BIN tests/data/sinh_float_fuzz
  245. BIN tests/data/sinh_float_narrow
  246. BIN tests/data/tan_double_fuzz
  247. BIN tests/data/tan_double_narrow
  248. BIN tests/data/tan_float_fuzz
  249. BIN tests/data/tan_float_narrow
  250. BIN tests/data/tanh_double_fuzz
  251. BIN tests/data/tanh_double_narrow
  252. BIN tests/data/tanh_float_fuzz
  253. BIN tests/data/tanh_float_narrow
  254. +58 −53 tests/dft_test.cpp
  255. +191 −17 tests/dsp_test.cpp
  256. +0 −5 tests/empty_test.cpp
  257. +23 −8 tests/expression_test.cpp
  258. +114 −0 tests/generate_data.cpp
  259. +29 −261 tests/intrinsic_test.cpp
  260. +9 −6 tests/io_test.cpp
  261. +16 −9 tests/mpfr/mpfrplus.hpp
  262. +0 −1 tests/multiarch.cpp
  263. +123 −0 tests/numeric_tests.hpp
  264. +0 −37 tests/resampler_test.cpp
  265. +0 −172 tests/transcendental_test.cpp
  266. +67 −0 tests/unit/base/conversion.cpp
  267. +41 −0 tests/unit/base/reduce.cpp
  268. +13 −0 tests/unit/math/abs.cpp
  269. +18 −0 tests/unit/math/asin_acos.cpp
  270. +18 −0 tests/unit/math/atan.cpp
  271. +21 −0 tests/unit/math/hyperbolic.cpp
  272. +23 −0 tests/unit/math/log_exp.cpp
  273. +39 −0 tests/unit/math/min_max.cpp
  274. +53 −0 tests/unit/math/round.cpp
  275. +27 −0 tests/unit/math/select.cpp
  276. +17 −0 tests/unit/math/sin_cos.cpp
  277. +16 −0 tests/unit/math/tan.cpp
  278. +33 −0 tests/unit/simd/complex.cpp
  279. +220 −0 tests/unit/simd/operators.cpp
  280. +160 −0 tests/unit/simd/shuffle.cpp
  281. +114 −0 tests/unit/simd/vec.cpp
  282. +28 −0 tools/CMakeLists.txt
  283. +0 −2 {tests → tools}/ebu_test.cpp
  284. 0 {examples → tools}/sample_rate_converter.cpp
  285. +20 −12 update-sources.py
@@ -77,7 +77,7 @@ var/
venv/


# Sphinx documentation
# Documentation
docs/
mkdocs/

@@ -1,5 +1,26 @@
# Changelog

## 3.0.5

2019-02-21

#### Added

- DFT speeds have been improved by up to 15% on most modern cpus
- Support for MSVC 2017
- Support for GCC 7.3
- Support for GCC 8.2
- Support for resampling complex vectors (Thanks to https://github.com/ermito)
- Tests for various math functions no longer depend on MPFR

#### Changed

- Testo now allocates much less memory during long tests (x3 less than previously)

#### Fixed

- Building generators (Thanks to https://github.com/ermito)

## 3.0.4

2019-01-08
@@ -9,6 +30,7 @@
#### Changed

- KFR_READCYCLECOUNTER may be redefined to point to any function returning (pseudo-)random value
- Ability to disable random number initialization functions

#### Fixed

@@ -15,15 +15,33 @@
# along with KFR.


cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.1)

message(STATUS CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS})

set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS}" CACHE STRING "compile flags" FORCE)

message(STATUS CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS})

project(kfr CXX)

message(STATUS "C++ compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} ${CMAKE_CXX_COMPILER} ")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

message(STATUS "C++ compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} ${CMAKE_CXX_COMPILER} ")
message(STATUS CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR})

if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
set (X86 TRUE)
else ()
set (X86 FALSE)
endif ()

if (X86)
message(STATUS X86)
endif ()

if (MSVC)
message(STATUS MSVC)
endif()
@@ -34,77 +52,128 @@ else()
set(CLANG 0)
endif()

# Include list of source files
# Include autogenerated list of source files
include(sources.cmake)

add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
option(ENABLE_TESTS "Enable tests and examples" OFF)
if (CLANG)
option(ENABLE_DFT "Enable DFT and related algorithms. Requires Clang" ON)
endif ()
option(ENABLE_ASMTEST "Enable writing disassembly" OFF)
option(REGENERATE_TESTS "Regenerate auto tests" OFF)
option(DISABLE_CLANG_EXTENSIONS "Disable Clang vector extensions" OFF)
option(KFR_EXTENDED_TESTS "Extended tests (up to hour)" OFF)
mark_as_advanced(ENABLE_ASMTEST)
mark_as_advanced(REGENERATE_TESTS)
mark_as_advanced(DISABLE_CLANG_EXTENSIONS)

if (NOT CPU_ARCH)
set(CPU_ARCH avx2)
endif ()

option(ENABLE_TESTS "Enable tests and examples. This changes many compiler flags" OFF)
option(ENABLE_DFT "Enable DFT and related algorithms" ON)
if (CPU_ARCH STREQUAL "detect")
message(STATUS "Detecting native cpu...")
try_run(
RUN_RESULT COMPILE_RESULT
"${CMAKE_BINARY_DIR}/tmpdir"
${CMAKE_SOURCE_DIR}/cmake/detect_cpu.cpp
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CMAKE_SOURCE_DIR}/include"
COMPILE_OUTPUT_VARIABLE COMPILE_OUT
RUN_OUTPUT_VARIABLE RUN_OUT
)
if (COMPILE_RESULT AND RUN_RESULT EQUAL 0)
message(STATUS DETECTED_CPU = ${RUN_OUT})
set(CPU_ARCH ${RUN_OUT})
else()
message(STATUS COMPILE_RESULT = ${COMPILE_RESULT})
message(STATUS RUN_RESULT = ${RUN_RESULT})
message(STATUS COMPILE_OUT = ${COMPILE_OUT})
message(STATUS RUN_OUT = ${RUN_OUT})
endif ()
endif ()

set(KFR_DFT_SRC
${CMAKE_CURRENT_SOURCE_DIR}/include/kfr/dft/impl/dft-src.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/kfr/dft/dft_c.h
${CMAKE_CURRENT_SOURCE_DIR}/include/kfr/dft/impl/dft-impl-f32.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/kfr/dft/impl/dft-impl-f64.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/kfr/dft/impl/convolution-impl.cpp)
include(cmake/target_set_arch.cmake)

set(KFR_IO_SRC
${CMAKE_CURRENT_SOURCE_DIR}/include/kfr/io/impl/audiofile-impl.cpp)
add_library(use_arch INTERFACE)
target_set_arch(use_arch INTERFACE ${CPU_ARCH})

if (ENABLE_TESTS)
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
endif()

if (IOS)
set(STD_LIB)
else ()
set(STD_LIB stdc++)
endif ()
if (IOS)
set(STD_LIB)
else ()
set(STD_LIB stdc++)
endif ()

# KFR library
add_library(kfr INTERFACE)
target_sources(kfr INTERFACE ${KFR_SRC})
target_include_directories(kfr INTERFACE include)
target_compile_options(kfr INTERFACE "$<$<CONFIG:DEBUG>:-DKFR_DEBUG>")
if (NOT MSVC)
target_compile_options(kfr INTERFACE -mstackrealign)
endif ()
if (MSVC)
target_compile_options(kfr INTERFACE -bigobj)
else ()
target_link_libraries(kfr INTERFACE ${STD_LIB} pthread m)
endif ()
if (DISABLE_CLANG_EXTENSIONS)
target_compile_definitions(kfr INTERFACE -DCMT_DISABLE_CLANG_EXT)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(kfr INTERFACE -Wno-ignored-qualifiers)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(kfr INTERFACE -Wno-c++1z-extensions)
endif ()

# Binary output directories
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin)
if (NOT ENABLE_DFT)
target_compile_definitions(kfr INTERFACE -DKFR_NO_DFT)
endif ()
if (KFR_EXTENDED_TESTS)
target_compile_definitions(kfr INTERFACE -DKFR_EXTENDED_TESTS)
endif()

add_definitions(-D_CRT_SECURE_NO_WARNINGS)
message(STATUS CPU_ARCH=${CPU_ARCH})

if (NOT MSVC OR CLANG)
# Enable C++14, disable exceptions and rtti
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-std=gnu++1y)
else ()
add_compile_options(-std=c++1y)
endif ()
add_compile_options(-fno-exceptions -fno-rtti )
if (NOT ARCH_FLAGS)
add_compile_options(-march=native)
message(STATUS "Building for native cpu")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign -fno-asynchronous-unwind-tables")
endif()
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAGS}")
endif ()
if(NOT MSVC)
link_libraries(${STD_LIB} pthread m)
endif()
else ()
# Disable exceptions
add_compile_options(/EHsc /D_HAS_EXCEPTIONS=0 /D_CRT_SECURE_NO_WARNINGS=1)
add_compile_options(/arch:AVX)
if (ENABLE_TESTS)

if (MSVC)
else()
# disable exceptions and rtti
add_compile_options(-fno-exceptions -fno-rtti -fno-asynchronous-unwind-tables)
endif ()

add_subdirectory(examples)
add_subdirectory(tests)
add_subdirectory(tools)
endif ()

add_library(kfr INTERFACE)
target_sources(kfr INTERFACE ${KFR_SRC})
target_include_directories(kfr INTERFACE include)

if (ENABLE_DFT)
if (NOT CLANG)
message(FATAL_ERROR "Clang compiler is required for DFT in KFR. See README.md for more information")
endif()
add_library(kfr_dft ${KFR_DFT_SRC})
target_link_libraries(kfr_dft kfr)
target_link_libraries(kfr_dft kfr use_arch)
if (MSVC)
target_compile_options(kfr_dft PRIVATE -fp:fast)
else()
target_compile_options(kfr_dft PRIVATE -ffast-math)
endif()
endif()

add_library(kfr_io ${KFR_IO_SRC})
target_link_libraries(kfr_io kfr)
target_compile_definitions(kfr_io PUBLIC KFR_ENABLE_FLAC=1)

install(TARGETS kfr kfr_io ARCHIVE DESTINATION lib)

if (ENABLE_DFT)
install(TARGETS kfr_dft ARCHIVE DESTINATION lib)
endif ()

install(DIRECTORY include/kfr DESTINATION include)
@@ -6,7 +6,7 @@ jobs:
- bash: |
set -e
sudo apt-get update && sudo apt-get install -y ninja-build libmpfr-dev
ci/run.sh build-release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release
ci/run.sh build-release -DCPU_ARCH=detect -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release
- job: Linux_x86_64_Clang_Debug
pool:
@@ -15,7 +15,7 @@ jobs:
- bash: |
set -e
sudo apt-get update && sudo apt-get install -y ninja-build libmpfr-dev
ci/run.sh build-debug -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug
ci/run.sh build-debug -DCPU_ARCH=detect -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug
- job: Linux_ARM_Clang_Release
pool:
@@ -46,7 +46,7 @@ jobs:
set -e
/bin/bash -c "sudo xcode-select -s /Applications/Xcode_$(XCODE_VER).app/Contents/Developer"
brew install ninja
ci/run.sh build-release -DCMAKE_BUILD_TYPE=Release
ci/run.sh build-release -DCPU_ARCH=detect -DCMAKE_BUILD_TYPE=Release
- job: macOS_x86_64_Clang_Debug
strategy:
@@ -62,7 +62,7 @@ jobs:
set -e
/bin/bash -c "sudo xcode-select -s /Applications/Xcode_$(XCODE_VER).app/Contents/Developer"
brew install ninja
ci/run.sh build-release -DCMAKE_BUILD_TYPE=Release
ci/run.sh build-release -DCPU_ARCH=detect -DCMAKE_BUILD_TYPE=Release
- job: Windows_MSVC_x86_64_Clang_Release
pool:
@@ -73,7 +73,7 @@ jobs:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
set PATH=%PATH:C:\tools\mingw64\bin;=%
set PATH=%PATH:C:\Program Files\Git\mingw64\bin;=%
ci\run.cmd build-release -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DARCH_FLAGS=-mavx -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_BUILD_TYPE=Release
ci\run.cmd build-release -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCPU_ARCH=detect -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_BUILD_TYPE=Release
- job: Windows_MSVC_x86_Clang_Release
pool:
@@ -84,7 +84,7 @@ jobs:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
set PATH=%PATH:C:\tools\mingw64\bin;=%
set PATH=%PATH:C:\Program Files\Git\mingw64\bin;=%
ci\run.cmd build-release -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DARCH_FLAGS=-mavx -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_BUILD_TYPE=Release
ci\run.cmd build-release -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCPU_ARCH=detect -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_BUILD_TYPE=Release
- job: Windows_MSVC_x86_Clang_Debug
pool:
@@ -95,32 +95,34 @@ jobs:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
set PATH=%PATH:C:\tools\mingw64\bin;=%
set PATH=%PATH:C:\Program Files\Git\mingw64\bin;=%
ci\run.cmd build-debug -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DARCH_FLAGS=-mavx -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_BUILD_TYPE=Debug
ci\run.cmd build-debug -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCPU_ARCH=detect -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_BUILD_TYPE=Debug
- job: Windows_MinGW_x86_64_AVX512_Clang_Release
pool: WIN-AVX512
steps:
- script: |
set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;%PATH%
bash -c "ci/run.sh build-release -DCMAKE_CXX_COMPILER=/c/LLVM/bin/clang++.exe -DCMAKE_CXX_FLAGS=--target=x86_64-w64-windows-gnu -DCMAKE_BUILD_TYPE=Release"
bash -c "ci/run.sh build-release -DCMAKE_CXX_COMPILER=/c/LLVM/bin/clang++.exe -DCPU_ARCH=avx512 -DCMAKE_CXX_FLAGS=--target=x86_64-w64-windows-gnu -DCMAKE_BUILD_TYPE=Release"
- job: Windows_MinGW_x86_64_AVX512_Clang_Debug
pool: WIN-AVX512
steps:
- script: |
set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;%PATH%
bash -c "ci/run.sh build-debug -DCMAKE_CXX_COMPILER=/c/LLVM/bin/clang++.exe -DCMAKE_CXX_FLAGS=--target=x86_64-w64-windows-gnu -DCMAKE_BUILD_TYPE=Debug"
bash -c "ci/run.sh build-debug -DCMAKE_CXX_COMPILER=/c/LLVM/bin/clang++.exe -DCPU_ARCH=avx512 -DCMAKE_CXX_FLAGS=--target=x86_64-w64-windows-gnu -DCMAKE_BUILD_TYPE=Debug"
- job: Windows_MSVC_x86_64_AVX512_Clang_Release
pool: WIN-AVX512
steps:
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
ci\run.cmd build-release -DARCH_TESTS=ON -DCMAKE_CXX_COMPILER="C:/LLVM/bin/clang-cl.exe" -DARCH_FLAGS="-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl" -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_BUILD_TYPE=Release
set CXXFLAGS=-m64
ci\run.cmd build-release -DARCH_TESTS=ON -DCMAKE_CXX_COMPILER="C:/LLVM/bin/clang-cl.exe" -DCPU_ARCH=avx512 -DCMAKE_BUILD_TYPE=Release
- job: Windows_MSVC_x86_64_AVX512_Clang_Debug
pool: WIN-AVX512
steps:
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
ci\run.cmd build-debug -DARCH_TESTS=ON -DCMAKE_CXX_COMPILER="C:/LLVM/bin/clang-cl.exe" -DARCH_FLAGS="-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl" -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_BUILD_TYPE=Debug
set CXXFLAGS=-m64
ci\run.cmd build-debug -DARCH_TESTS=ON -DCMAKE_CXX_COMPILER="C:/LLVM/bin/clang-cl.exe" -DCPU_ARCH=avx512 -DCMAKE_BUILD_TYPE=Debug
@@ -11,7 +11,9 @@ set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)

set (ARM_ROOT "/usr/arm-linux-gnueabihf/include")
set (GCC_VER 5.4.0)
if (NOT GCC_VER)
set (GCC_VER 5.4.0)
endif ()
set (SYS_PATHS "-isystem ${ARM_ROOT}/c++/${GCC_VER} -isystem ${ARM_ROOT}/c++/${GCC_VER}/backward -isystem ${ARM_ROOT}/c++/${GCC_VER}/arm-linux-gnueabihf -isystem ${ARM_ROOT}")

set (ARM_COMMON_FLAGS "-target arm-linux-gnueabihf -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard -static")
@@ -0,0 +1,9 @@
#include <kfr/runtime/cpuid.hpp>

using namespace kfr;

int main()
{
cpu_t cpu = kfr::internal_generic::detect_cpu();
printf("%s", cpu_name(cpu));
}
Oops, something went wrong.

0 comments on commit b6320ef

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.