Commit 59a9d7d5 authored by Praetorius, Simon's avatar Praetorius, Simon

cmake old and new versions cleaned up

parent b0040535
......@@ -2,9 +2,69 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(AMDiS)
if (${CMAKE_VERSION} VERSION_GREATER "3.2")
include(${AMDiS_SOURCE_DIR}/cmake3/CMakeLists.txt)
set(AMDiS_VERSION "1.1.0")
set(BASE_DIR ${AMDiS_SOURCE_DIR})
set(SOURCE_DIR ${BASE_DIR}/src)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif ()
# ------------------------------------------------------------------------------
# some options to control the build process
option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition" false)
option(ENABLE_UMFPACK "Enable support for the UMFPACK solver" true)
option(ENABLE_EXTENSIONS "Use extensions for AMDiS" false)
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
option(ENABLE_PNG "Use png reader/writer" false)
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
# enable/disable some more features
option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" true)
mark_as_advanced(ENABLE_COMPRESSION)
option(ENABLE_REINIT "Compile reinit library" true)
mark_as_advanced(ENABLE_REINIT)
option(ENABLE_COMPOSITE_FEM "Compile compositeFEM library" true)
mark_as_advanced(ENABLE_COMPOSITE_FEM)
option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" true)
mark_as_advanced(BUILD_SHARED_LIBS)
if (MSVC)
set(BUILD_SHARED_LIBS false)
mark_as_advanced(BUILD_SHARED_LIBS)
message(WARNING "Currently we can only build static libraries with Visual Studio")
endif (MSVC)
# parallel of sequential version
if (ENABLE_PARALLEL_DOMAIN)
set(_POSTFIX "-p")
else ()
set(_POSTFIX "-s")
endif ()
set(POSTFIX "${_POSTFIX}$<$<CONFIG:Debug>:d>")
# ------------------------------------------------------------------------------
if (${CMAKE_VERSION} VERSION_LESS "3.2")
# Fallback to classical CMakeLists file
include(${AMDiS_SOURCE_DIR}/cmake/CMakeLists.txt)
else ()
include(${AMDiS_SOURCE_DIR}/cmake3/CMakeLists.txt)
endif ()
# ------------------------------------------------------------------------------
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${AMDiS_BINARY_DIR}/AMDISConfigVersion.cmake
VERSION ${AMDiS_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES ${AMDiS_BINARY_DIR}/AMDISConfigVersion.cmake DESTINATION share/amdis/)
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 ()
......@@ -18,7 +18,7 @@
#
if (${CMAKE_VERSION} VERSION_LESS "2.8.10")
message(FATAL_ERROR "The Configuration file was created for CMake version >= 2.8.10")
message(FATAL_ERROR "The Configuration file was created for CMake version >= 2.8.10")
endif ()
list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})
......@@ -26,28 +26,8 @@ list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})
set(IS_AMDISCONFIG true)
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
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 "")
# Include macros
# ----------------
include(enable_cxx11)
include(enable_mtl4)
include(enable_boost)
......@@ -58,182 +38,30 @@ include(enable_bddcml)
include(enable_hypre)
include(enable_png)
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)
# enable components
# -----------------
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
# -------------------------
set(AMDIS_CONFIGURATION "")
# parallel of sequential version
if (AMDIS_FIND_REQUIRED_PARALLEL)
set(AMDIS_HAS_PARALLEL_DOMAIN ON)
set(POSTFIX "-parallel")
set(POSTFIX "-p")
list(APPEND AMDIS_CONFIGURATION "PARALLEL")
else ()
set(AMDIS_HAS_PARALLEL_DOMAIN OFF)
set(POSTFIX "")
endif (AMDIS_FIND_REQUIRED_PARALLEL)
# AMDiS base libraries
# --------------------
find_library(_AMDIS_LIB amdis${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_AMDIS_LIB)
list(APPEND AMDIS_LIBRARIES ${_AMDIS_LIB})
else ()
message(ERROR "Could not detect the AMDiS${POSTFIX} library. Please set the variable _AMDIS_LIB to the AMDiS${POSTFIX} library.")
set(POSTFIX "-s")
list(APPEND AMDIS_CONFIGURATION "SEQUENTIAL")
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 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)
endif (AMDIS_NEED_EXTENSIONS)
# reinit library
# --------------
if (AMDIS_NEED_REINIT)
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)
endif (AMDIS_NEED_REINIT)
# compositeFEM library
# --------------------
if (AMDIS_NEED_COMPOSITE_FEM)
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)
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")
if (NOT EXISTS ${AMDIS_DIR}/AMDIS${POSTFIX}.cmake)
message(FATAL_ERROR "Configuration ${AMDIS_CONFIGURATION} can not be found in ${AMDIS_DIR}.")
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 ()
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")
endif ()
\ No newline at end of file
# include component configuration
include(AMDIS${POSTFIX})
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 OLD)
endif()
project(AMDiS)
set(BASE_DIR ${AMDiS_SOURCE_DIR})
set(SOURCE_DIR ${BASE_DIR}/src)
list(APPEND CMAKE_MODULE_PATH ${BASE_DIR}/cmake)
# set some policies
cmake_policy(SET CMP0017 OLD)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif ()
list(APPEND CMAKE_MODULE_PATH ${BASE_DIR}/cmake)
# Include macros
include(enable_cxx11)
......@@ -22,35 +28,6 @@ include(enable_png)
# ------------------------------------------------------------------------------
#some options to control the build process
option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition" false)
option(ENABLE_UMFPACK "Enable support for the UMFPACK solver" true)
option(ENABLE_EXTENSIONS "Use extensions for AMDiS" false)
option(ENABLE_HYPRE "Use HYPRE AMG solver" false)
option(ENABLE_PNG "Use png reader/writer" false)
option(ENABLE_SEQ_PETSC "Use sequential PETSc solvers" false)
# enable/disable some more features
option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" true)
mark_as_advanced(ENABLE_COMPRESSION)
option(ENABLE_REINIT "Compile reinit library" true)
mark_as_advanced(ENABLE_REINIT)
option(ENABLE_COMPOSITE_FEM "Compile compositeFEM library" true)
mark_as_advanced(ENABLE_COMPOSITE_FEM)
option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" true)
mark_as_advanced(BUILD_SHARED_LIBS)
if (MSVC)
set(BUILD_SHARED_LIBS false)
mark_as_advanced(BUILD_SHARED_LIBS)
message(WARNING "Currently we can only build static libraries with Visual Studio")
endif (MSVC)
# ------------------------------------------------------------------------------
include_directories(${SOURCE_DIR})
set(AMDIS_INCLUDE_DIRS "")
set(COMPILEFLAGS "")
......@@ -206,26 +183,36 @@ list(APPEND AMDIS_SRC
)
include(amdis_parallel)
include(amdis_extensions)
include(muparser)
# ------------------------------------------------------------------------------
if (ENABLE_PARALLEL_DOMAIN)
set(POSTFIX "-parallel")
else ()
set(POSTFIX "")
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_COMPRESSION)
list(APPEND COMPILEFLAGS "-DHAVE_COMPRESSION=1")
endif (ENABLE_COMPRESSION)
if (ENABLE_EXTENSIONS)
include(amdis_extensions)
add_library(amdis_extensions ${EXTENSIONS_SRC})
set_target_properties(amdis_extensions PROPERTIES OUTPUT_NAME amdisextensions${POSTFIX})
install(TARGETS amdis_extensions DESTINATION lib/amdis/ )
endif (ENABLE_EXTENSIONS)
if (ENABLE_REINIT)
include(amdis_reinit)
add_library(amdis_reinit ${REINIT_SRC})
set_target_properties(amdis_reinit PROPERTIES OUTPUT_NAME amdisreinit${POSTFIX})
install(TARGETS amdis_reinit DESTINATION lib/amdis/ )
endif (ENABLE_REINIT)
if (ENABLE_COMPOSITE_FEM)
include(amdis_compositeFEM)
add_library(amdis_compositeFEM ${COMPOSITE_FEM_SRC})
set_target_properties(amdis_compositeFEM PROPERTIES OUTPUT_NAME amdiscompositefem${POSTFIX})
install(TARGETS amdis_compositeFEM DESTINATION lib/amdis/ )
endif (ENABLE_COMPOSITE_FEM)
if (ENABLE_SEQ_PETSC)
......@@ -241,13 +228,12 @@ endif (MSVC)
include_directories(${AMDIS_INCLUDE_DIRS})
add_definitions(${COMPILEFLAGS})
add_library(amdis${POSTFIX} ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC} ${EXTENSIONS_SRC})
add_library(amdis${POSTFIX}_compositeFEM ${COMPOSITE_FEM_SRC})
add_library(amdis${POSTFIX}_reinit ${REINIT_SRC})
add_library(amdis ${AMDIS_SRC} ${PARALLEL_DOMAIN_AMDIS_SRC})
# specify how to install this target:
# -----------------------------------
set(INSTALL_SUBDIRS . config nonlin est expressions operations traits
utility time solver solver/details solver/itl io io/detail)
......@@ -266,19 +252,25 @@ install(DIRECTORY ${BASE_DIR}/lib/mtl4/ DESTINATION include/amdis/mtl4/
PATTERN "mtl4/libs" EXCLUDE
PATTERN "mtl4/extern" EXCLUDE)
install(TARGETS
amdis${POSTFIX}
amdis${POSTFIX}_compositeFEM
amdis${POSTFIX}_reinit
DESTINATION lib/amdis/ )
set_target_properties(amdis PROPERTIES OUTPUT_NAME amdis${POSTFIX})
install(TARGETS amdis DESTINATION lib/amdis/ )
# generate configuration file:
# ----------------------------
# global configuration
configure_file(${BASE_DIR}/cmake/AMDISConfig.cmake.in
${AMDiS_BINARY_DIR}/AMDISConfig.cmake
@ONLY
)
# component configuration
configure_file(${BASE_DIR}/cmake/AMDIS.cmake.in
${AMDiS_BINARY_DIR}/AMDIS${_POSTFIX}.cmake
@ONLY
)
install(FILES ${AMDiS_BINARY_DIR}/AMDISConfig.cmake DESTINATION share/amdis/)
install(FILES ${BASE_DIR}/cmake/AMDISUse.cmake DESTINATION share/amdis/)
install(FILES ${AMDiS_BINARY_DIR}/AMDIS${_POSTFIX}.cmake DESTINATION share/amdis/)
install(FILES ${BASE_DIR}/cmake3/AMDISUse.cmake DESTINATION share/amdis/)
if (ENABLE_EXTENSIONS)
option(ENABLE_BASE_PROBLEMS "Use base_problems" true)
mark_as_advanced(ENABLE_BASE_PROBLEMS)
option(ENABLE_BASE_PROBLEMS "Use base_problems" true)
mark_as_advanced(ENABLE_BASE_PROBLEMS)
find_path(EXTENSIONS_DIR NAMES Helpers.h
HINTS ${BASE_DIR}/../extensions
DOC "Path to AMDiS extensions.")
if (EXTENSIONS_DIR)
if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/ExtendedProblemStat.h)
message(FATAL_ERROR "Wrong extensions directory! Directory must contain the files 'Helpers.h' and 'ExtendedProblemStat.h'")
endif ()
find_path(EXTENSIONS_DIR NAMES Helpers.h
HINTS ${BASE_DIR}/../extensions
DOC "Path to AMDiS extensions.")
if (EXTENSIONS_DIR)
if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/ExtendedProblemStat.h)
message(FATAL_ERROR "Wrong extensions directory! Directory must contain the files 'Helpers.h' and 'ExtendedProblemStat.h'")
endif ()
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/Helpers.cc
${EXTENSIONS_DIR}/BackgroundMesh.cc
${EXTENSIONS_DIR}/GeometryTools.cc
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/SingularDirichletBC2.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp
)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/Helpers.cc
${EXTENSIONS_DIR}/BackgroundMesh.cc
${EXTENSIONS_DIR}/GeometryTools.cc
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/SingularDirichletBC2.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp
)
list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
list(APPEND AMDIS_INCLUDE_DIRS
${EXTENSIONS_DIR}
${EXTENSIONS_DIR}/time
${EXTENSIONS_DIR}/nanoflann
${EXTENSIONS_DIR}/pugixml/src
)
list(APPEND COMPILEFLAGS "-DHAVE_EXTENSIONS=1")
list(APPEND AMDIS_INCLUDE_DIRS
${EXTENSIONS_DIR}
${EXTENSIONS_DIR}/time
${EXTENSIONS_DIR}/nanoflann
${EXTENSIONS_DIR}/pugixml/src
)
set(INSTALL_SUBDIRS . time preconditioner nanoflann)
set(INSTALL_SUBDIRS . time preconditioner nanoflann)
if (ENABLE_SEQ_PETSC)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif (ENABLE_SEQ_PETSC)
if (ENABLE_SEQ_PETSC)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif (ENABLE_SEQ_PETSC)
if (ENABLE_PARALLEL_DOMAIN)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_PARALLEL_DOMAIN)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_BASE_PROBLEMS)
if (ENABLE_REINIT)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliard_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc)
endif (ENABLE_REINIT)
if (ENABLE_BASE_PROBLEMS)
if (ENABLE_REINIT)
list(APPEND EXTENSIONS_SRC
${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc