From: maier Date: Sat, 26 Apr 2014 13:31:38 +0000 (+0000) Subject: CMake: Refactor Find modules X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fb2f525ead037978ce3e8cf29fe9e50be55ebb5;p=dealii-svn.git CMake: Refactor Find modules git-svn-id: https://svn.dealii.org/trunk@32844 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/macros/macro_configure_feature.cmake b/deal.II/cmake/macros/macro_configure_feature.cmake index 219ab2f405..60930bf7bf 100644 --- a/deal.II/cmake/macros/macro_configure_feature.cmake +++ b/deal.II/cmake/macros/macro_configure_feature.cmake @@ -230,8 +230,6 @@ MACRO(CONFIGURE_FEATURE _feature) ENDIF() IF(FEATURE_${_feature}_EXTERNAL_FOUND) - MESSAGE(STATUS "All external dependencies for DEAL_II_WITH_${_feature} are fullfilled.") - IF(COMMAND FEATURE_${_feature}_CONFIGURE_EXTERNAL) RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_EXTERNAL()") ENDIF() diff --git a/deal.II/cmake/modules/FindARPACK.cmake b/deal.II/cmake/modules/FindARPACK.cmake index 61af946b96..cd2c9bcef0 100644 --- a/deal.II/cmake/modules/FindARPACK.cmake +++ b/deal.II/cmake/modules/FindARPACK.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## diff --git a/deal.II/cmake/modules/FindDEALII_LAPACK.cmake b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake index 69a24aed6c..8b2dff588e 100644 --- a/deal.II/cmake/modules/FindDEALII_LAPACK.cmake +++ b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2013 by the deal.II authors +## Copyright (C) 2013 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## diff --git a/deal.II/cmake/modules/FindHDF5.cmake b/deal.II/cmake/modules/FindHDF5.cmake index b3437c9952..73cb833302 100644 --- a/deal.II/cmake/modules/FindHDF5.cmake +++ b/deal.II/cmake/modules/FindHDF5.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## diff --git a/deal.II/cmake/modules/FindMETIS.cmake b/deal.II/cmake/modules/FindMETIS.cmake index a5d9e2ab18..0accb210fa 100644 --- a/deal.II/cmake/modules/FindMETIS.cmake +++ b/deal.II/cmake/modules/FindMETIS.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -39,13 +39,6 @@ SET_IF_EMPTY(METIS_DIR "$ENV{METIS_DIR}") # Link in MPI unconditionally (if found). # -FIND_PATH(METIS_INCLUDE_DIR metis.h - HINTS - ${METIS_DIR} - PATH_SUFFIXES - metis include/metis include - ) - FIND_LIBRARY(METIS_LIBRARY NAMES metis HINTS @@ -56,45 +49,30 @@ FIND_LIBRARY(METIS_LIBRARY build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libmetis ) +# +# Sanity check: Only search the parmetis library in the same directory as +# the metis library... +# +GET_FILENAME_COMPONENT(_path "${METIS_LIBRARY}" PATH) FIND_LIBRARY(PARMETIS_LIBRARY NAMES parmetis + HINTS ${_path} + NO_DEFAULT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_FIND_ROOT_PATH + ) + +FIND_PATH(METIS_INCLUDE_DIR metis.h HINTS ${METIS_DIR} PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib - # This is a hint, isn't it? - build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libmetis - ) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(METIS DEFAULT_MSG - METIS_LIBRARY - METIS_INCLUDE_DIR - ) - -MARK_AS_ADVANCED( - METIS_LIBRARY - PARMETIS_LIBRARY - METIS_INCLUDE_DIR + metis include/metis include ) -IF(METIS_FOUND) - # - # Sanity check: Only include parmetis library if it is in the same - # directory as the metis library... - # - GET_FILENAME_COMPONENT(_path1 "${PARMETIS_LIBRARY}" PATH) - GET_FILENAME_COMPONENT(_path2 "${ETIS_LIBRARY}" PATH) - IF( NOT PARMETIS_LIBRARY MATCHES "-NOTFOUND" - AND "${_path1}" STREQUAL "${_path2}" ) - SET(METIS_LIBRARIES ${PARMETIS_LIBRARY}) - ENDIF() - - LIST(APPEND METIS_LIBRARIES - ${METIS_LIBRARY} - ${MPI_C_LIBRARIES} # for good measure - ) - SET(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR}) - +IF(EXISTS ${METIS_INCLUDE_DIR}/metis.h) # # Extract the version number out of metis.h # @@ -119,6 +97,31 @@ IF(METIS_FOUND) SET(METIS_VERSION "${METIS_VERSION_MAJOR}.${METIS_VERSION_MINOR}.${METIS_VERSION_SUBMINOR}" ) +ENDIF() + + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(METIS DEFAULT_MSG + METIS_LIBRARY + METIS_INCLUDE_DIR + ) + +MARK_AS_ADVANCED( + METIS_LIBRARY + PARMETIS_LIBRARY + METIS_INCLUDE_DIR + ) + +IF(METIS_FOUND) + + IF(NOT PARMETIS_LIBRARY MATCHES "-NOTFOUND") + SET(METIS_LIBRARIES ${PARMETIS_LIBRARY}) + ENDIF() + + LIST(APPEND METIS_LIBRARIES + ${METIS_LIBRARY} + ${MPI_C_LIBRARIES} # for good measure + ) + SET(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR}) MARK_AS_ADVANCED(METIS_DIR) ENDIF() diff --git a/deal.II/cmake/modules/FindMUMPS.cmake b/deal.II/cmake/modules/FindMUMPS.cmake index f8de1f5154..db55daab2f 100644 --- a/deal.II/cmake/modules/FindMUMPS.cmake +++ b/deal.II/cmake/modules/FindMUMPS.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## diff --git a/deal.II/cmake/modules/FindMUPARSER.cmake b/deal.II/cmake/modules/FindMUPARSER.cmake index d9d15635d1..060ec2fe7a 100644 --- a/deal.II/cmake/modules/FindMUPARSER.cmake +++ b/deal.II/cmake/modules/FindMUPARSER.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2013 by the deal.II authors +## Copyright (C) 2013 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -43,15 +43,7 @@ FIND_PATH(MUPARSER_INCLUDE_DIR muParserDef.h PATH_SUFFIXES include ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUPARSER DEFAULT_MSG - MUPARSER_LIBRARY - MUPARSER_INCLUDE_DIR - ) - -IF(MUPARSER_FOUND) - SET(MUPARSER_LIBRARIES ${MUPARSER_LIBRARY}) - SET(MUPARSER_INCLUDE_DIRS ${MUPARSER_INCLUDE_DIR}) - +IF(EXISTS ${MUPARSER_INCLUDE_DIR}/muParserDef.h) FILE(STRINGS "${MUPARSER_INCLUDE_DIR}/muParserDef.h" MUPARSER_VERSION_STRING REGEX "#define MUP_VERSION _T" ) @@ -67,6 +59,16 @@ IF(MUPARSER_FOUND) SET(MUPARSER_VERSION "${MUPARSER_VERSION_MAJOR}.${MUPARSER_VERSION_MINOR}.${MUPARSER_VERSION_SUBMINOR}" ) +ENDIF() + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUPARSER DEFAULT_MSG + MUPARSER_LIBRARY + MUPARSER_INCLUDE_DIR + ) + +IF(MUPARSER_FOUND) + SET(MUPARSER_LIBRARIES ${MUPARSER_LIBRARY}) + SET(MUPARSER_INCLUDE_DIRS ${MUPARSER_INCLUDE_DIR}) MARK_AS_ADVANCED(MUPARSER_DIR) ENDIF() diff --git a/deal.II/cmake/modules/FindNETCDF.cmake b/deal.II/cmake/modules/FindNETCDF.cmake index 3ab2650229..5ee129ec46 100644 --- a/deal.II/cmake/modules/FindNETCDF.cmake +++ b/deal.II/cmake/modules/FindNETCDF.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake index db72bb2268..4104e6952d 100644 --- a/deal.II/cmake/modules/FindP4EST.cmake +++ b/deal.II/cmake/modules/FindP4EST.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -41,15 +41,6 @@ SET_IF_EMPTY(SC_DIR "$ENV{SC_DIR}") # given, take what we chose for p4est. # -FIND_PATH(P4EST_INCLUDE_DIR p4est_config.h - HINTS - ${P4EST_DIR}/FAST - ${P4EST_DIR}/DEBUG - ${P4EST_DIR} - PATH_SUFFIXES - p4est include/p4est include src - ) - FIND_PATH(SC_INCLUDE_DIR sc.h HINTS ${SC_DIR}/FAST @@ -102,6 +93,58 @@ FIND_LIBRARY(SC_LIBRARY_DEBUG lib${LIB_SUFFIX} lib64 lib src sc/src ) +FIND_PATH(P4EST_INCLUDE_DIR p4est_config.h + HINTS + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG + ${P4EST_DIR} + PATH_SUFFIXES + p4est include/p4est include src + ) + +IF(EXISTS ${P4EST_INCLUDE_DIR}/p4est_config.h) + # + # Determine mpi support of p4est: + # + FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_MPI_STRING + REGEX "#define.*P4EST_MPI 1") + IF("${P4EST_MPI_STRING}" STREQUAL "") + SET(P4EST_WITH_MPI FALSE) + ELSE() + SET(P4EST_WITH_MPI TRUE) + ENDIF() + + # + # Extract version numbers: + # + FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_VERSION + REGEX "#define P4EST_VERSION \"") + STRING(REGEX REPLACE "^.*P4EST_VERSION.*\"([0-9]+.*)\".*" "\\1" + P4EST_VERSION "${P4EST_VERSION}" + ) + STRING(REGEX REPLACE + "^([0-9]+).*$" "\\1" + P4EST_VERSION_MAJOR "${P4EST_VERSION}") + STRING(REGEX REPLACE + "^[0-9]+\\.([0-9]+).*$" "\\1" + P4EST_VERSION_MINOR "${P4EST_VERSION}") + STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" + P4EST_VERSION_SUBMINOR "${P4EST_VERSION}") + + # Now for the patch number such as in 0.3.4.1. If there + # is no patch number, then the REGEX REPLACE will fail, + # setting P4EST_VERSION_PATCH to P4EST_VERSION. If that + # is the case, then set the patch number to zero + STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)?.*$" "\\1" + P4EST_VERSION_PATCH "${P4EST_VERSION}") + IF(${P4EST_VERSION_PATCH} STREQUAL "${P4EST_VERSION}") + SET(P4EST_VERSION_PATCH "0") + ENDIF() +ENDIF() + + SET(_output ${P4EST_LIBRARY_OPTMIZED} ${SC_LIBRARY_OPTIMIZED}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG _output # Cosmetic: Gives nice output @@ -153,45 +196,5 @@ IF(P4EST_FOUND) ${SC_INCLUDE_DIR} ) - # - # Determine mpi support of p4est: - # - FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_MPI_STRING - REGEX "#define.*P4EST_MPI 1") - IF("${P4EST_MPI_STRING}" STREQUAL "") - SET(P4EST_WITH_MPI FALSE) - ELSE() - SET(P4EST_WITH_MPI TRUE) - ENDIF() - - # - # Extract version numbers: - # - FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_VERSION - REGEX "#define P4EST_VERSION \"") - STRING(REGEX REPLACE "^.*P4EST_VERSION.*\"([0-9]+.*)\".*" "\\1" - P4EST_VERSION "${P4EST_VERSION}" - ) - STRING(REGEX REPLACE - "^([0-9]+).*$" "\\1" - P4EST_VERSION_MAJOR "${P4EST_VERSION}") - STRING(REGEX REPLACE - "^[0-9]+\\.([0-9]+).*$" "\\1" - P4EST_VERSION_MINOR "${P4EST_VERSION}") - STRING(REGEX REPLACE - "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" - P4EST_VERSION_SUBMINOR "${P4EST_VERSION}") - - # Now for the patch number such as in 0.3.4.1. If there - # is no patch number, then the REGEX REPLACE will fail, - # setting P4EST_VERSION_PATCH to P4EST_VERSION. If that - # is the case, then set the patch number to zero - STRING(REGEX REPLACE - "^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)?.*$" "\\1" - P4EST_VERSION_PATCH "${P4EST_VERSION}") - IF(${P4EST_VERSION_PATCH} STREQUAL "${P4EST_VERSION}") - SET(P4EST_VERSION_PATCH "0") - ENDIF() - MARK_AS_ADVANCED(P4EST_DIR) ENDIF() diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index 242a510d90..be222bcaf1 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -62,6 +62,42 @@ FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h PATH_SUFFIXES petsc include include/petsc ) +SET(PETSC_PETSCCONF_H "${PETSC_INCLUDE_DIR_ARCH}/petscconf.h") +IF(EXISTS ${PETSC_PETSCCONF_H}) + # + # Is petsc compiled with support for MPIUNI? + # + FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_MPIUNI_STRING + REGEX "#define.*PETSC_HAVE_MPIUNI 1") + IF("${PETSC_MPIUNI_STRING}" STREQUAL "") + SET(PETSC_WITH_MPIUNI FALSE) + ELSE() + SET(PETSC_WITH_MPIUNI TRUE) + ENDIF() + + # + # Is petsc compiled with support for 64BIT_INDICES? + # + FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_64BIT_INDICES_STRING + REGEX "#define.*PETSC_USE_64BIT_INDICES 1") + IF("${PETSC_64BIT_INDICES_STRING}" STREQUAL "") + SET(PETSC_WITH_64BIT_INDICES FALSE) + ELSE() + SET(PETSC_WITH_64BIT_INDICES TRUE) + ENDIF() + + # + # Is petsc compiled with support for COMPLEX numbers? + # + FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_COMPLEX_STRING + REGEX "#define.*PETSC_USE_COMPLEX 1") + IF("${PETSC_COMPLEX_STRING}" STREQUAL "") + SET(PETSC_WITH_COMPLEX FALSE) + ELSE() + SET(PETSC_WITH_COMPLEX TRUE) + ENDIF() +ENDIF() + # # Sometimes, this is not enough... # If petsc is not installed but in source tree layout, there will be @@ -84,6 +120,33 @@ FIND_PATH(PETSC_INCLUDE_DIR_COMMON petscversion.h PATH_SUFFIXES petsc include include/petsc ) +SET(PETSC_PETSCVERSION_H "${PETSC_INCLUDE_DIR_COMMON}/petscversion.h") +IF(EXISTS ${PETSC_PETSCVERSION_H}) + FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MAJOR_STRING + REGEX "#define.*PETSC_VERSION_MAJOR") + STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1" + PETSC_VERSION_MAJOR "${PETSC_VERSION_MAJOR_STRING}" + ) + FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MINOR_STRING + REGEX "#define.*PETSC_VERSION_MINOR") + STRING(REGEX REPLACE "^.*PETSC_VERSION_MINOR.*([0-9]+).*" "\\1" + PETSC_VERSION_MINOR "${PETSC_VERSION_MINOR_STRING}" + ) + FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_SUBMINOR_STRING + REGEX "#define.*PETSC_VERSION_SUBMINOR") + STRING(REGEX REPLACE "^.*PETSC_VERSION_SUBMINOR.*([0-9]+).*" "\\1" + PETSC_VERSION_SUBMINOR "${PETSC_VERSION_SUBMINOR_STRING}" + ) + FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_PATCH_STRING + REGEX "#define.*PETSC_VERSION_PATCH") + STRING(REGEX REPLACE "^.*PETSC_VERSION_PATCH.*([0-9]+).*" "\\1" + PETSC_VERSION_PATCH "${PETSC_VERSION_PATCH_STRING}" + ) + SET(PETSC_VERSION + "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.${PETSC_VERSION_PATCH}" + ) +ENDIF() + # # So, up to this point it was easy. Now, the tricky part. Search for # petscvariables and determine the includes and the link interface from @@ -99,7 +162,6 @@ FIND_FILE(PETSC_PETSCVARIABLES ) IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") - # # Includes: # @@ -191,70 +253,6 @@ IF(PETSC_FOUND) ${_petsc_includes} ) - SET(PETSC_PETSCCONF_H "${PETSC_INCLUDE_DIR_ARCH}/petscconf.h") - SET(PETSC_PETSCVERSION_H "${PETSC_INCLUDE_DIR_COMMON}/petscversion.h") - - # - # Is petsc compiled with support for MPIUNI? - # - FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_MPIUNI_STRING - REGEX "#define.*PETSC_HAVE_MPIUNI 1") - IF("${PETSC_MPIUNI_STRING}" STREQUAL "") - SET(PETSC_WITH_MPIUNI FALSE) - ELSE() - SET(PETSC_WITH_MPIUNI TRUE) - ENDIF() - - # - # Is petsc compiled with support for 64BIT_INDICES? - # - FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_64BIT_INDICES_STRING - REGEX "#define.*PETSC_USE_64BIT_INDICES 1") - IF("${PETSC_64BIT_INDICES_STRING}" STREQUAL "") - SET(PETSC_WITH_64BIT_INDICES FALSE) - ELSE() - SET(PETSC_WITH_64BIT_INDICES TRUE) - ENDIF() - - # - # Is petsc compiled with support for COMPLEX numbers? - # - FILE(STRINGS "${PETSC_PETSCCONF_H}" PETSC_COMPLEX_STRING - REGEX "#define.*PETSC_USE_COMPLEX 1") - IF("${PETSC_COMPLEX_STRING}" STREQUAL "") - SET(PETSC_WITH_COMPLEX FALSE) - ELSE() - SET(PETSC_WITH_COMPLEX TRUE) - ENDIF() - - FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MAJOR_STRING - REGEX "#define.*PETSC_VERSION_MAJOR") - STRING(REGEX REPLACE "^.*PETSC_VERSION_MAJOR.*([0-9]+).*" "\\1" - PETSC_VERSION_MAJOR "${PETSC_VERSION_MAJOR_STRING}" - ) - - FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_MINOR_STRING - REGEX "#define.*PETSC_VERSION_MINOR") - STRING(REGEX REPLACE "^.*PETSC_VERSION_MINOR.*([0-9]+).*" "\\1" - PETSC_VERSION_MINOR "${PETSC_VERSION_MINOR_STRING}" - ) - - FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_SUBMINOR_STRING - REGEX "#define.*PETSC_VERSION_SUBMINOR") - STRING(REGEX REPLACE "^.*PETSC_VERSION_SUBMINOR.*([0-9]+).*" "\\1" - PETSC_VERSION_SUBMINOR "${PETSC_VERSION_SUBMINOR_STRING}" - ) - - FILE(STRINGS "${PETSC_PETSCVERSION_H}" PETSC_VERSION_PATCH_STRING - REGEX "#define.*PETSC_VERSION_PATCH") - STRING(REGEX REPLACE "^.*PETSC_VERSION_PATCH.*([0-9]+).*" "\\1" - PETSC_VERSION_PATCH "${PETSC_VERSION_PATCH_STRING}" - ) - - SET(PETSC_VERSION - "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.${PETSC_VERSION_PATCH}" - ) - MARK_AS_ADVANCED(PETSC_ARCH PETSC_DIR) ENDIF() diff --git a/deal.II/cmake/modules/FindSCALAPACK.cmake b/deal.II/cmake/modules/FindSCALAPACK.cmake index 9d91be55a6..57fad7cecb 100644 --- a/deal.II/cmake/modules/FindSCALAPACK.cmake +++ b/deal.II/cmake/modules/FindSCALAPACK.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## diff --git a/deal.II/cmake/modules/FindSLEPC.cmake b/deal.II/cmake/modules/FindSLEPC.cmake index d65e6f41a1..51c6128318 100644 --- a/deal.II/cmake/modules/FindSLEPC.cmake +++ b/deal.II/cmake/modules/FindSLEPC.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -70,40 +70,13 @@ FIND_PATH(SLEPC_INCLUDE_DIR_COMMON slepcversion.h PATH_SUFFIXES slepc include include/slepc ) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SLEPC DEFAULT_MSG - SLEPC_LIBRARY - SLEPC_INCLUDE_DIR_ARCH - SLEPC_INCLUDE_DIR_COMMON - PETSC_FOUND - ) - -MARK_AS_ADVANCED( - SLEPC_DIR - SLEPC_INCLUDE_DIR_ARCH - SLEPC_INCLUDE_DIR_COMMON - SLEPC_INCLUDE_DIRS - SLEPC_LIBRARY - ) - -IF(SLEPC_FOUND) - SET(SLEPC_INCLUDE_DIRS - ${SLEPC_INCLUDE_DIR_ARCH} - ${SLEPC_INCLUDE_DIR_COMMON} - ) - SET(SLEPC_LIBRARIES - ${SLEPC_LIBRARY} - ${PETSC_LIBRARIES} - ) - - SET(SLEPC_SLEPCVERSION_H "${SLEPC_INCLUDE_DIR_COMMON}/slepcversion.h") - +SET(SLEPC_SLEPCVERSION_H "${SLEPC_INCLUDE_DIR_COMMON}/slepcversion.h") +IF(EXISTS ${SLEPC_SLEPCVERSION_H}) FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_MAJOR_STRING REGEX "#define.*SLEPC_VERSION_MAJOR") STRING(REGEX REPLACE "^.*SLEPC_VERSION_MAJOR.*([0-9]+).*" "\\1" SLEPC_VERSION_MAJOR "${SLEPC_VERSION_MAJOR_STRING}" ) - FILE(STRINGS "${SLEPC_SLEPCVERSION_H}" SLEPC_VERSION_MINOR_STRING REGEX "#define.*SLEPC_VERSION_MINOR") STRING(REGEX REPLACE "^.*SLEPC_VERSION_MINOR.*([0-9]+).*" "\\1" @@ -121,11 +94,35 @@ IF(SLEPC_FOUND) STRING(REGEX REPLACE "^.*SLEPC_VERSION_PATCH.*([0-9]+).*" "\\1" SLEPC_VERSION_PATCH "${SLEPC_VERSION_PATCH_STRING}" ) - SET(SLEPC_VERSION "${SLEPC_VERSION_MAJOR}.${SLEPC_VERSION_MINOR}.${SLEPC_VERSION_SUBMINOR}.${SLEPC_VERSION_PATCH}" ) +ENDIF() + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SLEPC DEFAULT_MSG + SLEPC_LIBRARY + SLEPC_INCLUDE_DIR_ARCH + SLEPC_INCLUDE_DIR_COMMON + PETSC_FOUND + ) +MARK_AS_ADVANCED( + SLEPC_DIR + SLEPC_INCLUDE_DIR_ARCH + SLEPC_INCLUDE_DIR_COMMON + SLEPC_INCLUDE_DIRS + SLEPC_LIBRARY + ) + +IF(SLEPC_FOUND) + SET(SLEPC_INCLUDE_DIRS + ${SLEPC_INCLUDE_DIR_ARCH} + ${SLEPC_INCLUDE_DIR_COMMON} + ) + SET(SLEPC_LIBRARIES + ${SLEPC_LIBRARY} + ${PETSC_LIBRARIES} + ) MARK_AS_ADVANCED(SLEPC_DIR) ENDIF() diff --git a/deal.II/cmake/modules/FindTBB.cmake b/deal.II/cmake/modules/FindTBB.cmake index 354f968074..0efd5ef351 100644 --- a/deal.II/cmake/modules/FindTBB.cmake +++ b/deal.II/cmake/modules/FindTBB.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -32,14 +32,7 @@ INCLUDE(FindPackageHandleStandardArgs) SET(TBB_DIR "" CACHE PATH "An optional hint to a TBB installation") SET_IF_EMPTY(TBB_DIR "$ENV{TBB_DIR}") -FIND_PATH(TBB_INCLUDE_DIR tbb/tbb_stddef.h - HINTS - ${TBB_DIR} - PATH_SUFFIXES include include/tbb tbb - ) - FILE(GLOB _path ${TBB_DIR}/build/*_release) - FIND_LIBRARY(TBB_LIBRARY NAMES tbb HINTS @@ -49,7 +42,6 @@ FIND_LIBRARY(TBB_LIBRARY ) FILE(GLOB _path ${TBB_DIR}/build/*_debug) - FIND_LIBRARY(TBB_DEBUG_LIBRARY NAMES tbb_debug HINTS @@ -58,29 +50,33 @@ FIND_LIBRARY(TBB_DEBUG_LIBRARY PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG - TBB_LIBRARY - TBB_INCLUDE_DIR +FIND_PATH(TBB_INCLUDE_DIR tbb/tbb_stddef.h + HINTS + ${TBB_DIR} + PATH_SUFFIXES include include/tbb tbb ) -IF(NOT TBB_INCLUDE_DIR MATCHES "-NOTFOUND") +IF(EXISTS ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h) FILE(STRINGS "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" TBB_VERSION_MAJOR_STRING REGEX "#define.*TBB_VERSION_MAJOR") STRING(REGEX REPLACE "^.*TBB_VERSION_MAJOR.*([0-9]+).*" "\\1" TBB_VERSION_MAJOR "${TBB_VERSION_MAJOR_STRING}" ) - FILE(STRINGS "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" TBB_VERSION_MINOR_STRING REGEX "#define.*TBB_VERSION_MINOR") STRING(REGEX REPLACE "^.*TBB_VERSION_MINOR.*([0-9]+).*" "\\1" TBB_VERSION_MINOR "${TBB_VERSION_MINOR_STRING}" ) - SET(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}" ) ENDIF() +FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG + TBB_LIBRARY + TBB_INCLUDE_DIR + ) + MARK_AS_ADVANCED( TBB_LIBRARY TBB_DEBUG_LIBRARY diff --git a/deal.II/cmake/modules/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake index edb94438d4..fa266cce44 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -57,6 +57,24 @@ IF(NOT "${TRILINOS_CONFIG_DIR}" STREQUAL "${TRILINOS_CONFIG_DIR_SAVED}") ENDIF() SET(TRILINOS_CONFIG_DIR_SAVED "${TRILINOS_CONFIG_DIR}" CACHE INTERNAL "" FORCE) +IF(DEFINED Trilinos_VERSION) + # + # Extract version numbers: + # + SET(TRILINOS_VERSION "${Trilinos_VERSION}") + + STRING(REGEX REPLACE + "^([0-9]+).*$" "\\1" + TRILINOS_VERSION_MAJOR "${Trilinos_VERSION}") + + STRING(REGEX REPLACE + "^[0-9]+\\.([0-9]+).*$" "\\1" + TRILINOS_VERSION_MINOR "${Trilinos_VERSION}") + + STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" + TRILINOS_VERSION_SUBMINOR "${Trilinos_VERSION}") +ENDIF() # # Look for the one include file that we'll query for further information: @@ -74,6 +92,32 @@ FIND_FILE(EPETRA_CONFIG_H Epetra_config.h NO_CMAKE_FIND_ROOT_PATH ) +IF(EXISTS ${EPETRA_CONFIG_H}) + # + # Determine whether Trilinos was configured with MPI and 64bit indices: + # + FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_MPI_STRING + REGEX "#define HAVE_MPI") + IF("${EPETRA_MPI_STRING}" STREQUAL "") + SET(TRILINOS_WITH_MPI FALSE) + ELSE() + SET(TRILINOS_WITH_MPI TRUE) + ENDIF() + FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_32BIT_STRING + REGEX "#define EPETRA_NO_32BIT_GLOBAL_INDICES") + IF("${EPETRA_64BIT_STRING}" STREQUAL "") + SET(TRILINOS_WITH_NO_32BITS_INDICES TRUE) + ELSE() + SET(TRILINOS_WITH_NO_32BITS_INDICES FALSE) + ENDIF() + FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_64BIT_STRING + REGEX "#define EPETRA_NO_64BIT_GLOBAL_INDICES") + IF("${EPETRA_64BIT_STRING}" STREQUAL "") + SET(TRILINOS_WITH_NO_64BITS_INDICES TRUE) + ELSE() + SET(TRILINOS_WITH_NO_64BITS_INDICES FALSE) + ENDIF() +ENDIF() # # *Boy* Sanitize the include paths given by TrilinosConfig.cmake... @@ -131,47 +175,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TRILINOS DEFAULT_MSG MARK_AS_ADVANCED(TRILINOS_CONFIG_DIR EPETRA_CONFIG_H) IF(TRILINOS_FOUND) - # - # Extract version numbers: - # - SET(TRILINOS_VERSION "${Trilinos_VERSION}") - - STRING(REGEX REPLACE - "^([0-9]+).*$" "\\1" - TRILINOS_VERSION_MAJOR "${Trilinos_VERSION}") - - STRING(REGEX REPLACE - "^[0-9]+\\.([0-9]+).*$" "\\1" - TRILINOS_VERSION_MINOR "${Trilinos_VERSION}") - - STRING(REGEX REPLACE - "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" - TRILINOS_VERSION_SUBMINOR "${Trilinos_VERSION}") - - # - # Determine whether Trilinos was configured with MPI and 64bit indices: - # - FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_MPI_STRING - REGEX "#define HAVE_MPI") - IF("${EPETRA_MPI_STRING}" STREQUAL "") - SET(TRILINOS_WITH_MPI FALSE) - ELSE() - SET(TRILINOS_WITH_MPI TRUE) - ENDIF() - FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_32BIT_STRING - REGEX "#define EPETRA_NO_32BIT_GLOBAL_INDICES") - IF("${EPETRA_64BIT_STRING}" STREQUAL "") - SET(TRILINOS_WITH_NO_32BITS_INDICES TRUE) - ELSE() - SET(TRILINOS_WITH_NO_32BITS_INDICES FALSE) - ENDIF() - FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_64BIT_STRING - REGEX "#define EPETRA_NO_64BIT_GLOBAL_INDICES") - IF("${EPETRA_64BIT_STRING}" STREQUAL "") - SET(TRILINOS_WITH_NO_64BITS_INDICES TRUE) - ELSE() - SET(TRILINOS_WITH_NO_64BITS_INDICES FALSE) - ENDIF() # # Some versions of Sacado_cmath.hpp do things that aren't compatible diff --git a/deal.II/cmake/modules/FindUMFPACK.cmake b/deal.II/cmake/modules/FindUMFPACK.cmake index 9db4548663..96f5259224 100644 --- a/deal.II/cmake/modules/FindUMFPACK.cmake +++ b/deal.II/cmake/modules/FindUMFPACK.cmake @@ -1,7 +1,7 @@ ## --------------------------------------------------------------------- ## $Id$ ## -## Copyright (C) 2012 - 2013 by the deal.II authors +## Copyright (C) 2012 - 2014 by the deal.II authors ## ## This file is part of the deal.II library. ##