From 203c6d122b413758efd07854814b4fce7fd74def Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Sun, 9 Jun 2019 21:37:34 -0400 Subject: [PATCH] Move KSPACE CMake configuration into its own file --- cmake/CMakeLists.txt | 39 +---------------------------- cmake/Modules/Packages/KSPACE.cmake | 38 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 38 deletions(-) create mode 100644 cmake/Modules/Packages/KSPACE.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 49a4b98a1e..8b82668d42 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -227,44 +227,7 @@ if(BUILD_OMP) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() -if(PKG_KSPACE) - option(FFT_SINGLE "Use single precision FFT instead of double" OFF) - set(FFTW "FFTW3") - if(FFT_SINGLE) - set(FFTW "FFTW3F") - add_definitions(-DFFT_SINGLE) - endif() - find_package(${FFTW} QUIET) - if(${FFTW}_FOUND) - set(FFT "${FFTW}" CACHE STRING "FFT library for KSPACE package") - else() - set(FFT "KISS" CACHE STRING "FFT library for KSPACE package") - endif() - set(FFT_VALUES KISS ${FFTW} MKL) - set_property(CACHE FFT PROPERTY STRINGS ${FFT_VALUES}) - validate_option(FFT FFT_VALUES) - string(TOUPPER ${FFT} FFT) - if(NOT FFT STREQUAL "KISS") - find_package(${FFT} REQUIRED) - if(NOT FFT STREQUAL "FFTW3F") - add_definitions(-DFFT_FFTW) - else() - add_definitions(-DFFT_${FFT}) - endif() - include_directories(${${FFT}_INCLUDE_DIRS}) - list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES}) - else() - add_definitions(-DFFT_KISS) - endif() - set(FFT_PACK "array" CACHE STRING "Optimization for FFT") - set(FFT_PACK_VALUES array pointer memcpy) - set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES}) - validate_option(FFT_PACK FFT_PACK_VALUES) - if(NOT FFT_PACK STREQUAL "array") - string(TOUPPER ${FFT_PACK} FFT_PACK) - add_definitions(-DFFT_PACK_${FFT_PACK}) - endif() -endif() +include(Packages/KSPACE) if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-PLUMED OR PKG_USER-QUIP OR PKG_LATTE) find_package(LAPACK) diff --git a/cmake/Modules/Packages/KSPACE.cmake b/cmake/Modules/Packages/KSPACE.cmake new file mode 100644 index 0000000000..6938a93a36 --- /dev/null +++ b/cmake/Modules/Packages/KSPACE.cmake @@ -0,0 +1,38 @@ +if(PKG_KSPACE) + option(FFT_SINGLE "Use single precision FFT instead of double" OFF) + set(FFTW "FFTW3") + if(FFT_SINGLE) + set(FFTW "FFTW3F") + add_definitions(-DFFT_SINGLE) + endif() + find_package(${FFTW} QUIET) + if(${FFTW}_FOUND) + set(FFT "${FFTW}" CACHE STRING "FFT library for KSPACE package") + else() + set(FFT "KISS" CACHE STRING "FFT library for KSPACE package") + endif() + set(FFT_VALUES KISS ${FFTW} MKL) + set_property(CACHE FFT PROPERTY STRINGS ${FFT_VALUES}) + validate_option(FFT FFT_VALUES) + string(TOUPPER ${FFT} FFT) + if(NOT FFT STREQUAL "KISS") + find_package(${FFT} REQUIRED) + if(NOT FFT STREQUAL "FFTW3F") + add_definitions(-DFFT_FFTW) + else() + add_definitions(-DFFT_${FFT}) + endif() + include_directories(${${FFT}_INCLUDE_DIRS}) + list(APPEND LAMMPS_LINK_LIBS ${${FFT}_LIBRARIES}) + else() + add_definitions(-DFFT_KISS) + endif() + set(FFT_PACK "array" CACHE STRING "Optimization for FFT") + set(FFT_PACK_VALUES array pointer memcpy) + set_property(CACHE FFT_PACK PROPERTY STRINGS ${FFT_PACK_VALUES}) + validate_option(FFT_PACK FFT_PACK_VALUES) + if(NOT FFT_PACK STREQUAL "array") + string(TOUPPER ${FFT_PACK} FFT_PACK) + add_definitions(-DFFT_PACK_${FFT_PACK}) + endif() +endif()