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

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# some optimization of the compile times
find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
  set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
endif ()

if (UNIX AND NOT APPLE)
  execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE ld_version)
  if ("${ld_version}" MATCHES "GNU gold")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
  endif()
endif()


Praetorius, Simon's avatar
Praetorius, Simon committed
19
20
if (NOT BACKEND)
  set(BACKEND "ISTL" CACHE STRING "LinearAlgebra backend. One of MTL, EIGEN, PETSC, ISTL")
21
  set_property(CACHE BACKEND PROPERTY STRINGS "MTL" "EIGEN" "PETSC" "ISTL")
Praetorius, Simon's avatar
Praetorius, Simon committed
22
endif (NOT BACKEND)
Praetorius, Simon's avatar
Praetorius, Simon committed
23

24
25
26
27
28
29
30
if (BACKEND STREQUAL "ISTL")
  set(AMDIS_BACKEND 1)
  if (NOT dune-istl_FOUND)
    message(FATAL_ERROR "Need dune-istl for backend ISTL. Either install the dune-istl module, or change the BACKEND!")
  endif ()

elseif (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4")
31
  find_package(MTL REQUIRED)
Praetorius, Simon's avatar
Praetorius, Simon committed
32
  set(AMDIS_HAS_MTL TRUE)
33
  set(AMDIS_BACKEND 2)
34
35

  find_package(HYPRE)
Praetorius, Simon's avatar
Praetorius, Simon committed
36
37
  set(AMDIS_HAS_HYPRE ${HYPRE_FOUND})

38
elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3")
39
  find_package(Eigen3 REQUIRED 3.3.5)
Praetorius, Simon's avatar
Praetorius, Simon committed
40
  set(AMDIS_HAS_EIGEN TRUE)
41
  set(AMDIS_BACKEND 3)
Praetorius, Simon's avatar
Praetorius, Simon committed
42
43
  message(STATUS "  Found Eigen3, version: ${Eigen3_VERSION}")

Praetorius, Simon's avatar
Praetorius, Simon committed
44
45
elseif (BACKEND STREQUAL "PETSC")
  find_package(PETSc REQUIRED)
Praetorius, Simon's avatar
Praetorius, Simon committed
46
  set(AMDIS_HAS_PETSC TRUE)
47
  set(AMDIS_BACKEND 4)
Praetorius, Simon's avatar
Praetorius, Simon committed
48

49
else ()
50
  message(FATAL_ERROR "BACKEND must be one of MTL, EIGEN, PETSC, ISTL, ISTL_BLOCKED")
51
endif ()