AMDISConfig.cmake.in 5.68 KB
Newer Older
1
2
# This configuration file is shipped with the great FEM-Toolbox AMDiS.
# It simplifies the configure of different amdis-versions.
3
#
4
5
6
7
# In order to compile an amdis-project and link against the amdis
# (and subsequent) libraries simply add 'AMDiS' to the target_link_libraries
# of your executable target. All include-paths and additional libraries are
# automatically added.
8
9
10
11
#
# For a fast start, you use this package in the following way
# simply look for it, possibly set the AMDiS directory
#
12
13
14
#   find_package(AMDiS REQUIRED)
#   add_executable(yourTarget <yourSources>)
#   target_link_libraries(yourTarget AMDiS)
15
16
#

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

21
list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})
22

23
set(IS_AMDISCONFIG true)
24

25
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
26
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
Praetorius, Simon's avatar
Praetorius, Simon committed
27
set(AMDIS_NEED_CXX11 @ENABLE_CXX11@)
28
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
29
30
set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@)
31
32
set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@)
set(AMDIS_NEED_BASE_PROBLEMS @ENABLE_BASE_PROBLEMS@)
33
34
35
36
37
set(AMDIS_NEED_REINIT @ENABLE_REINIT@)
set(AMDIS_NEED_COMPOSITE_FEM @ENABLE_COMPOSITE_FEM@)

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

39
40
41
set(AMDIS_COMPILEFLAGS "")
set(AMDIS_INCLUDE_DIRS "")
set(AMDIS_LIBRARIES "")
42

Praetorius, Simon's avatar
Praetorius, Simon committed
43
if (AMDIS_NEED_CXX11)
44
45
46
    include(enable_cxx11)
    enable_cxx11(AMDIS_NEED_CXX11 AMDIS_COMPILEFLAGS)
    list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=1")
47
else ()
48
    list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=0")
Praetorius, Simon's avatar
Praetorius, Simon committed
49
50
endif (AMDIS_NEED_CXX11)

51

52
53
54
55
56
57
58
59
60
61
62
# 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})
    include(find_mtl4)
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)
63
64


65
66
67
68
69
70
71
72
73
# AMDiS base libraries
# --------------------
find_library(_AMDIS_LIB amdis PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_AMDIS_LIB)
  list(APPEND AMDIS_LIBRARIES ${_AMDIS_LIB})
else ()
  message(ERROR "Could not detect the AMDiS library. Please set the variable _AMDIS_LIB to the AMDiS library.")
endif ()
unset(_AMDIS_LIB CACHE)
74
75


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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)
include(enable_boost)
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)
    include(enable_umfpack)
    enable_umfpack(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif (AMDIS_NEED_UMFPACK)
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
# Parallel amdis
# --------------
if (AMDIS_HAS_PARALLEL_DOMAIN)
    list(APPEND AMDIS_COMPILEFLAGS "-DHAVE_PARALLEL_DOMAIN_AMDIS=1")

    include(enable_petsc)
    enable_mpi(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
    enable_petsc(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif (AMDIS_HAS_PARALLEL_DOMAIN)


# amdis extensions
# ----------------
if (AMDIS_NEED_EXTENSIONS)
    find_library(_EXTENSIONS_LIB amdis_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(ERROR "Extensions library not found")
    endif ()
    unset(_EXTENSIONS_LIB CACHE)
endif (AMDIS_NEED_EXTENSIONS)
129

130

131
132
133
134
135
136
137
138
139
# reinit library
# --------------
if (AMDIS_NEED_REINIT)
    find_library(_REINIT_LIB amdis_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(ERROR "Reinit library not found")
140
    endif ()
141
142
    unset(_REINIT_LIB CACHE)
endif (AMDIS_NEED_REINIT)
143

144

145
146
147
148
149
150
151
152
153
154
155
156
# compositeFEM library
# --------------------
if (AMDIS_NEED_COMPOSITE_FEM)
    find_library(_COMPOSITE_FEM_LIB amdis_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(ERROR "CompositeFEM library not found")
    endif ()
    unset(_COMPOSITE_FEM_LIB CACHE)
endif (AMDIS_NEED_COMPOSITE_FEM)
Thomas Witkowski's avatar
Thomas Witkowski committed
157

158

159
160
161
162
163
164
165
166
167
168
# 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)
169

170

171
172
# Zoltan library
# --------------
173
174
175
176
if (AMDIS_NEED_ZOLTAN)
  include(enable_zoltan)
  enable_zoltan(AMDIS_COMPILEFLAGS AMDIS_INCLUDE_DIRS AMDIS_LIBRARIES ON)
endif ()