diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d6eaa4222e5159309267f06d5b890161ce29971..0b6bc578e59766ad48fcd2ae1825b8c3d952e27b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -460,14 +460,63 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/ find_package(FFTW COMPONENTS SIMPLE) endif() - if (FFTW_LIBRARY_DIRS_DEP) - set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags") - endif() - if (FFTW_LIBRARIES_DEP) - foreach (fft_lib ${FFTW_LIBRARIES_DEP}) - set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};") - endforeach() - endif() + message(STATUS " SCALFMM USE MKL ") + + if( SCALFMM_USE_MKL_AS_BLAS ) + + unset(FFT_LIBRARIES CACHE) + message(STATUS " SCALFMM USE MKL already defined") + set(FFT_INCLUDES "$ENV{MKLROOT}/include/fftw" CACHE STRING "Set your MKL flags") + if (BLAS_FOUND) + set(FFTW_FOUND ON) + endif() + + else(SCALFMM_USE_MKL_AS_BLAS) + + # The package can be used with the following COMPONENTS: + # MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD + # Default is DOUBLE and without THREADS|OMP + find_package(FFTW COMPONENTS MKL) # not REQUIRED + if (FFTW_LIBRARY_DIRS_DEP) + set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags") + endif() + if (FFTW_LIBRARIES_DEP) + foreach (fft_lib ${FFTW_LIBRARIES_DEP}) + set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};") + endforeach() + endif() + set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" ) + if (FFT_LIBRARIES) + set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${FFT_LIBRARIES}") + endif() + + endif(SCALFMM_USE_MKL_AS_BLAS) + + else(SCALFMM_USE_MKL_AS_FFTW) + + message(STATUS " SCALFMM USE FFTW ") + # The package can be used with the following COMPONENTS: + # MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD + # Default is DOUBLE and without THREADS|OMP + find_package(FFTW COMPONENTS SIMPLE) # not REQUIRED + #message(FATAL_ERROR ${FFTW_FOUND} ${FFTW_LIBRARY_DIRS_DEP} ${FFTW_LIBRARIES_DEP}) + if (FFTW_LIBRARY_DIRS_DEP) + set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your FFTW path") + endif() + if (FFTW_LIBRARIES_DEP) + foreach (fft_lib ${FFTW_LIBRARIES_DEP}) + set(FFT_LIBRARIES "${FFT_LIBRARIES};${fft_lib};") + endforeach() + endif() + #message(FATAL_ERROR ${FFTW_INCLUDE_DIRS_DEP}) + set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" ) + if (FFT_LIBRARIES) + set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${FFT_LIBRARIES}") + endif() + if(FFTW_LIBRARY_DIRS) + # the RPATH to be used when installing + list(APPEND CMAKE_INSTALL_RPATH "${FFTW_LIBRARY_DIRS}") + endif() set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" ) if (FFT_LIBRARIES)