Skip to content
Snippets Groups Projects

Feature/petsc cmake

Merged Praetorius, Simon requested to merge feature/petsc_cmake into master
All threads resolved!
6 files
+ 200
9
Compare changes
  • Side-by-side
  • Inline
Files
6
include(AmdisCXXFeatures)
include(AddAmdisExecutable)
set(BACKEND "ISTL" CACHE STRING "LinearAlgebra backend. One of MTL, EIGEN, ISTL")
set_property(CACHE BACKEND PROPERTY STRINGS "MTL" "EIGEN" "ISTL")
if (NOT BACKEND)
set(BACKEND "ISTL" CACHE STRING "LinearAlgebra backend. One of MTL, EIGEN, PETSC, ISTL")
set_property(CACHE BACKEND PROPERTY STRINGS "MTL" "EIGEN" "ISTL" "PETSC")
endif (NOT BACKEND)
if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4")
find_package(MTL REQUIRED)
set(HAVE_MTL MTL_FOUND)
set(HAVE_MTL TRUE)
if (MTL_FOUND)
message(STATUS " Found MTL, version: ${MTL_VERSION}")
dune_register_package_flags(LIBRARIES MTL::MTL COMPILE_DEFINITIONS "ENABLE_MTL=1")
endif (MTL_FOUND)
elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3")
find_package(Eigen3 REQUIRED 3.3.5)
set(HAVE_EIGEN EIGEN_FOUND)
set(HAVE_EIGEN TRUE)
if (EIGEN3_FOUND)
message(STATUS " Found Eigen3, version: ${Eigen3_VERSION}")
dune_register_package_flags(LIBRARIES Eigen3::Eigen COMPILE_DEFINITIONS "ENABLE_EIGEN=1")
endif (EIGEN3_FOUND)
elseif (BACKEND STREQUAL "PETSC")
find_package(PETSc REQUIRED)
if (PETSc_FOUND)
set(HAVE_PETSC TRUE)
dune_register_package_flags(LIBRARIES PETSc::PETSc COMPILE_DEFINITIONS "ENABLE_PETSC=1")
endif (PETSc_FOUND)
elseif (BACKEND STREQUAL "ISTL")
if (NOT dune-istl_FOUND)
message(FATAL_ERROR "Need dune-istl, MTL, or Eigen3 as linear algebra backend. Change flag BACKEND!")
message(FATAL_ERROR "Need dune-istl, MTL, PETSc, or Eigen3 as linear algebra backend. Change flag BACKEND!")
endif ()
else ()
message(FATAL_ERROR "BACKEND must be one of MTL, EIGEN, ISTL")
endif ()
set(DUNE_CUSTOM_PKG_CONFIG_SECTION "set(BACKEND \"${BACKEND}\")")
\ No newline at end of file
Loading