From: maier Date: Mon, 24 Sep 2012 13:50:38 +0000 (+0000) Subject: Add support for petsc, 1st part X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fd152879ccbe83e47935f3549dd32ede8c85d12;p=dealii-svn.git Add support for petsc, 1st part git-svn-id: https://svn.dealii.org/branches/branch_cmake@26661 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/configure/configure_petsc.cmake b/deal.II/cmake/configure/configure_petsc.cmake new file mode 100644 index 0000000000..a4ac110581 --- /dev/null +++ b/deal.II/cmake/configure/configure_petsc.cmake @@ -0,0 +1,63 @@ +# +# Configuration for the petsc library: +# + +MACRO(FEATURE_PETSC_FIND_EXTERNAL var) + + FIND_PACKAGE(PETSC) + + IF(PETSC_FOUND) + # + # So, we have found a petsc library. Let's check whether we can use it. + # + SET(${var} TRUE) + + # + # We support petsc from version 3.x.x onwards + # + IF(PETSC_MAJOR LESS 3) + MESSAGE(STATUS + "Could not find a sufficient modern petsc installation: " + "Version >=3.0.0 required!" + ) + SET(${var} FALSE) + ENDIF() + + # + # Petsc has to be configured with the same MPI configuration as + # deal.II. + # + # petscconf.h should export PETSC_HAVE_MPI 1 if mpi support is enabled. + # So we check for this: + # + FILE(STRINGS "${PETSC_INCLUDE_DIR}/petscconf.h" PETSC_RELEASE_STRING + REGEX "#define.*PETSC_HAVE_MPI.*1") + IF("${PETSC_RELEASE_STRING}" STREQUAL "") + SET(PETSC_WITH_MPI FALSE) + ELSE() + SET(PETSC_WITH_MPI TRUE) + ENDIF() + + IF( (PETSC_WITH_MPI AND NOT DEAL_II_COMPILER_SUPPORTS_MPI) + OR + (NOT PETSC_WITH_MPI AND DEAL_II_COMPILER_SUPPORTS_MPI)) + MESSAGE(STATUS + "Could not find a sufficient petsc installation: " + "Petsc has to be configured with the same MPI configuration as deal.II." + ) + SET(${var} FALSE) + ENDIF() + + + + ENDIF() +ENDMACRO() + + +MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL var) + SET(${var} TRUE) +ENDMACRO() + + +CONFIGURE_FEATURE(PETSC) +