AMDISConfig.cmake.in 7.42 KB
Newer Older
1
# This configuration file is shipped with the FEM-Toolbox AMDiS.
2
# It simplifies the configure of different amdis-versions.
3
#
4
5
6
7
# We set the following variables:
#   AMDIS_INCLUDE_DIRS    all include directories (mtl, umfpack, parmetis, metis, ...)
#   AMDIS_LIBRARIES       the needed libraries
#   AMDiS_COMPILEFLAGS    some compile flags for amdis
8
#
9
# Use this package in the following way:
10
#
11
#   find_package(AMDiS REQUIRED [PARALLEL|SEQUENTIAL])
12
#   add_executable(yourTarget <yourSources>)
13
14
15
16
17
#   include_directories(${AMDIS_INCLUDE_DIRS})
#   compile_definitions(${AMDIS_COMPILEFLAGS})
#   target_link_libraries(yourTarget ${AMDIS_LIBRARIES})
#
# The default component for this package is SEQUENTIAL.
18
19
#

20
if (${CMAKE_VERSION} VERSION_LESS "2.8.10")
21
  message(FATAL_ERROR "The Configuration file was created for CMake version >= 2.8.10")
22
endif ()
23

24
list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})
25

26
set(IS_AMDISCONFIG true)
27

28
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
Praetorius, Simon's avatar
Praetorius, Simon committed
29
set(AMDIS_NEED_CXX11 @ENABLE_CXX11@)
30
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
31
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@)
32
33
set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@)
set(AMDIS_NEED_BASE_PROBLEMS @ENABLE_BASE_PROBLEMS@)
34
35
set(AMDIS_NEED_REINIT @ENABLE_REINIT@)
set(AMDIS_NEED_COMPOSITE_FEM @ENABLE_COMPOSITE_FEM@)
36
37
38
39
40
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@)
41
42
43

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

45
46
47
set(AMDIS_COMPILEFLAGS "")
set(AMDIS_INCLUDE_DIRS "")
set(AMDIS_LIBRARIES "")
48

49
50
51
52
53
54
55
56
57
58
59
60
61
# Include macros
# ----------------
include(enable_cxx11)
include(enable_mtl4)
include(enable_boost)
include(enable_umfpack)
include(enable_petsc)
include(enable_zoltan)
include(enable_bddcml)
include(enable_hypre)
include(enable_png)


Praetorius, Simon's avatar
Praetorius, Simon committed
62
if (AMDIS_NEED_CXX11)
63
64
65
66
67
  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")
68
else ()
69
  list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=0")
Praetorius, Simon's avatar
Praetorius, Simon committed
70
71
endif (AMDIS_NEED_CXX11)

72

73
74
75
76
# try to detect the AMDiS include directory
# -------------------------------------------
find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_DIR}/../../include/amdis/)
if (_AMDIS_H)
77
78
  get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR})
79
else ()
80
  message(ERROR "Could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.")
81
82
endif ()
unset(_AMDIS_H CACHE)
83
84


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# MTL4 libraries
# --------------------
enable_mtl4(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)


if (AMDIS_FIND_REQUIRED_PARALLEL AND AMDIS_FIND_REQUIRED_SEQUENTIAL)
  message(WARNING "Choose either SEQUENTIAL or PARALLEL as component, not both! Falling back to the default SEQUENTIAL.")
  set(AMDIS_FIND_REQUIRED_PARALLEL OFF)
endif ()

# enable component PARALLEL
# -------------------------
if (AMDIS_FIND_REQUIRED_PARALLEL)
  set(AMDIS_HAS_PARALLEL_DOMAIN ON)
  set(POSTFIX "-parallel")
else ()
  set(AMDIS_HAS_PARALLEL_DOMAIN OFF)
  set(POSTFIX "")
endif (AMDIS_FIND_REQUIRED_PARALLEL)


106
107
# AMDiS base libraries
# --------------------
108
find_library(_AMDIS_LIB amdis${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
109
110
111
if (_AMDIS_LIB)
  list(APPEND AMDIS_LIBRARIES ${_AMDIS_LIB})
else ()
112
  message(ERROR "Could not detect the AMDiS${POSTFIX} library. Please set the variable _AMDIS_LIB to the AMDiS${POSTFIX} library.")
113
114
endif ()
unset(_AMDIS_LIB CACHE)
115
116


117
118
119
# Boost libraries
# ---------------
if (NOT BOOST_ROOT)
120
  set(BOOST_ROOT @BOOST_ROOT@)
121
122
endif (NOT BOOST_ROOT)
if (NOT BOOST_LIBRARYDIR)
123
  set(BOOST_LIBRARYDIR @BOOST_LIBRARYDIR@)
124
125
126
endif (NOT BOOST_LIBRARYDIR)
enable_boost(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)

127

128
129
130
# umfpack library
# --------------------
if (AMDIS_NEED_UMFPACK)
131
132
133
134
  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)
135
endif (AMDIS_NEED_UMFPACK)
136
137


138
139
140
# amdis extensions
# ----------------
if (AMDIS_NEED_EXTENSIONS)
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
  find_library(_EXTENSIONS_LIB amdis${POSTFIX}_extensions 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 ${_EXTENSIONS_LIB})
    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)
157
endif (AMDIS_NEED_EXTENSIONS)
158

159

160
161
162
# reinit library
# --------------
if (AMDIS_NEED_REINIT)
163
164
165
166
167
168
169
170
  find_library(_REINIT_LIB amdis${POSTFIX}_reinit PATHS ${AMDIS_DIR}/../../lib/amdis/)
  if (_REINIT_LIB)
    list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit)
    list(APPEND AMDIS_LIBRARIES ${_REINIT_LIB})
  else ()
    message(FATAL_ERROR "Reinit library not found")
  endif ()
  unset(_REINIT_LIB CACHE)
171
endif (AMDIS_NEED_REINIT)
172

173

174
175
176
# compositeFEM library
# --------------------
if (AMDIS_NEED_COMPOSITE_FEM)
177
178
179
180
181
182
183
184
  find_library(_COMPOSITE_FEM_LIB amdis${POSTFIX}_compositeFEM PATHS ${AMDIS_DIR}/../../lib/amdis/)
  if (_COMPOSITE_FEM_LIB)
    list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM)
    list(APPEND AMDIS_LIBRARIES ${_COMPOSITE_FEM_LIB})
  else ()
    message(FATAL_ERROR "CompositeFEM library not found")
  endif ()
  unset(_COMPOSITE_FEM_LIB CACHE)
185
endif (AMDIS_NEED_COMPOSITE_FEM)
Thomas Witkowski's avatar
Thomas Witkowski committed
186

187

188
189
190
191
# muparser library
# --------------------
find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_MUPARSER_LIB)
192
193
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)
  list(APPEND AMDIS_LIBRARIES ${_MUPARSER_LIB})
194
else ()
195
  message(ERROR "MuParser library not found")
196
197
endif ()
unset(_MUPARSER_LIB CACHE)
198

199

200
201
202
203
204
205
206
207
208
# 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)

209
210
# Zoltan library
# --------------
211
212
213
if (AMDIS_NEED_ZOLTAN)
  enable_zoltan(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif ()
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238


# 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 ()

if (ENABLE_PNG)
  enable_png(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif (ENABLE_PNG)

# 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")
239
endif ()