-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (46 loc) · 2.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.20)
project(chowdsp_fft)
add_library(chowdsp_fft STATIC)
target_sources(chowdsp_fft
PRIVATE
chowdsp_fft.h
chowdsp_fft.cpp
)
target_include_directories(chowdsp_fft PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(chowdsp_fft PRIVATE _USE_MATH_DEFINES=1)
target_compile_features(chowdsp_fft PRIVATE cxx_std_17)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("/arch:AVX2" COMPILER_OPT_ARCH_AVX_MSVC_SUPPORTED)
CHECK_CXX_COMPILER_FLAG("-mavx -mfma" COMPILER_OPT_ARCH_AVX_GCC_CLANG_SUPPORTED)
if(COMPILER_OPT_ARCH_AVX_MSVC_SUPPORTED)
message(STATUS "chowdsp_fft -- Compiler supports flags: /arch:AVX2")
add_library(chowdsp_fft_avx STATIC simd/chowdsp_fft_impl_avx.cpp)
target_compile_options(chowdsp_fft_avx PRIVATE /arch:AVX2)
target_compile_definitions(chowdsp_fft_avx PRIVATE _USE_MATH_DEFINES=1)
target_compile_features(chowdsp_fft_avx PRIVATE cxx_std_17)
target_link_libraries(chowdsp_fft PRIVATE chowdsp_fft_avx)
target_compile_definitions(chowdsp_fft PRIVATE CHOWDSP_FFT_COMPILER_SUPPORTS_AVX=1)
else()
if(COMPILER_OPT_ARCH_AVX_GCC_CLANG_SUPPORTED)
message(STATUS "chowdsp_fft -- Compiler supports flags: -mavx2 -mfma")
add_library(chowdsp_fft_avx STATIC simd/chowdsp_fft_impl_avx.cpp)
target_compile_options(chowdsp_fft_avx PRIVATE -mavx2 -mfma -Wno-unused-command-line-argument)
target_compile_features(chowdsp_fft_avx PRIVATE cxx_std_17)
target_compile_definitions(chowdsp_fft_avx PRIVATE _USE_MATH_DEFINES=1)
target_link_libraries(chowdsp_fft PRIVATE chowdsp_fft_avx)
target_compile_definitions(chowdsp_fft PRIVATE CHOWDSP_FFT_COMPILER_SUPPORTS_AVX=1)
else()
message(STATUS "chowdsp_fft -- Compiler DOES NOT supports flags: -mavx2 -mfma")
target_compile_definitions(chowdsp_fft PRIVATE CHOWDSP_FFT_COMPILER_SUPPORTS_AVX=0)
endif()
endif()
## JUCE compatibility
if(EXISTS "${JUCE_MODULES_DIR}")
message(STATUS "chowdsp_fft -- Configuring chowdsp_fft_juce")
juce_add_module(chowdsp_fft_juce ALIAS_NAMESPACE chowdsp)
target_link_libraries(chowdsp_fft_juce INTERFACE chowdsp_fft)
endif()
if(CHOWDSP_FFT_TESTING)
add_subdirectory(test)
add_subdirectory(bench)
endif()