Commit 87169e40 authored by Praetorius, Simon's avatar Praetorius, Simon

another CMakeLists correction

parent 81da3eca
# This configuration file is shipped with the great FEM-Toolbox AMDiS.
# It simplifies the configure of different amdis-versions.
#
# In order to compile an amdis-project and link against the amdis
# 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
# of your executable target. All include-paths and additional libraries are
# automatically added.
#
#
# For a fast start, you use this package in the following way
# simply look for it, possibly set the AMDiS directory
#
......@@ -28,6 +28,10 @@ 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(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(BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
......@@ -37,12 +41,12 @@ add_library(AMDiS ALIAS amdis_base)
target_compile_definitions(amdis_base INTERFACE
$<$<CONFIG:Release>:DEBUG=0>
$<$<NOT:$<CONFIG:Release>>:DEBUG=1>)
if (AMDIS_NEED_CXX11)
target_compile_features(amdis_base INTERFACE
cxx_alias_templates
cxx_auto_type
cxx_lambdas
target_compile_features(amdis_base INTERFACE
cxx_alias_templates
cxx_auto_type
cxx_lambdas
cxx_override
cxx_range_for
cxx_static_assert
......@@ -100,26 +104,26 @@ endif (AMDIS_NEED_UMFPACK)
# Parallel amdis
# --------------
if (AMDIS_HAS_PARALLEL_DOMAIN)
target_compile_definitions(amdis_base INTERFACE
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})
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_LIBRARY_SYS}
${PETSC_LIBRARIES}
blas lapack)
target_compile_definitions(amdis_base INTERFACE
target_compile_definitions(amdis_base INTERFACE
HAVE_PARALLEL_PETSC=1)
else()
message(FATAL_ERROR "Could not find PETSc!")
......@@ -127,28 +131,49 @@ if (AMDIS_HAS_PARALLEL_DOMAIN)
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)
target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions)
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)
# reinit library
# --------------
find_library(_REINIT_LIB amdis_reinit PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_REINIT_LIB)
target_include_directories(amdis_base INTERFACE ${Boost_INCLUDE_DIR}/reinit)
target_link_libraries(amdis_base INTERFACE ${_REINIT_LIB})
else ()
message(ERROR "Reinit library not found")
endif ()
unset(_REINIT_LIB CACHE)
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)
# compositeFEM library
# --------------------
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)
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)
# muparser library
......
......@@ -13,6 +13,12 @@ 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)
# enable/disable some more features
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" ON)
if (MSVC)
# if (${CMAKE_VERSION} VERSION_LESS "3.4")
......@@ -198,8 +204,15 @@ if (ENABLE_UMFPACK)
endif (ENABLE_UMFPACK)
include(amdis_parallel) # adds sources to amdis
include(amdis_reinit) # -> target AMDiS::reinit
include(amdis_compositeFEM) # -> target AMDiS::compositeFEM
if (ENABLE_REINIT)
include(amdis_reinit) # -> target AMDiS::reinit
endif (ENABLE_REINIT)
if (ENABLE_COMPOSITE_FEM)
include(amdis_compositeFEM) # -> target AMDiS::compositeFEM
endif (ENABLE_COMPOSITE_FEM)
include(amdis_extensions) # -> target AMDiS::extensions
include(muparser) # -> target muparser
......
......@@ -7,7 +7,7 @@ if (ENABLE_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'")
message(FATAL_ERROR "Wrong extensions directory! Directory must contain the files 'Helpers.h' and 'ExtendedProblemStat.h'")
endif ()
add_library(amdis_extensions
......@@ -46,13 +46,16 @@ if (ENABLE_EXTENSIONS)
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_BASE_PROBLEMS)
if (ENABLE_REINIT)
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)
endif (ENABLE_REINIT)
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
......
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)
option(ENABLE_PARALLEL_SOLVERS "Add some problem dependent solver, e.g. Feti, Navier-Stokes and Cahn-Hilliard" true)
mark_as_advanced(ENABLE_PARALLEL_SOLVERS)
add_library(amdis_parallel INTERFACE)
target_sources(amdis PRIVATE
......
if (BOOST_ROOT)
file(TO_NATIVE_PATH ${BOOST_ROOT} BOOST_ROOT)
endif (BOOST_ROOT)
if (BOOST_LIBRARYDIR)
file(TO_NATIVE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
endif (BOOST_LIBRARYDIR)
set(BOOST_VERSION "1.48")
set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time)
if (WIN32)
......@@ -15,9 +22,9 @@ if (Boost_FOUND)
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})
......
......@@ -42,6 +42,10 @@ function (petsc_get_version)
endif ()
endfunction ()
if (PETSC_DIR)
file(TO_NATIVE_PATH ${PETSC_DIR} PETSC_DIR)
endif (PETSC_DIR)
find_path (PETSC_DIR include/petsc.h
HINTS ${AMDIS_PETSC_DIR} $ENV{HOME}/petsc ENV PETSC_DIR
DOC "PETSc Directory")
......
......@@ -2,7 +2,11 @@ if (ENABLE_UMFPACK OR AMDIS_NEED_UMFPACK)
if (WIN32)
set(SuiteSparse_USE_LAPACK_BLAS ON)
endif (WIN32)
if (SuiteSparse_DIR)
file(TO_NATIVE_PATH ${SuiteSparse_DIR} SuiteSparse_DIR)
endif (SuiteSparse_DIR)
# try to use a cmake-package of suitesparse
find_package(SuiteSparse QUIET HINTS ${AMDIS_SuiteSparse_DIR})
if (SuiteSparse_FOUND)
......@@ -12,18 +16,18 @@ if (ENABLE_UMFPACK OR AMDIS_NEED_UMFPACK)
set(FOUND_SUITESPARSE_LIBS ${SuiteSparse_LIBRARIES})
else (SuiteSparse_FOUND)
# find umfpack manually by searching for umfpack.h header file
find_library(UMFPACK_LIBRARY umfpack
find_library(UMFPACK_LIBRARY umfpack
HINTS ${AMDIS_UMFPACK_LIB_DIR}
DOC "Library file for UMFPACK")
find_file(UMFPACK_H umfpack.h
HINTS ${AMDIS_UMFPACK_INCLUDE_DIR} ENV CPATH /usr/include /usr/include/suitesparse /usr/include/ufsparse
DOC "Headerfile umfpack.h for UMFPACK")
if (UMFPACK_H AND UMFPACK_LIBRARY)
get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH)
get_filename_component(UMFPACK_LIB_PATH ${UMFPACK_LIBRARY} PATH)
set(FOUND_SUITESPARSE_LIBS ${UMFPACK_LIBRARY})
# find all connected libraries
find_library(AMD_LIBRARY amd HINTS ${UMFPACK_LIB_PATH})
find_library(BLAS_LIBRARY NAMES blas openblas HINTS ${UMFPACK_LIB_PATH} /usr/lib /usr/lib/openblas-base)
......@@ -42,7 +46,7 @@ if (ENABLE_UMFPACK OR AMDIS_NEED_UMFPACK)
if (SUITESPARSECONFIG_LIBRARY)
list(APPEND FOUND_SUITESPARSE_LIBS ${SUITESPARSECONFIG_LIBRARY})
endif (SUITESPARSECONFIG_LIBRARY)
target_include_directories(amdis_base INTERFACE ${UMFPACK_PATH})
target_link_libraries(amdis_base INTERFACE ${FOUND_SUITESPARSE_LIBS})
else()
......@@ -62,23 +66,25 @@ if (ENABLE_UMFPACK OR AMDIS_NEED_UMFPACK)
endif (HAVE_CLOCK_GETTIME)
endif (NOT WIN32)
# collect informations about umfpack version and found libraries
if (FOUND_SUITESPARSE_LIBS)
find_file(_UMFPACK_H umfpack.h HINTS ${SuiteSparse_INCLUDE_DIR} ${UMFPACK_PATH})
file(STRINGS ${_UMFPACK_H} UMFPACK_VERSION_LINE REGEX "#define UMFPACK_VERSION")
string(REGEX MATCH "\"UMFPACK V?([^\"]+)\"" UMFPACK_VERSION_REGEX ${UMFPACK_VERSION_LINE})
set(UMFPACK_VERSION ${CMAKE_MATCH_1})
unset(_UMFPACK_H CACHE)
message(STATUS "UMFPACK version: ${UMFPACK_VERSION}")
message(STATUS "Found the following SuiteSparse libraries:")
foreach (lib ${FOUND_SUITESPARSE_LIBS})
message(STATUS " ${lib}")
endforeach ()
endif (FOUND_SUITESPARSE_LIBS)
target_compile_definitions(amdis_base INTERFACE HAVE_UMFPACK=1)
target_compile_definitions(amdis_base INTERFACE MTL_HAS_UMFPACK=1)
target_compile_definitions(amdis_base INTERFACE
HAVE_UMFPACK=1
MTL_HAS_UMFPACK=1)
install(FILES ${BASE_DIR}/cmake3/find_umfpack.cmake DESTINATION share/amdis/)
endif (ENABLE_UMFPACK OR AMDIS_NEED_UMFPACK)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment