Skip to content

Commit

Permalink
Friendlier C++ versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Oct 16, 2024
1 parent c556ddc commit d77d205
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cmake_minimum_required(VERSION 3.20)
project(chowdsp_fft)
set(CMAKE_CXX_STANDARD 20)

add_library(chowdsp_fft STATIC)
target_sources(chowdsp_fft
Expand All @@ -10,6 +9,7 @@ target_sources(chowdsp_fft
)
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)
Expand All @@ -19,13 +19,15 @@ if(COMPILER_OPT_ARCH_AVX_MSVC_SUPPORTED)
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)
Expand Down
1 change: 1 addition & 0 deletions bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ add_executable(bench_chowdsp_fft bench.cpp)
target_link_libraries(bench_chowdsp_fft PRIVATE chowdsp_fft)
target_include_directories(bench_chowdsp_fft PRIVATE ${CMAKE_BINARY_DIR}/_deps/pffft-src)
target_compile_definitions(bench_chowdsp_fft PRIVATE _USE_MATH_DEFINES=1)
target_compile_features(bench_chowdsp_fft PRIVATE cxx_std_20)
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ add_executable(test_chowdsp_fft_cpp test.cpp ${pffft_SOURCE_DIR}/pffft.c)
target_link_libraries(test_chowdsp_fft_cpp PRIVATE chowdsp_fft Catch2::Catch2WithMain)
target_include_directories(test_chowdsp_fft_cpp PRIVATE ${pffft_SOURCE_DIR})
target_compile_definitions(test_chowdsp_fft_cpp PRIVATE _USE_MATH_DEFINES=1)
target_compile_features(test_chowdsp_fft_cpp PRIVATE cxx_std_20)

if(CHOWDSP_FFT_COVERAGE)
message(STATUS "chowdsp_fft -- Appending code coverage compiler flags: -g --coverage")
Expand Down

0 comments on commit d77d205

Please sign in to comment.