AmdisMacros.cmake 1.4 KB
Newer Older
1
2
include(AmdisCXXFeatures)
include(AddAmdisExecutable)
3

Praetorius, Simon's avatar
Praetorius, Simon committed
4
5
6
7
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)
Praetorius, Simon's avatar
Praetorius, Simon committed
8

9
if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4")
10
  find_package(MTL REQUIRED)
Praetorius, Simon's avatar
Praetorius, Simon committed
11
  set(HAVE_MTL TRUE)
12
  if (MTL_FOUND)
13
14
    message(STATUS "  Found MTL, version: ${MTL_VERSION}")
    dune_register_package_flags(LIBRARIES MTL::MTL COMPILE_DEFINITIONS "ENABLE_MTL=1")
15
  endif (MTL_FOUND)
16
elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3")
17
  find_package(Eigen3 REQUIRED 3.3.5)
Praetorius, Simon's avatar
Praetorius, Simon committed
18
  set(HAVE_EIGEN TRUE)
19
  if (EIGEN3_FOUND)
20
21
    message(STATUS "  Found Eigen3, version: ${Eigen3_VERSION}")
    dune_register_package_flags(LIBRARIES Eigen3::Eigen COMPILE_DEFINITIONS "ENABLE_EIGEN=1")
22
  endif (EIGEN3_FOUND)
Praetorius, Simon's avatar
Praetorius, Simon committed
23
24
25
26
27
28
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)
29
30
elseif (BACKEND STREQUAL "ISTL")
  if (NOT dune-istl_FOUND)
Praetorius, Simon's avatar
Praetorius, Simon committed
31
    message(FATAL_ERROR "Need dune-istl, MTL, PETSc, or Eigen3 as linear algebra backend. Change flag BACKEND!")
32
33
  endif ()
else ()
Praetorius, Simon's avatar
Praetorius, Simon committed
34
  message(FATAL_ERROR "BACKEND must be one of MTL, EIGEN, PETSC, ISTL")
35
endif ()
Praetorius, Simon's avatar
Praetorius, Simon committed
36
37
38


set(DUNE_CUSTOM_PKG_CONFIG_SECTION "set(BACKEND \"${BACKEND}\")")