You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
psblas3/test/pargen/CMakeLists.txt

53 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(pargen Fortran)
# Check for the installation path for psblas
if(NOT DEFINED PSBLAS_INSTALL_DIR)
message(FATAL_ERROR "Please specify the path to the psblas installation directory using -DPSBLAS_INSTALL_DIR=<path>")
endif()
# Set the include and library directories based on the provided path
set(INSTALLDIR "${PSBLAS_INSTALL_DIR}")
set(INCDIR "${INSTALLDIR}/include")
set(MODDIR "${INSTALLDIR}/modules")
set(LIBDIR "${INSTALLDIR}/lib")
# Find the psblas package
find_package(psblas REQUIRED PATHS ${INSTALLDIR})
# Include directories for the Fortran compiler
include_directories(${INCDIR} ${MODDIR})
# Define executable directory
set(EXEDIR "${CMAKE_CURRENT_SOURCE_DIR}/runs")
# Ensure the executable directory exists
file(MAKE_DIRECTORY ${EXEDIR})
# Define sources for the executables
set(SOURCES_D_PDE3D psb_d_pde3d.F90)
set(SOURCES_S_PDE3D psb_s_pde3d.F90)
set(SOURCES_D_PDE2D psb_d_pde2d.F90)
set(SOURCES_S_PDE2D psb_s_pde2d.F90)
# Create executables
add_executable(psb_d_pde3d ${SOURCES_D_PDE3D})
target_link_libraries(psb_d_pde3d psblas::util psblas::linsolve psblas::prec psblas::base)
add_executable(psb_s_pde3d ${SOURCES_S_PDE3D})
target_link_libraries(psb_s_pde3d psblas::util psblas::linsolve psblas::prec psblas::base)
add_executable(psb_d_pde2d ${SOURCES_D_PDE2D})
target_link_libraries(psb_d_pde2d psblas::util psblas::linsolve psblas::prec psblas::base)
add_executable(psb_s_pde2d ${SOURCES_S_PDE2D})
target_link_libraries(psb_s_pde2d psblas::util psblas::linsolve psblas::prec psblas::base)
# Set output directory for executables
foreach(target psb_d_pde3d psb_s_pde3d psb_d_pde2d psb_s_pde2d)
set_target_properties(${target} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${EXEDIR}
)
endforeach()