AmdisMacros.cmake 1.52 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
21
22
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
23

24
if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4")
25
  find_package(MTL REQUIRED)
Praetorius, Simon's avatar
Praetorius, Simon committed
26
  set(AMDIS_HAS_MTL TRUE)
27
28

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

31
elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3")
32
  find_package(Eigen3 REQUIRED 3.3.5)
Praetorius, Simon's avatar
Praetorius, Simon committed
33
  set(AMDIS_HAS_EIGEN TRUE)
Praetorius, Simon's avatar
Praetorius, Simon committed
34
35
  message(STATUS "  Found Eigen3, version: ${Eigen3_VERSION}")

Praetorius, Simon's avatar
Praetorius, Simon committed
36
37
elseif (BACKEND STREQUAL "PETSC")
  find_package(PETSc REQUIRED)
Praetorius, Simon's avatar
Praetorius, Simon committed
38
39
  set(AMDIS_HAS_PETSC TRUE)

40
41
elseif (BACKEND STREQUAL "ISTL")
  if (NOT dune-istl_FOUND)
Praetorius, Simon's avatar
Praetorius, Simon committed
42
    message(FATAL_ERROR "Need dune-istl, MTL, PETSc, or Eigen3 as linear algebra backend. Change flag BACKEND!")
43
44
  endif ()
else ()
Praetorius, Simon's avatar
Praetorius, Simon committed
45
  message(FATAL_ERROR "BACKEND must be one of MTL, EIGEN, PETSC, ISTL")
46
endif ()