Applied patch from @agriggio to check multithreading in fftw3

This commit is contained in:
heckflosse 2017-11-06 19:09:50 +01:00
parent d810de4445
commit 81fbf0c2e1

View File

@ -343,12 +343,31 @@ if(OPTION_OMP)
endif()
# check for libfftw3f_omp
include(CheckCSourceCompiles)
if(OPENMP_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${FFTW3F_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES)
foreach(l ${FFTW3F_LIBRARIES})
find_library(_f ${l} PATHS ${FFTW3F_LIBRARY_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${_f})
endforeach()
check_c_source_compiles(
"#include <fftw3.h>
int main()
{
fftwf_init_threads();
fftwf_plan_with_nthreads(1);
return 0;
}" _fftw3f_multithread)
if(_fftw3f_multithread)
add_definitions(-DRT_FFTW3F_OMP)
else()
find_library(fftw3f_omp fftw3f_omp PATHS ${FFTW3F_LIBRARY_DIRS})
if(fftw3f_omp)
add_definitions(-DRT_FFTW3F_OMP)
set(FFTW3F_LIBRARIES ${FFTW3F_LIBRARIES} ${fftw3f_omp})
endif()
endif()
endif()