Commit 360312dc authored by Praetorius, Simon's avatar Praetorius, Simon

final CMakeLists reimplementation finished

parent 32fd7bcc
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(AMDiS)
......@@ -5,8 +6,8 @@ if (USE_NEW_CMAKE AND ${CMAKE_VERSION} VERSION_GREATER "3.0")
# Experimental implementation of new CMakeLists.txt
# Can be selected by calling cmake -DUSE_NEW_CMAKE=ON .
# Use only if you know what you are doing :-)
include(${AMDiS_SOURCE_DIR}/cmake3/CMakeLists_3.0.txt)
include(${AMDiS_SOURCE_DIR}/cmake3/CMakeLists.txt)
else ()
# By defualt the classical CMakeLists file ist used
include(${AMDiS_SOURCE_DIR}/cmake/CMakeLists_2.8.txt)
include(${AMDiS_SOURCE_DIR}/cmake/CMakeLists.txt)
endif ()
......@@ -20,19 +20,22 @@ endif ()
list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})
set(IS_AMDISCONFIG true)
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@)
set(BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
add_library(amdis_base INTERFACE)
add_library(AMDiS ALIAS amdis_base)
target_compile_definitions(amdis_base INTERFACE
$<$<CONFIG:Debug>:DEBUG=1>
$<$<CONFIG:Release>:DEBUG=0>)
$<$<CONFIG:Release>:DEBUG=0>
$<$<NOT:$<CONFIG:Release>>:DEBUG=1>)
if (AMDIS_NEED_CXX11)
target_compile_features(amdis_base INTERFACE
......@@ -55,7 +58,7 @@ 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})
target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/mtl4)
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 ()
......@@ -75,80 +78,51 @@ unset(_AMDIS_LIB CACHE)
# Boost libraries
# ---------------
set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time)
if (WIN32)
list(APPEND BOOST_LIBS_REQUIRED zlib)
if (AMDIS_NEED_COMPRESSION)
list(APPEND BOOST_LIBS_REQUIRED bzip2)
endif ()
endif ()
set(BOOST_VERSION "1.48")
find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED})
if (Boost_FOUND)
target_include_directories(amdis_base INTERFACE ${Boost_INCLUDE_DIR})
target_link_libraries(amdis_base INTERFACE ${Boost_LIBRARIES})
else ()
message(ERROR "Boost libraries not found")
endif(Boost_FOUND)
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)
# 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}/../lib)
find_file(UMFPACK_H umfpack.h HINTS ${AMDIS_UMFPACK_INCLUDE_DIR})
find_library(UMFPACK_LIBRARY umfpack HINTS ${AMDIS_UMFPACK_LIB_DIR})
if (UMFPACK_H AND UMFPACK_LIBRARY)
get_filename_component(UMFPACK_INCLUDE_DIRS ${UMFPACK_H} PATH)
target_include_directories(amdis_base INTERFACE ${UMFPACK_INCLUDE_DIRS})
find_library(AMD_LIBRARY amd HINTS ${AMDIS_UMFPACK_LIB_DIR})
find_library(BLAS_LIBRARY blas HINTS ${AMDIS_UMFPACK_LIB_DIR})
if (AMD_LIBRARY AND BLAS_LIBRARY)
target_link_libraries(amdis_base INTERFACE
${UMFPACK_LIBRARY}
${AMD_LIBRARY}
${BLAS_LIBRARY})
# TODO: add test whether umfpack is configured successfully
endif()
else()
message(FATAL_ERROR "Could not find the UMFPACK library")
endif()
set(AMDIS_UMFPACK_LIB_DIR ${AMDIS_UMFPACK_INCLUDE_DIR}/../include)
include(find_umfpack)
endif (AMDIS_NEED_UMFPACK)
# Parallel amdis
# --------------
if (AMDIS_HAS_PARALLEL_DOMAIN)
target_compile_definitions(amdis_base INTERFACE
HAVE_PARALLEL_DOMAIN_AMDIS=1)
find_package(MPI REQUIRED)
if (MPI_FOUND)
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})
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})
endif (MPI_FOUND)
set(PETSC_EXECUTABLE_RUNS ON)
set(AMDIS_PETSC_DIR @PETSC_DIR@)
include(find_petsc)
if (PETSc_FOUND)
target_include_directories(amdis_base INTERFACE ${PETSC_INCLUDES})
target_link_libraries(amdis_base INTERFACE
${PETSC_LIBRARY_SYS}
${PETSC_LIBRARIES})
target_include_directories(amdis_base INTERFACE ${PETSC_INCLUDES})
target_link_libraries(amdis_base INTERFACE
${PETSC_LIBRARY_SYS}
${PETSC_LIBRARIES}
blas lapack)
target_compile_definitions(amdis_base INTERFACE
HAVE_PARALLEL_PETSC=1)
else()
message(FATAL_ERROR "Could not find PETSc!")
message(FATAL_ERROR "Could not find PETSc!")
endif (PETSc_FOUND)
find_library(_AMDIS_PARALLEL_LIB amdis_parallel PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_AMDIS_PARALLEL_LIB)
target_link_libraries(amdis_base INTERFACE ${_AMDIS_PARALLEL_LIB})
else ()
message(ERROR "Could not detect the AMDiS::parallel library. Please set the variable _AMDIS_PARALLEL_LIB to this library.")
endif ()
unset(_AMDIS_PARALLEL_LIB CACHE)
endif (AMDIS_HAS_PARALLEL_DOMAIN)
......@@ -187,6 +161,7 @@ else ()
endif ()
unset(_MUPARSER_LIB CACHE)
# Zoltan library
# --------------
if (AMDIS_NEED_ZOLTAN)
......
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(AMDiS VERSION 0.9 LANGUAGES CXX)
message(WARNING "This is an experimental CMakeLists.txt file.")
set(BASE_DIR ${AMDiS_SOURCE_DIR})
set(SOURCE_DIR ${BASE_DIR}/src)
list(APPEND CMAKE_MODULE_PATH ${BASE_DIR}/cmake3)
option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" true)
option(ENABLE_CXX11 "Enable C++11 compiler features" false)
option(ENABLE_PARALLEL_DOMAIN "Use parallel domain decomposition" false)
option(ENABLE_UMFPACK "Use of UMFPACK solver" false)
option(ENABLE_COMPRESSION "Use output compression" false)
option(ENABLE_UMFPACK "Enable support for the UMFPACK solver" false)
option(ENABLE_COMPRESSION "Use output compression for vtu and arh files" false)
option(ENABLE_EXTENSIONS "Use extensions for AMDiS" false)
option(BUILD_SHARED_LIBS "Build all libraries as shared or static, default: shared" ON)
if (MSVC)
# if (${CMAKE_VERSION} VERSION_LESS "3.4")
set(BUILD_SHARED_LIBS OFF)
mark_as_advanced(BUILD_SHARED_LIBS)
message(WARNING "Currently we can only build static libraries wiht Visual Studio")
# elseif (BUILD_SHARED_LIBS)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true)
# set(MSVC_SHARED_LIBS true)
# endif ()
endif (MSVC)
add_library(amdis_base INTERFACE)
add_library(AMDiS::base ALIAS amdis_base)
target_include_directories(amdis_base INTERFACE ${SOURCE_DIR})
target_compile_definitions(amdis_base INTERFACE
$<$<CONFIG:Debug>:DEBUG=1>
$<$<CONFIG:Release>:DEBUG=0>)
$<$<CONFIG:Release>:DEBUG=0>
$<$<NOT:$<CONFIG:Release>>:DEBUG=1>)
if (ENABLE_CXX11)
target_compile_features(amdis_base INTERFACE
......@@ -37,7 +50,10 @@ endif (ENABLE_CXX11)
# ------------------------------------------------------------------------------
include(find_mtl4) # -> target mtl4
install(FILES ${BASE_DIR}/cmake3/find_mtl4.cmake DESTINATION share/amdis/)
include(find_boost) # -> target boost
install(FILES ${BASE_DIR}/cmake3/find_boost.cmake DESTINATION share/amdis/)
# ------------------------------------------------------------------------------
......@@ -65,7 +81,6 @@ add_library(amdis
${SOURCE_DIR}/DOFIndexed.cc
${SOURCE_DIR}/DOFMatrix.cc
${SOURCE_DIR}/DOFVector.cc
${SOURCE_DIR}/Debug.cc
${SOURCE_DIR}/DirichletBC.cc
${SOURCE_DIR}/DualTraverse.cc
${SOURCE_DIR}/ElInfo.cc
......@@ -82,8 +97,6 @@ add_library(amdis
${SOURCE_DIR}/FirstOrderTerm.cc
${SOURCE_DIR}/FixVec.cc
${SOURCE_DIR}/Global.cc
${SOURCE_DIR}/GlobalDOFNumbering.cc
${SOURCE_DIR}/GlobalElementNumbering.cc
${SOURCE_DIR}/Initfile.cc
${SOURCE_DIR}/Lagrange.cc
${SOURCE_DIR}/LeafData.cc
......@@ -100,7 +113,6 @@ add_library(amdis
${SOURCE_DIR}/ProblemInstat.cc
${SOURCE_DIR}/ProblemInterpol.cc
${SOURCE_DIR}/ProblemStat.cc
${SOURCE_DIR}/ProblemStatDbg.cc
${SOURCE_DIR}/Projection.cc
${SOURCE_DIR}/QPInfo.cc
${SOURCE_DIR}/QPsiPhi.cc
......@@ -167,29 +179,39 @@ add_library(amdis
${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc
${SOURCE_DIR}/time/RosenbrockMethod.cc
${SOURCE_DIR}/time/RosenbrockStationary.cc
)
)
add_library(amdis_debug INTERFACE)
target_sources(amdis_debug INTERFACE
${SOURCE_DIR}/Debug.cc
${SOURCE_DIR}/GlobalDOFNumbering.cc # not used by any other class
${SOURCE_DIR}/GlobalElementNumbering.cc # not used by any other class
${SOURCE_DIR}/ProblemStatDbg.cc
)
if (ENABLE_COMPRESSION)
target_compile_definitions(amdis PRIVATE HAVE_COMPRESSION=1)
endif (ENABLE_COMPRESSION)
if (ENABLE_UMFPACK)
target_compile_definitions(amdis PRIVATE HAVE_UMFPACK=1)
endif (ENABLE_UMFPACK)
include(amdis_parallel) # -> target AMDiS::parallel
include(amdis_parallel) # adds sources to amdis
include(amdis_reinit) # -> target AMDiS::reinit
include(amdis_compositeFEM) # -> target AMDiS::compositeFEM
include(amdis_extensions) # -> target AMDiS::extensions
include(muparser) # -> target muparser
if (MSVC)
target_compile_definitions(amdis PRIVATE
_SCL_SECURE_NO_WARNINGS
_CRT_SECURE_NO_WARNINGS)
_SCL_SECURE_NO_WARNINGS
_CRT_SECURE_NO_WARNINGS)
endif (MSVC)
target_link_libraries(amdis AMDiS::base AMDiS::reinit AMDiS::compositeFEM muparser)
if (ENABLE_PARALLEL_DOMAIN)
target_link_libraries(amdis AMDiS::parallel)
endif (ENABLE_PARALLEL_DOMAIN)
target_link_libraries(amdis AMDiS::base muparser
$<$<CONFIG:Debug>:amdis_debug>)
# specify how to install this target:
# -----------------------------------
......@@ -213,7 +235,3 @@ configure_file(${BASE_DIR}/cmake3/AMDISConfig.cmake.in
)
install(FILES ${AMDiS_BINARY_DIR}/AMDISConfig.cmake DESTINATION share/amdis/)
# file(GLOB CMAKE_FILES "${BASE_DIR}/cmake3/*.cmake")
# install(FILES ${CMAKE_FILES} DESTINATION share/amdis/)
......@@ -16,7 +16,7 @@ add_library(AMDiS::compositeFEM ALIAS amdis_compositeFEM)
target_compile_definitions(amdis_compositeFEM PUBLIC
HAVE_COMPOSITE_FEM=1)
target_include_directories(amdis_compositeFEM PRIVATE ${COMPOSITE_SOURCE_DIR})
target_link_libraries(amdis_compositeFEM amdis_base)
target_link_libraries(amdis_compositeFEM amdis)
# specify how to install this target:
# -----------------------------------
......
if (ENABLE_EXTENSIONS)
option(ENABLE_BASE_PROBLEMS "Use base_problems" true)
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 'ExtendedProblemStath'")
endif ()
add_library(amdis_extensions
${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
)
add_library(AMDiS::extensions ALIAS amdis_extensions)
target_compile_definitions(amdis_extensions PRIVATE HAVE_EXTENSIONS=1)
target_include_directories(amdis_extensions PRIVATE
${EXTENSIONS_DIR}
${EXTENSIONS_DIR}/time
${EXTENSIONS_DIR}/nanoflann
${EXTENSIONS_DIR}/pugixml/src
)
set(INSTALL_SUBDIRS . time preconditioner nanflann)
if (ENABLE_SEQ_PETSC)
target_sources(amdis_extensions PRIVATE
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif (ENABLE_SEQ_PETSC)
if (ENABLE_PARALLEL_DOMAIN)
target_sources(amdis_extensions PRIVATE
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
target_link_libraries(amdis_extensions amdis_parallel)
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_BASE_PROBLEMS)
target_sources(amdis_extensions PRIVATE
${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
${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
${EXTENSIONS_DIR}/base_problems/PolarizationField.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal_RB.cc)
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/VacancyPhaseFieldCrystal.cc
target_compile_definitions(amdis_extensions PRIVATE HAVE_BASE_PROBLEMS=1)
target_include_directories(amdis_extensions PRIVATE ${EXTENSIONS_DIR}/base_problems)
list(APPEND INSTALL_SUBDIRS base_problems)
endif (ENABLE_BASE_PROBLEMS)
target_link_libraries(amdis_extensions amdis amdis_reinit)
# specify how to install this target:
# -----------------------------------
foreach (SUBDIR ${INSTALL_SUBDIRS})
file(GLOB HEADERS "${EXTENSIONS_DIR}/${SUBDIR}/*.h*")
install(FILES ${HEADERS} DESTINATION include/amdis/extensions/${SUBDIR}/)
endforeach ()
file(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
install(FILES ${HEADERS} DESTINATION include/amdis/extensions/pugixml/)
install(TARGETS amdis_extensions DESTINATION lib/amdis/)
endif (EXTENSIONS_DIR)
endif (ENABLE_EXTENSIONS)
......@@ -2,99 +2,112 @@ if (ENABLE_PARALLEL_DOMAIN)
option(ENABLE_ZOLTAN "Add support for the Parallel Partitioning suite Zoltan" false)
option(ENABLE_PARALLEL_SOLVERS "Add some problem dependent solver, e.g. Feti, Navier-Stokes and Cahn-Hilliard" false)
add_library(amdis_parallel
${SOURCE_DIR}/parallel/BddcMlSolver.cc
${SOURCE_DIR}/parallel/DofComm.cc
${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectDatabase.cc
${SOURCE_DIR}/parallel/InteriorBoundary.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshLevelData.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
${SOURCE_DIR}/parallel/MeshPartitioner.cc
${SOURCE_DIR}/parallel/MpiHelper.cc
${SOURCE_DIR}/parallel/ParallelDebug.cc
${SOURCE_DIR}/parallel/ParallelDofMapping.cc
${SOURCE_DIR}/parallel/ParallelProblemStat.cc
${SOURCE_DIR}/parallel/ParallelSolver.cc
${SOURCE_DIR}/parallel/PeriodicMap.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/StdMpi.cc
${SOURCE_DIR}/parallel/ZoltanPartitioner.cc
add_library(amdis_parallel INTERFACE)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/DofComm.cc
${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectDatabase.cc
${SOURCE_DIR}/parallel/InteriorBoundary.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshLevelData.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
${SOURCE_DIR}/parallel/MeshPartitioner.cc
${SOURCE_DIR}/parallel/MpiHelper.cc
${SOURCE_DIR}/parallel/ParallelDofMapping.cc
${SOURCE_DIR}/parallel/ParallelProblemStat.cc
${SOURCE_DIR}/parallel/ParallelSolver.cc
${SOURCE_DIR}/parallel/PeriodicMap.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/StdMpi.cc
)
target_sources(amdis_debug INTERFACE
${SOURCE_DIR}/parallel/ParallelDebug.cc
)
add_library(AMDiS::parallel ALIAS amdis_parallel)
target_compile_definitions(amdis_parallel PUBLIC
HAVE_PARALLEL_DOMAIN_AMDIS=1)
target_link_libraries(amdis_parallel amdis_base)
target_compile_definitions(amdis_parallel INTERFACE
HAVE_PARALLEL_DOMAIN_AMDIS=1)
# MPI is required
find_package(MPI REQUIRED)
if (MPI_FOUND)
target_include_directories(amdis_parallel PUBLIC
${MPI_INCLUDE_PATH})
target_compile_options(amdis_parallel PUBLIC
${MPI_COMPILE_FLAGS})
target_include_directories(amdis_parallel INTERFACE
${MPI_INCLUDE_PATH})
target_compile_options(amdis_parallel INTERFACE
${MPI_COMPILE_FLAGS})
endif (MPI_FOUND)
# PETSc library is required
set(PETSC_EXECUTABLE_RUNS ON)
include(find_petsc)
if (PETSc_FOUND)
target_include_directories(amdis_parallel PUBLIC
${PETSC_DIR}/include
${PETSC_DIR}/${PETSC_ARCH}/include)
# parmetis is required
find_file(PARMETIS_HEADER_FILE "parmetis.h" HINTS ${PETSC_DIR}/include )
if (PARMETIS_HEADER_FILE)
get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE)
target_include_directories(amdis_parallel PUBLIC ${PARMETIS_INCLUDE_PATH})
else()
message(FATAL_ERROR "Could not find ParMetis header file 'parmetis.h'!")
endif (PARMETIS_HEADER_FILE)
# add support for the zoltan library
if (ENABLE_ZOLTAN)
find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" HINTS ${PETSC_DIR}/include)
if (ZOLTAN_HEADER_FILE)
get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
target_include_directories(amdis_parallel PRIVATE ${ZOLTAN_HEADER_DIR})
target_compile_definitions(amdis_parallel PRIVATE HAVE_ZOLTAN=1)
else()
message(FATAL_ERROR "Could not find Zoltan include file 'zoltan_cpp.h'!")
endif(ZOLTAN_HEADER_FILE)
endif (ENABLE_ZOLTAN)
# add some more source-files that need petsc
target_sources(amdis_parallel PRIVATE
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
${SOURCE_DIR}/parallel/PetscHelper.cc
${SOURCE_DIR}/parallel/PetscSolver.cc
${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc
${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc
${SOURCE_DIR}/solver/PetscTypes.cc
)
if (ENABLE_PARALLEL_SOLVERS)
target_sources(amdis_parallel PRIVATE
${SOURCE_DIR}/parallel/PetscSolverFeti.cc
${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc
${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc
${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc
${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc
${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc
${SOURCE_DIR}/parallel/PetscSolverNSCH.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc
${SOURCE_DIR}/parallel/PetscSolverSchur.cc
)
endif (ENABLE_PARALLEL_SOLVERS)
target_compile_definitions(amdis_parallel PUBLIC
HAVE_PARALLEL_PETSC=1
PETSC_VERSION=${PETSC_VERSION})
target_include_directories(amdis_parallel INTERFACE
${PETSC_DIR}/include
${PETSC_DIR}/${PETSC_ARCH}/include)
# parmetis is required
find_file(PARMETIS_HEADER_FILE "parmetis.h" HINTS ${PETSC_DIR}/include )
if (PARMETIS_HEADER_FILE)
get_filename_component(PARMETIS_INCLUDE_PATH "${PARMETIS_HEADER_FILE}" PATH CACHE)
target_include_directories(amdis_parallel INTERFACE ${PARMETIS_INCLUDE_PATH})
else()
message(FATAL_ERROR "Could not find ParMetis header file 'parmetis.h'!")
endif (PARMETIS_HEADER_FILE)
# add support for the zoltan library
if (ENABLE_ZOLTAN)
find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" HINTS ${PETSC_DIR}/include)
if (ZOLTAN_HEADER_FILE)
get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
target_include_directories(amdis_parallel PRIINTERFACEVATE ${ZOLTAN_HEADER_DIR})
else()
message(FATAL_ERROR "Could not find Zoltan include file 'zoltan_cpp.h'!")
endif(ZOLTAN_HEADER_FILE)
target_compile_definitions(amdis_parallel INTERFACE HAVE_ZOLTAN=1)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/ZoltanPartitioner.cc)
endif (ENABLE_ZOLTAN)
if (ENABLE_BDDCML)
target_compile_definitions(amdis_parallel INTERFACE HAVE_BDDCML=1)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/BddcMlSolver.cc)
endif (ENABLE_BDDCML)
# add some more source-files that need petsc
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
${SOURCE_DIR}/parallel/PetscHelper.cc
${SOURCE_DIR}/parallel/PetscSolver.cc
${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc
${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc
${SOURCE_DIR}/solver/PetscTypes.cc
)
if (ENABLE_PARALLEL_SOLVERS)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/PetscSolverFeti.cc
${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc
${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc
${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc
${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc
${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc
${SOURCE_DIR}/parallel/PetscSolverNSCH.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc
${SOURCE_DIR}/parallel/PetscSolverSchur.cc
)
target_compile_definitions(amdis_parallel INTERFACE
HAVE_PARALLEL_SOLVERS=1)
endif (ENABLE_PARALLEL_SOLVERS)
target_compile_definitions(amdis_parallel INTERFACE
HAVE_PARALLEL_PETSC=1
PETSC_VERSION=${PETSC_VERSION})
target_link_libraries(amdis amdis_parallel ${PETSC_LIBRARIES} blas lapack)
endif (PETSc_FOUND)
# specify how to install this target:
......@@ -102,11 +115,10 @@ if (ENABLE_PARALLEL_DOMAIN)
file(GLOB AMDIS_PARALLEL_HEADERS "${SOURCE_DIR}/parallel/*.h")
install(FILES ${AMDIS_PARALLEL_HEADERS} DESTINATION include/amdis/parallel/)
install(TARGETS amdis_parallel DESTINATION lib/amdis/ )
install(FILES
${BASE_DIR}/cmake3/ResolveCompilerPaths.cmake
${BASE_DIR}/cmake3/FindPackageMultipass.cmake
${BASE_DIR}/cmake3/find_petsc.cmake
DESTINATION share/amdis/)
${BASE_DIR}/cmake3/ResolveCompilerPaths.cmake
${BASE_DIR}/cmake3/FindPackageMultipass.cmake
${BASE_DIR}/cmake3/find_petsc.cmake
DESTINATION share/amdis/)
endif (ENABLE_PARALLEL_DOMAIN)
......@@ -8,8 +8,8 @@ add_library(AMDiS::reinit ALIAS amdis_reinit)
target_compile_definitions(amdis_reinit PUBLIC
HAVE_REINIT=1)
target_include_directories(amdis_reinit PRIVATE ${REINIT_SOURCE_DIR})
target_link_libraries(amdis_reinit amdis_base)
target_include_directories(amdis_reinit PUBLIC ${REINIT_SOURCE_DIR})
target_link_libraries(amdis_reinit amdis)
# specify how to install this target:
# -----------------------------------
......
find_package(Boost 1.44 REQUIRED)
set(BOOST_VERSION "1.48")
set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time)
if (WIN32)
list(APPEND BOOST_LIBS_REQUIRED zlib)
if (ENABLE_COMPRESSION OR AMDIS_NEED_COMPRESSION)
list(APPEND BOOST_LIBS_REQUIRED bzip2)
endif (ENABLE_COMPRESSION OR AMDIS_NEED_COMPRESSION)
endif (WIN32)
if (NOT BUILD_SHARED_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif (NOT BUILD_SHARED_LIBS)
find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED})
if (Boost_FOUND)
add_library(boost INTERFACE)
target_include_directories(boost INTERFACE ${Boost_INCLUDE_DIR})
target_link_libraries(amdis_base INTERFACE boost)
add_library(boost INTERFACE)
target_include_directories(boost INTERFACE ${Boost_INCLUDE_DIR})
target_link_libraries(boost INTERFACE ${Boost_LIBRARIES})
target_link_libraries(amdis_base INTERFACE boost)
if (MSVC_SHARED_LIBS)
link_directories(${Boost_LIBRARY_DIRS})
target_compile_definitions(amdis_base INTERFACE ${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
endif (MSVC_SHARED_LIBS)
endif (Boost_FOUND)
find_package(MTL REQUIRED HINTS ${BASE_DIR}/lib/mtl4)
# hide options of MTL4 and use the AMDiS replacement
mark_as_advanced(ENABLE_CXX_ELEVEN)
mark_as_advanced(ENABLE_SHORT_ELE_PROD)
mark_as_advanced(ENABLE_VAMPIR)
if (MTL_FOUND)
add_library(mtl4 INTERFACE)
add_library(mtl4 INTERFACE)
if (IS_AMDISCONFIG)
target_include_directories(mtl4 INTERFACE ${AMDIS_INCLUDE_DIR}/mtl4)
else ()
target_include_directories(mtl4 INTERFACE ${BASE_DIR}/lib/mtl4)
endif (IS_AMDISCONFIG)
if (ENABLE_CXX11)
target_compile_features(mtl4 INTERFACE
cxx_rvalue_references
cxx_auto_type
cxx_range_for
cxx_generalized_initializers
cxx_static_assert
cxx_defaulted_functions)
target_include_directories(mtl4 INTERFACE
$<BUILD_INTERFACE:${MTL_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:include/amdis/mtl4>)
if (ENABLE_CXX11)
string (REPLACE "-std=c++0x" "" MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
string (REPLACE "-std=c++11" "" MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
string (REPLACE "-std=gnu++0x" "" MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
string (REPLACE "-std=gnu++11" "" MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
target_compile_features(mtl4 INTERFACE
cxx_rvalue_references
cxx_auto_type
cxx_range_for
cxx_generalized_initializers
cxx_static_assert
cxx_defaulted_functions)
set(ENABLE_CXX_ELEVEN true)
else ()
set(ENABLE_CXX_ELEVEN false)
endif ()
if (ENABLE_UMFPACK)
target_compile_definitions(mtl4 INTERFACE HAVE_UMFPACK=1)
endif (ENABLE_UMFPACK)
target_compile_options(mtl4 INTERFACE ${MTL_CXX_DEFINITIONS})
target_link_libraries(mtl4 INTERFACE ${MTL_LIBRARIES})
set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
foreach (feature ${CXX_ELEVEN_FEATURE_LIST})
target_compile_definitions(mtl4 INTERFACE MTL_WITH_${feature})
endforeach ()
endif (ENABLE_CXX11)
if (ENABLE_OPENMP)
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
target_compile_definitions(mtl4 INTERFACE MTL_WITH_OPENMP)
target_compile_options(mtl4 INTERFACE ${OpenMP_CXX_FLAGS})
else ()
message(FATAL_ERROR "OpenMP not found")
endif (OPENMP_FOUND)
endif (ENABLE_OPENMP)
if (NOT IS_AMDISCONFIG)
include(find_umfpack)
# specify how to install this target:
# -----------------------------------
install(DIRECTORY ${MTL_DIR}/
DESTINATION include/amdis/mtl4/
FILES_MATCHING PATTERN "*.hpp"
PATTERN ".svn" EXCLUDE
PATTERN ".svn/*" EXCLUDE
PATTERN "mtl4/libs" EXCLUDE
PATTERN "mtl4/extern" EXCLUDE)
target_link_libraries(amdis_base INTERFACE mtl4)
endif (MTL_FOUND)