From 26d87b9e2ef9719a301f47f300e3a6532cfccad8 Mon Sep 17 00:00:00 2001 From: maier Date: Mon, 24 Sep 2012 13:49:57 +0000 Subject: [PATCH] The changes during the reset... git-svn-id: https://svn.dealii.org/branches/branch_cmake@26660 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 10 +- deal.II/README_CMAKE | 4 +- deal.II/TODO_CMAKE | 1 - deal.II/cmake/modules/FindPETSC.cmake | 23 ++++ deal.II/cmake/petsc.m4 | 164 -------------------------- deal.II/cmake/setup_finalize.cmake | 7 ++ 6 files changed, 38 insertions(+), 171 deletions(-) diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index a5534b622c..893672ae82 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -95,7 +95,11 @@ OPTION(DEAL_II_WITH_NETCDF OFF) OPTION(DEAL_II_WITH_P4EST - "Build deal.II with support for P4EST." + "Build deal.II with support for p4est." + OFF) + +OPTION(DEAL_II_WITH_PETSC + "Build deal.II with support for petsc." OFF) OPTION(DEAL_II_WITH_TBB @@ -126,9 +130,7 @@ OPTION(DEAL_II_WITH_ZLIB # OPTION(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS - "configure sensible default CFLAGS and CXXFLAGS depending on platform, - compiler and build target. Disabling this option will turn off almost all - compiler flag setup." + "configure sensible default CFLAGS and CXXFLAGS depending on platform, compiler and build target." ON) # diff --git a/deal.II/README_CMAKE b/deal.II/README_CMAKE index 7d5a57178a..39eb60ef6b 100644 --- a/deal.II/README_CMAKE +++ b/deal.II/README_CMAKE @@ -252,8 +252,8 @@ CONFIGURATION Currently, the following variables will be considered: METIS_DIR, - P4EST_DIR, - PETSC_DIR (and SC_DIR), + P4EST_DIR (and SC_DIR), + PETSC_DIR and PETSC_ARCH (forming ${PETSC_DIR}/${PETSC_ARCH}), TRILINOS_DIR, UMFPACK_DIR (and AMD_DIR) diff --git a/deal.II/TODO_CMAKE b/deal.II/TODO_CMAKE index 49f2ea516e..5dc74bce05 100644 --- a/deal.II/TODO_CMAKE +++ b/deal.II/TODO_CMAKE @@ -7,7 +7,6 @@ Major: * The following features have to be written: * HDF5 - * PETSC * MUMPS * SLEPC * HSL diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index 97e7da4748..fc6d183fc9 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -24,6 +24,29 @@ FIND_LIBRARY(PETSC_LIBRARY FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG PETSC_LIBRARY PETSC_INCLUDE_DIR) IF(PETSC_FOUND) + + FILE(STRINGS "${PETSC_INCLUDE_DIR}/petscversion.h" PETSC_MAJOR_STRING + REGEX "#define.*PETSC_VERSION_MAJOR") + STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1" PETSC_MAJOR "${PETSC_MAJOR_STRING}") + + FILE(STRINGS "${PETSC_INCLUDE_DIR}/petscversion.h" PETSC_MINOR_STRING + REGEX "#define.*PETSC_VERSION_MINOR") + STRING(REGEX REPLACE "^.*PETSC_VERSION_MINOR.*([0-9]+).*" "\\1" PETSC_MINOR "${PETSC_MINOR_STRING}") + + FILE(STRINGS "${PETSC_INCLUDE_DIR}/petscversion.h" PETSC_SUBMINOR_STRING + REGEX "#define.*PETSC_VERSION_SUBMINOR") + STRING(REGEX REPLACE "^.*PETSC_VERSION_SUBMINOR.*([0-9]+).*" "\\1" PETSC_SUBMINOR "${PETSC_SUBMINOR_STRING}") + + FILE(STRINGS "${PETSC_INCLUDE_DIR}/petscversion.h" PETSC_RELEASE_STRING + REGEX "#define.*PETSC_VERSION_RELEASE.*1") + IF("${PETSC_RELEASE_STRING}" STREQUAL "") + SET(PETSC_RELEASE FALSE) + ELSE() + SET(PETSC_RELEASE TRUE) + ENDIF() + + SET(PETSC_VERSION "${PETSC_MAJOR}.${PETSC_MINOR}.${PETSC_SUBMINOR}") + MARK_AS_ADVANCED( PETSC_LIBRARY PETSC_INCLUDE_DIR diff --git a/deal.II/cmake/petsc.m4 b/deal.II/cmake/petsc.m4 index e9be2b4df3..03813cfd9a 100644 --- a/deal.II/cmake/petsc.m4 +++ b/deal.II/cmake/petsc.m4 @@ -16,178 +16,14 @@ - dnl If we have found PETSc, determine additional pieces of data - if test "$USE_CONTRIB_PETSC" = "yes" ; then - DEAL_II_CONFIGURE_PETSC_VERSION - DEAL_II_CONFIGURE_PETSC_ARCH - - DEAL_II_CONFIGURE_PETSC_MPIUNI_LIB - DEAL_II_CHECK_PETSC_MPI_CONSISTENCY - DEAL_II_CONFIGURE_PETSC_COMPLEX - DEAL_II_EXPAND_PETSC_VECTOR="PETScWrappers::Vector" DEAL_II_EXPAND_PETSC_MPI_VECTOR="PETScWrappers::MPI::Vector" DEAL_II_EXPAND_PETSC_BLOCKVECTOR="PETScWrappers::BlockVector" DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR="PETScWrappers::MPI::BlockVector" - dnl Finally set with_petsc if this hasn't happened yet - if test "x$with_petsc" = "x" ; then - with_petsc="yes" - fi - fi - - dnl Make sure that the right values for PETSC vectors are written - dnl into common/template-arguments.in - AC_SUBST(DEAL_II_EXPAND_PETSC_VECTOR) - AC_SUBST(DEAL_II_EXPAND_PETSC_MPI_VECTOR) - AC_SUBST(DEAL_II_EXPAND_PETSC_BLOCKVECTOR) - AC_SUBST(DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR) -]) - - - -dnl ------------------------------------------------------------ -dnl Figure out the architecture used for PETSc, since that -dnl determines where object and configuration files will be found. -dnl -dnl Usage: DEAL_II_CONFIGURE_PETSC_ARCH -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CONFIGURE_PETSC_ARCH, dnl -[ - AC_MSG_CHECKING([for PETSc library architecture]) - - AC_ARG_WITH(petsc-arch, - [AS_HELP_STRING([--with-petsc-arch=architecture], - [Specify the architecture for your PETSc installation; use this if you want to override the PETSC_ARCH environment variable.])], - [DEAL_II_PETSC_ARCH="$withval" - AC_MSG_RESULT($DEAL_II_PETSC_ARCH) - ], - [dnl Take something from the environment variables - if test "x$PETSC_ARCH" != "x" ; then - DEAL_II_PETSC_ARCH="$PETSC_ARCH" - AC_MSG_RESULT($DEAL_II_PETSC_ARCH) - else - AC_MSG_ERROR([If PETSc is used, you must specify the architecture either through the PETSC_ARCH environment variable, or through the --with-petsc-arch flag]) - fi - ]) - - if test "x$PETSC_ARCH" != "x" ; then - - dnl PETSc change the locations where they store their libraries - dnl from time-to-time; so make sure that what was specified is - dnl actually correct. - case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in - 3.*) dnl - if test ! -d $DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/lib \ - ; then - AC_MSG_ERROR([PETSc has not been compiled for the architecture specified with --with-petsc-arch]) - fi - ;; - *) dnl - AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}]) - ;; - esac - fi -]) - - - -dnl ------------------------------------------------------------ -dnl Figure out the version numbers of PETSc. This is unfortunately -dnl necessary since PETSc has a habit to change function signatures, -dnl library names, etc, in random ways between versions... -dnl -dnl Usage: DEAL_II_CONFIGURE_PETSC_VERSION -dnl -dnl ------------------------------------------------------------ -AC_DEFUN(DEAL_II_CONFIGURE_PETSC_VERSION, dnl -[ - AC_MSG_CHECKING([for PETSc version]) - DEAL_II_PETSC_VERSION_MAJOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \ - | grep "#define PETSC_VERSION_MAJOR" \ - | perl -pi -e 's/.*MAJOR\s+//g;'` - DEAL_II_PETSC_VERSION_MINOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \ - | grep "#define PETSC_VERSION_MINOR" \ - | perl -pi -e 's/.*MINOR\s+//g;'` - DEAL_II_PETSC_VERSION_SUBMINOR=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \ - | grep "#define PETSC_VERSION_SUBMINOR" \ - | perl -pi -e 's/.*MINOR\s+//g;'` - PETSC_VERSION="$DEAL_II_PETSC_VERSION_MAJOR.$DEAL_II_PETSC_VERSION_MINOR.$DEAL_II_PETSC_VERSION_SUBMINOR" - - dnl Here is where we check if the PETSc version we have is a - dnl release but do nothing about it. - PETSC_RELEASE=`cat $DEAL_II_PETSC_DIR/include/petscversion.h \ - | grep "#define PETSC_VERSION_RELEASE" \ - | perl -pi -e 's/.*RELEASE\s+//g;'` - if test "$PETSC_RELEASE" = "0" ; then - PETSC_VERSION+="-dev" - DEAL_II_PETSC_VERSION_DEV=yes AC_DEFINE([DEAL_II_USE_PETSC_DEV], [1], [Defined if a PETSc installation was found and is not a release]) - else - DEAL_II_PETSC_VERSION_DEV=no - fi - - AC_MSG_RESULT($PETSC_VERSION) -]) - - -dnl ------------------------------------------------------------- -dnl Make sure that if PETSc and deal.II were built with the same -dnl MPI enabled (or disabled) functionality. -dnl -dnl Usage: DEAL_II_CHECK_PETSC_MPI_CONSISTENCY -dnl -dnl ------------------------------------------------------------- -AC_DEFUN(DEAL_II_CHECK_PETSC_MPI_CONSISTENCY, dnl -[ - dnl Then check for MPI consistency. - AC_MSG_CHECKING(for consistency of PETSc and deal.II MPI settings) - if test "x$DEAL_II_USE_MPI" = "xyes" ; then - - dnl So we support MPI. Check that our PETSc installation does - dnl too. PETSc sets the variable PETSC_HAVE_MPIUNI to 1 in case - dnl he *does not* support MPI, so just read out that information. - dnl - dnl Like always, we have to cake care of version control! - case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in - 3.*) dnl - AC_TRY_COMPILE( - [#include "$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h" - ], - [#ifdef PETSC_HAVE_MPIUNI - compile error; - #endif - ], - [AC_MSG_RESULT(yes)], - [AC_MSG_ERROR([PETSc was not built for MPI, but deal.II is!] - )]) - ;; - *) dnl - AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}]) - ;; - esac - else - case "${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}" in - 3.*) dnl - AC_TRY_COMPILE( - [#include "$DEAL_II_PETSC_DIR/$DEAL_II_PETSC_ARCH/include/petscconf.h" - ], - [#ifndef PETSC_HAVE_MPIUNI - compile error; - #endif], - [AC_MSG_RESULT(yes)], - [AC_MSG_ERROR([PETSc was built for MPI, but deal.II is not!]) - ]) - ;; - *) dnl - AC_MSG_ERROR([Unknown PETSc version ${DEAL_II_PETSC_VERSION_MAJOR}.${DEAL_II_PETSC_VERSION_MINOR}.${DEAL_II_PETSC_VERSION_SUBMINOR}]) - ;; - esac - fi -]) dnl ------------------------------------------------------------ diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index 3cfa8b06b5..7c4884e906 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -28,6 +28,13 @@ IF(NOT DEAL_II_WITH_BOOST) ENDIF() +# +# Hide some cmake specific cached variables. This is annoying... +# +MARK_AS_ADVANCED( + file_cmd + ) + # # Append the saved initial (cached) variables ${flags}_SAVED at the end of -- 2.39.5