Skip to content

Commit a30e282

Browse files
committed
2 parents dc8f413 + 7ad608e commit a30e282

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ option(FINUFFT_USE_DUCC0 "Whether to use DUCC0 (instead of FFTW) for CPU FFTs" O
2424
option(FINUFFT_BUILD_DOCS "Whether to build the FINUFFT documentation" OFF)
2525
# if FINUFFT_USE_DUCC0 is ON, the following options are ignored
2626
set(FINUFFT_FFTW_LIBRARIES "DEFAULT" CACHE STRING "Specify a custom FFTW library")
27-
set(FINUFFT_FFTW_SUFFIX "OpenMP" CACHE STRING "Suffix for FFTW libraries (e.g. OpenMP, Threads etc.)")
27+
set(FINUFFT_FFTW_SUFFIX "DEFAULT" CACHE STRING "Suffix for FFTW libraries (e.g. OpenMP, Threads etc.) defaults to empty string if OpenMP is disabled, else uses OpenMP. Ignored if DUCC0 is used.")
2828
# if FINUFFT_USE_CPU is OFF, the following options are ignored
2929
set(FINUFFT_ARCH_FLAGS "native" CACHE STRING "Compiler flags for specifying target architecture, defaults to -march=native")
3030
# sphinx tag (don't remove): @cmake_opts_end

cmake/setupFFTW.cmake

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,16 @@ if(FINUFFT_FFTW_LIBRARIES STREQUAL DEFAULT OR FINUFFT_FFTW_LIBRARIES STREQUAL DO
8181

8282
target_include_directories(fftw3 PUBLIC $<BUILD_INTERFACE:${fftw3_SOURCE_DIR}/api>)
8383
else()
84-
set(FINUFFT_FFTW_LIBRARIES
85-
"FFTW::Float"
86-
"FFTW::Double"
87-
"FFTW::Float${FINUFFT_FFTW_SUFFIX}"
88-
"FFTW::Double${FINUFFT_FFTW_SUFFIX}"
89-
)
84+
# link against single thread fftw
85+
set(FINUFFT_FFTW_LIBRARIES "FFTW::Float" "FFTW::Double")
86+
# default behavior
87+
if(FINUFFT_FFTW_SUFFIX STREQUAL "DEFAULT")
88+
if(FINUFFT_USE_OPENMP)
89+
list(APPEND FINUFFT_FFTW_LIBRARIES "FFTW::FloatOpenMP" "FFTW::DoubleOpenMP")
90+
endif()
91+
else()
92+
# user override
93+
list(APPEND FINUFFT_FFTW_LIBRARIES "FFTW::Float${FINUFFT_FFTW_SUFFIX}" "FFTW::Double${FINUFFT_FFTW_SUFFIX}")
94+
endif()
9095
endif()
9196
endif()

0 commit comments

Comments
 (0)