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

if (${CMAKE_VERSION} VERSION_LESS "3.0")
    message(FATAL_ERROR "The Configuration file was created for CMake version >= 3.0")
endif ()

list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})

23
24
set(IS_AMDISCONFIG true)

Praetorius, Simon's avatar
Praetorius, Simon committed
25
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
26
27
28
29
30
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
set(AMDIS_NEED_CXX11 @ENABLE_CXX11@)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@)
31
32
33
34
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@)
35

36
set(BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
37
38
39
40
41

add_library(amdis_base INTERFACE)
add_library(AMDiS ALIAS amdis_base)

target_compile_definitions(amdis_base INTERFACE
42
43
      $<$<CONFIG:Release>:DEBUG=0>
      $<$<NOT:$<CONFIG:Release>>:DEBUG=1>)
44

45
if (AMDIS_NEED_CXX11)
46
47
48
49
  target_compile_features(amdis_base INTERFACE
      cxx_alias_templates
      cxx_auto_type
      cxx_lambdas
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
      cxx_override
      cxx_range_for
      cxx_static_assert
      cxx_variadic_templates)
  target_compile_definitions(amdis_base INTERFACE HAS_CXX11=1)
else ()
  target_compile_definitions(amdis_base INTERFACE HAS_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)
    target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR})
66
    include(find_mtl4)
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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)


# AMDiS base libraries
# --------------------
find_library(_AMDIS_LIB amdis PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_AMDIS_LIB)
    target_link_libraries(amdis_base INTERFACE ${_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)


# Boost libraries
# ---------------
86
87
88
89
90
91
92
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(find_boost)
93
94
95
96

# umfpack library
# --------------------
if (AMDIS_NEED_UMFPACK)
97
    set(AMDIS_SuiteSparse_DIR @SuiteSparse_DIR@)
98
    set(AMDIS_UMFPACK_INCLUDE_DIR @UMFPACK_INCLUDE_DIRS@)
99
100
    set(AMDIS_UMFPACK_LIB_DIR ${AMDIS_UMFPACK_INCLUDE_DIR}/../include)
    include(find_umfpack)
101
102
103
104
105
106
endif (AMDIS_NEED_UMFPACK)


# Parallel amdis
# --------------
if (AMDIS_HAS_PARALLEL_DOMAIN)
107
    target_compile_definitions(amdis_base INTERFACE
108
        HAVE_PARALLEL_DOMAIN_AMDIS=1)
109

110
111
    find_package(MPI REQUIRED)
    if (MPI_FOUND)
112
113
114
        target_include_directories(amdis_base INTERFACE ${MPI_INCLUDE_PATH})
        target_compile_options(amdis_base INTERFACE ${MPI_COMPILE_FLAGS})
        target_link_libraries(amdis_base INTERFACE ${MPI_LIBRARIES})
115
    endif (MPI_FOUND)
116

117
118
119
120
    set(PETSC_EXECUTABLE_RUNS ON)
    set(AMDIS_PETSC_DIR @PETSC_DIR@)
    include(find_petsc)
    if (PETSc_FOUND)
121
122
        target_include_directories(amdis_base INTERFACE ${PETSC_INCLUDES})
        target_link_libraries(amdis_base INTERFACE
123
            ${PETSC_LIBRARY_SYS}
124
125
            ${PETSC_LIBRARIES}
            blas lapack)
126
        target_compile_definitions(amdis_base INTERFACE
127
            HAVE_PARALLEL_PETSC=1)
128
    else()
129
        message(FATAL_ERROR "Could not find PETSc!")
130
131
132
133
    endif (PETSc_FOUND)
endif (AMDIS_HAS_PARALLEL_DOMAIN)


134
135
136
137
138
139
# amdis extensions
# ----------------
if (AMDIS_NEED_EXTENSIONS)
    find_library(_EXTENSIONS_LIB amdis_extensions PATHS ${AMDIS_DIR}/../../lib/amdis/)
    if (_EXTENSIONS_LIB)
        target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions)
140
141
142
        target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions/nanoflann)
        target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions/pugixml)
        target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions/time)
143
144
145
146
147
148
149
150
151
152
153
        target_link_libraries(amdis_base INTERFACE ${_EXTENSIONS_LIB})
        if (AMDIS_NEED_BASE_PROBLEMS)
            target_include_directories(amdis_base INTERFACE ${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)


154
155
# reinit library
# --------------
156
157
158
159
160
161
162
163
164
165
if (AMDIS_NEED_REINIT)
    find_library(_REINIT_LIB amdis_reinit PATHS ${AMDIS_DIR}/../../lib/amdis/)
    if (_REINIT_LIB)
        target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/reinit)
        target_link_libraries(amdis_base INTERFACE ${_REINIT_LIB})
    else ()
        message(ERROR "Reinit library not found")
    endif ()
    unset(_REINIT_LIB CACHE)
endif (AMDIS_NEED_REINIT)
166
167
168
169


# compositeFEM library
# --------------------
170
171
172
173
174
175
176
177
178
179
if (AMDIS_NEED_COMPOSITE_FEM)
    find_library(_COMPOSITE_FEM_LIB amdis_compositeFEM PATHS ${AMDIS_DIR}/../../lib/amdis/)
    if (_COMPOSITE_FEM_LIB)
        target_include_directories(amdis_base INTERFACE ${Boost_INCLUDE_DIR}/compositeFEM)
        target_link_libraries(amdis_base INTERFACE ${_COMPOSITE_FEM_LIB})
    else ()
        message(ERROR "CompositeFEM library not found")
    endif ()
    unset(_COMPOSITE_FEM_LIB CACHE)
endif (AMDIS_NEED_COMPOSITE_FEM)
180
181
182
183
184
185
186
187
188
189
190
191
192


# muparser library
# --------------------
find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_MUPARSER_LIB)
    target_include_directories(amdis_base INTERFACE ${Boost_INCLUDE_DIR}/muparser)
    target_link_libraries(amdis_base INTERFACE ${_MUPARSER_LIB})
else ()
    message(ERROR "MuParser library not found")
endif ()
unset(_MUPARSER_LIB CACHE)

193

194
195
196
197
198
199
200
201
202
203
# Zoltan library
# --------------
if (AMDIS_NEED_ZOLTAN)
    find_library(ZOLTAN_LIB zoltan HINTS ENV LIBRARY_PATH DOC "Full path to the zoltan library")
    if (ZOLTAN_LIB)
	target_link_libraries(amdis_base INTERFACE ${ZOLTAN_LIB})
    else()
	message(FATAL_ERROR "Could not find zoltan library!")
    endif()
endif ()
Praetorius, Simon's avatar
Praetorius, Simon committed
204
205

set(AMDIS_LIBRARIES AMDiS)