#
# @file CMakeLists.txt
#
# @brief
#
# @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(pputils2)
set(SRCS
pputils2.f90
)
set(CMAKE_Fortran_MODULE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/modules
)
add_library(pputils2 STATIC ${SRCS})
target_include_directories(pputils2
PRIVATE $
${MPI_Fortran_INCLUDE_PATH}
INTERFACE $
$
${MPI_Fortran_INCLUDE_PATH}
)
target_compile_options(pputils2 PUBLIC ${MPI_Fortran_COMPILE_FLAGS})
target_link_libraries(pputils2 PUBLIC ${MPI_Fortran_LIBRARIES})
set_property(TARGET pputils2
PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/modules/pputils.mod)
include(GNUInstallDirs)
install(TARGETS pputils2
EXPORT ${BSPLINES_EXPORT_TARGETS}
LIBRARY DESTINATION ${CNAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CNAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(BSPLINES_EXAMPLES)
set(EXAMPLES ex1 ex2 ex3 ex4 ex5 ex6 ex7)
foreach(ex ${EXAMPLES})
add_executable(pputils2_${ex} ${ex}.f90)
target_link_libraries(pputils2_${ex} pputils2 futils)
endforeach()
add_test(ex1 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex1)
add_test(ex2 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 9 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex2)
add_test(ex3 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 5 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex3)
add_test(ex4 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 12 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex4)
add_test(ex5 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 8 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex5)
add_test(ex6 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 12 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex6)
add_test(ex7 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 6 ${CMAKE_CURRENT_BINARY_DIR}/pputils2_ex7)
endif()