Skip to content

Commit

Permalink
example:metis,scotch: use MUMPS config
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed May 22, 2024
1 parent b00cc7c commit 06d1edf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
22 changes: 5 additions & 17 deletions example/metis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
cmake_minimum_required(VERSION 3.13...3.25)
cmake_minimum_required(VERSION 3.19)

project(MUMPSmetisExamples
LANGUAGES C Fortran
)

enable_testing()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake/)

if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|Intel")
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Werror-implicit-function-declaration>)
endif()

if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
file(GENERATE OUTPUT .gitignore CONTENT "*")
endif()

find_package(METIS REQUIRED)
find_package(MPI REQUIRED COMPONENTS C Fortran)
find_package(LAPACK REQUIRED)
find_package(SCALAPACK REQUIRED)
find_package(MUMPS REQUIRED COMPONENTS METIS)
find_package(MUMPS CONFIG REQUIRED)

function(precision_ex a)
add_executable(${a}_metis ${a}_metis.f90)
target_link_libraries(${a}_metis PRIVATE MUMPS::MUMPS METIS::METIS)
target_link_libraries(${a}_metis PRIVATE MUMPS::MUMPS)
add_test(NAME ${a}_metis COMMAND ${a}_metis)
endfunction()

if(MUMPS_d_FOUND)
precision_ex("d")
endif()

file(GENERATE OUTPUT .gitignore CONTENT "*")
17 changes: 3 additions & 14 deletions example/scotch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
cmake_minimum_required(VERSION 3.13...3.25)
cmake_minimum_required(VERSION 3.19)

project(MUMPSscotchExamples
LANGUAGES C Fortran
)

enable_testing()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../cmake/)

if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|Intel")
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Werror-implicit-function-declaration>)
endif()

find_package(Threads)
find_package(MPI REQUIRED COMPONENTS C Fortran)
find_package(Scotch REQUIRED COMPONENTS ESMUMPS)
find_package(LAPACK REQUIRED)
find_package(SCALAPACK REQUIRED)
find_package(MUMPS REQUIRED COMPONENTS Scotch)
find_package(MUMPS CONFIG REQUIRED)

function(precision_ex a)
add_executable(${a}_scotch ${a}_scotch.f90)
target_link_libraries(${a}_scotch PRIVATE MUMPS::MUMPS Scotch::Scotch ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${a}_scotch PRIVATE MUMPS::MUMPS)
add_test(NAME ${a}_scotch COMMAND ${a}_scotch)
endfunction()

Expand Down

0 comments on commit 06d1edf

Please sign in to comment.