#
# @file CMakeLists.txt
#
# @brief Principal CMake configuration file for the fft library
#
# @copyright
# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
# SPC (Swiss Plasma Center)
#
# SPClibs is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# SPClibs is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
#
# @authors
# (in alphabetical order)
# @author Nicolas Richart
# @author Trach-Minh Tran
#
project(fft)
find_package(FFTW REQUIRED)
set(fft_w $ENV{fft_w})
set(SRCS
fft_fftw.F90
)
set(EXAMPLES tfft.f90)
add_library(fft STATIC ${SRCS})
target_include_directories(fft
PRIVATE $
${FFTW_INCLUDES}
INTERFACE $
$
${FFTW_INCLUDES}
)
if (${fft_w} MATCHES "fft_w2")
target_compile_options(fft PRIVATE "-Dfft_w2")
else()
target_compile_options(fft PRIVATE "-Dfft_w3")
endif()
target_link_libraries(fft PUBLIC ${FFTW_LIBRARY} ${MPI_Fortran_LIBRARIES})
#
set_property(TARGET fft
PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/modules/fft.mod)
add_executable(tfft tfft.f90)
target_link_libraries(tfft fft ${MPI_Fortran_LIBRARIES})
#add_test(tfft ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1
# ${CMAKE_CURRENT_BINARY_DIR}/tfft < ${fft_SOURCE_DIR}/in)
install(TARGETS fft
EXPORT ${BSPLINES_EXPORT_TARGETS}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)