AMDIS.cmake.in 5.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
set(AMDIS_NEED_CXX11 @ENABLE_CXX11@)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@)
set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@)
set(AMDIS_NEED_BASE_PROBLEMS @ENABLE_BASE_PROBLEMS@)
set(AMDIS_NEED_REINIT @ENABLE_REINIT@)
set(AMDIS_NEED_COMPOSITE_FEM @ENABLE_COMPOSITE_FEM@)
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@)
set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@)
set(AMDIS_NEED_PNG @ENABLE_PNG@)
set(AMDIS_NEED_SEQ_PETSC @ENABLE_SEQ_PETSC@)

set(BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
set(CMAKE_BUILD_TYPE @CMAKE_BUILD_TYPE@)

set(AMDIS_COMPILEFLAGS "")
set(AMDIS_INCLUDE_DIRS "")
set(AMDIS_LIBRARIES "")


if (AMDIS_NEED_CXX11)
  enable_cxx11(AMDIS_NEED_CXX11 AMDIS_COMPILEFLAGS)
  if (NOT AMDIS_NEED_CXX11)
    message(FATAL_ERROR "AMDiS was compiled with c++11 support, but the current compiler does not support this feature!")
  endif (NOT AMDIS_NEED_CXX11)
  list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=1")
else ()
  list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=0")
endif (AMDIS_NEED_CXX11)


# try to detect the AMDiS include directory
# -------------------------------------------
find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_DIR}/../../include/amdis/)
if (_AMDIS_H)
  get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR})
else ()
  message(ERROR "Could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.")
endif ()
unset(_AMDIS_H CACHE)


# MTL4 libraries
# --------------------
enable_mtl4(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)


# AMDiS base libraries
# --------------------
find_library(_AMDIS_LIB amdis${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_AMDIS_LIB)
  list(APPEND AMDIS_LIBRARIES optimized ${_AMDIS_LIB} debug ${_AMDIS_LIB}d)
else ()
  message(ERROR "Could not detect the AMDiS${POSTFIX} library. Please set the variable _AMDIS_LIB to the AMDiS${POSTFIX} library.")
endif ()
unset(_AMDIS_LIB CACHE)


# Boost libraries
# ---------------
if (NOT BOOST_ROOT)
  set(BOOST_ROOT @BOOST_ROOT@)
endif (NOT BOOST_ROOT)
if (NOT BOOST_LIBRARYDIR)
  set(BOOST_LIBRARYDIR @BOOST_LIBRARYDIR@)
endif (NOT BOOST_LIBRARYDIR)
enable_boost(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)


# umfpack library
# --------------------
if (AMDIS_NEED_UMFPACK)
  set(AMDIS_SuiteSparse_DIR @SuiteSparse_DIR@)
  set(AMDIS_UMFPACK_INCLUDE_DIR @UMFPACK_INCLUDE_DIRS@)
  set(AMDIS_UMFPACK_LIB_DIR ${AMDIS_UMFPACK_INCLUDE_DIR}/../include)
  enable_umfpack(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif (AMDIS_NEED_UMFPACK)


# amdis extensions
# ----------------
if (AMDIS_NEED_EXTENSIONS)
  find_library(_EXTENSIONS_LIB amdisextensions${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
  if (_EXTENSIONS_LIB)
    list(APPEND AMDIS_INCLUDE_DIRS
      ${AMDIS_INCLUDE_DIR}/extensions
      ${AMDIS_INCLUDE_DIR}/extensions/nanoflann
      ${AMDIS_INCLUDE_DIR}/extensions/pugixml
      ${AMDIS_INCLUDE_DIR}/extensions/time)
    list(APPEND AMDIS_COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
    list(APPEND AMDIS_LIBRARIES optimized ${_EXTENSIONS_LIB} debug ${_EXTENSIONS_LIB}d)
    if (AMDIS_NEED_BASE_PROBLEMS)
      list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/base_problems)
    endif (AMDIS_NEED_BASE_PROBLEMS)
  else ()
    message(FATAL_ERROR "Extensions library not found")
  endif ()
  unset(_EXTENSIONS_LIB CACHE)
endif (AMDIS_NEED_EXTENSIONS)


# reinit library
# --------------
if (AMDIS_NEED_REINIT)
  find_library(_REINIT_LIB amdisreinit${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
  if (_REINIT_LIB)
    list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit)
    list(APPEND AMDIS_LIBRARIES optimized ${_REINIT_LIB} debug ${_REINIT_LIB}d)
  else ()
    message(FATAL_ERROR "Reinit library not found")
  endif ()
  unset(_REINIT_LIB CACHE)
endif (AMDIS_NEED_REINIT)


# compositeFEM library
# --------------------
if (AMDIS_NEED_COMPOSITE_FEM)
  find_library(_COMPOSITE_FEM_LIB amdiscompositefem${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
  if (_COMPOSITE_FEM_LIB)
    list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM)
    list(APPEND AMDIS_LIBRARIES optimized ${_COMPOSITE_FEM_LIB} debug ${_COMPOSITE_FEM_LIB}d)
  else ()
    message(FATAL_ERROR "CompositeFEM library not found")
  endif ()
  unset(_COMPOSITE_FEM_LIB CACHE)
endif (AMDIS_NEED_COMPOSITE_FEM)


# muparser library
# --------------------
find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_MUPARSER_LIB)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)
  list(APPEND AMDIS_LIBRARIES ${_MUPARSER_LIB})
else ()
  message(ERROR "MuParser library not found")
endif ()
unset(_MUPARSER_LIB CACHE)


# Additional libraries
# ==================================================================================================

if (AMDIS_HAS_PARALLEL_DOMAIN)
  enable_mpi(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
  enable_petsc(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
  list(APPEND AMDIS_COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1")
endif (AMDIS_HAS_PARALLEL_DOMAIN)

# Zoltan library
# --------------
if (AMDIS_NEED_ZOLTAN)
  enable_zoltan(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif ()


# BDDCML library
# --------------
if (AMDIS_NEED_BDDCML)
  enable_bddcml(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif ()


# Hypre library
# --------------
if (AMDIS_NEED_HYPRE)
  enable_hypre(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif ()


# PNG library
# --------------
if (AMDIS_NEED_PNG)
  enable_png(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif ()

# Sequential PETSc library
# --------------
if (AMDIS_NEED_SEQ_PETSC AND NOT AMDIS_HAS_PARALLEL_DOMAIN)
  enable_mpi(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
  enable_petsc(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
  list(APPEND COMPILEFLAGS "-DHAVE_SEQ_PETSC=1")
endif ()