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@) add_library(amdis_base INTERFACE) add_library(AMDiS ALIAS amdis_base) target_compile_definitions(amdis_base INTERFACE) if (AMDIS_NEED_CXX11) target_enable_cxx11(AMDIS_NEED_CXX11 amdis_base INTERFACE) 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) target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=1) else () target_compile_definitions(amdis_base INTERFACE AMDIS_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}) else () message(FATAL_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 # -------------------- target_enable_mtl4(amdis_base INTERFACE ON) # AMDiS base libraries # -------------------- find_library(_AMDIS_LIB amdis${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/) find_library(_AMDIS_LIBD amdis${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version if (_AMDIS_LIB) target_link_libraries(amdis_base INTERFACE optimized ${_AMDIS_LIB}) endif () if (_AMDIS_LIBD) target_link_libraries(amdis_base INTERFACE debug ${_AMDIS_LIBD}) endif () if (NOT(_AMDIS_LIB OR _AMDIS_LIBD)) message(FATAL_ERROR "Could not detect the AMDiS${POSTFIX} library. Please set the variable _AMDIS_LIB to the AMDiS${POSTFIX} library.") endif () # 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) target_enable_boost(amdis_base INTERFACE 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) target_enable_umfpack(amdis_base INTERFACE ON) endif (AMDIS_NEED_UMFPACK) # amdis extensions # ---------------- if (AMDIS_NEED_EXTENSIONS) find_library(_EXTENSIONS_LIB amdisextensions${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/) find_library(_EXTENSIONS_LIBD amdisextensions${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version if (_EXTENSIONS_LIB OR _EXTENSIONS_LIBD) target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions ${AMDIS_INCLUDE_DIR}/extensions/nanoflann ${AMDIS_INCLUDE_DIR}/extensions/pugixml ${AMDIS_INCLUDE_DIR}/extensions/time) target_compile_definitions(amdis_base INTERFACE HAVE_EXTENSIONS=1) if (AMDIS_NEED_BASE_PROBLEMS) target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions/base_problems) endif (AMDIS_NEED_BASE_PROBLEMS) else () message(FATAL_ERROR "Extensions library not found") endif () if (_EXTENSIONS_LIB) target_link_libraries(amdis_base INTERFACE optimized ${_EXTENSIONS_LIB}) endif () if (_EXTENSIONS_LIBD) target_link_libraries(amdis_base INTERFACE debug ${_EXTENSIONS_LIBD}) endif () endif (AMDIS_NEED_EXTENSIONS) # reinit library # -------------- if (AMDIS_NEED_REINIT) find_library(_REINIT_LIB amdisreinit${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/) find_library(_REINIT_LIBD amdisreinit${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version if (_REINIT_LIB OR _REINIT_LIBD) target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/reinit) else () message(FATAL_ERROR "Reinit library not found") endif () if (_REINIT_LIB) target_link_libraries(amdis_base INTERFACE optimized ${_REINIT_LIB}) endif () if (_REINIT_LIBD) target_link_libraries(amdis_base INTERFACE debug ${_REINIT_LIBD}) endif () endif (AMDIS_NEED_REINIT) # compositeFEM library # -------------------- if (AMDIS_NEED_COMPOSITE_FEM) find_library(_COMPOSITE_FEM_LIB amdiscompositefem${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/) find_library(_COMPOSITE_FEM_LIBD amdiscompositefem${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version if (_COMPOSITE_FEM_LIB OR _COMPOSITE_FEM_LIBD) target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/compositeFEM) else () message(FATAL_ERROR "CompositeFEM library not found") endif () if (_COMPOSITE_FEM_LIB) target_link_libraries(amdis_base INTERFACE optimized ${_COMPOSITE_FEM_LIB}) endif () if (_COMPOSITE_FEM_LIBD) target_link_libraries(amdis_base INTERFACE debug ${_COMPOSITE_FEM_LIBD}) endif () endif (AMDIS_NEED_COMPOSITE_FEM) # muparser library # -------------------- find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_DIR}/../../lib/amdis/) if (_MUPARSER_LIB) target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/muparser) target_link_libraries(amdis_base INTERFACE ${_MUPARSER_LIB}) else () message(FATAL_ERROR "MuParser library not found") endif () unset(_MUPARSER_LIB CACHE) # Additional libraries # ============================================================================== # Parallel amdis # -------------- if (AMDIS_HAS_PARALLEL_DOMAIN) target_enable_mpi(amdis_base INTERFACE ON) target_enable_petsc(amdis_base INTERFACE ON) target_compile_definitions(amdis_base INTERFACE HAVE_PARALLEL_DOMAIN_AMDIS=1) endif (AMDIS_HAS_PARALLEL_DOMAIN) # Zoltan library # -------------- if (AMDIS_NEED_ZOLTAN) if (NOT DEFINED ZOLTAN_DIR) set(ZOLTAN_DIR "@ZOLTAN_DIR@") endif () target_enable_zoltan(amdis_base INTERFACE ON) endif () # BSSCML library # -------------- if (AMDIS_NEED_BDDCML) target_enable_bddcml(amdis_base INTERFACE ON) endif () # Hypre library # -------------- if (AMDIS_NEED_HYPRE) target_enable_hypre(amdis_base INTERFACE ON) endif () # PNG library # -------------- if (AMDIS_NEED_PNG) target_enable_png(amdis_base INTERFACE ON) endif () # Sequential PETSc library # -------------- if (AMDIS_NEED_SEQ_PETSC AND NOT AMDIS_HAS_PARALLEL_DOMAIN) target_enable_mpi(amdis_base INTERFACE ON) target_enable_petsc(amdis_base INTERFACE ON) target_compile_definitions(amdis_base INTERFACE HAVE_SEQ_PETSC=1) endif () # ============================================================================== # Extract some variables from INTERFACE target AMDiS get_target_property(AMDIS_INCLUDE_DIRS AMDiS INTERFACE_INCLUDE_DIRECTORIES) get_target_property(AMDIS_LIBRARIES AMDiS INTERFACE_LINK_LIBRARIES) get_target_property(AMDIS_COMPILEFLAGS AMDiS INTERFACE_COMPILE_OPTIONS) if (NOT AMDIS_COMPILEFLAGS) set(AMDIS_COMPILEFLAGS "") endif() get_target_property(_DEFINITIONS AMDiS INTERFACE_COMPILE_DEFINITIONS) foreach(defn ${_DEFINITIONS}) list(APPEND AMDIS_COMPILEFLAGS "-D${defn}") endforeach(defn)