From d5bba80505e259f9be40e16c664f4722094283b7 Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 15 May 2014 16:14:45 +0000 Subject: [PATCH] CMake: Some sanity, part II: * Define global suffix lists for all the FOREACH loops over feature and deal.II variables. * Sanely purge all variables associated with a feature if the feature gets disabled git-svn-id: https://svn.dealii.org/trunk@32904 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/configure/configure_2_metis.cmake | 29 ++--- .../configure/configure_2_trilinos.cmake | 14 --- .../cmake/configure/configure_3_petsc.cmake | 25 +--- deal.II/cmake/configure/configure_hdf5.cmake | 12 -- deal.II/cmake/configure/configure_mumps.cmake | 6 - deal.II/cmake/configure/configure_p4est.cmake | 22 ---- deal.II/cmake/configure/configure_slepc.cmake | 5 - .../macros/macro_configure_feature.cmake | 7 ++ .../macros/macro_deal_ii_package_handle.cmake | 25 ++-- .../cmake/macros/macro_purge_feature.cmake | 45 +++++++ .../cmake/macros/macro_register_feature.cmake | 23 +--- deal.II/cmake/modules/FindHDF5.cmake | 2 + deal.II/cmake/modules/FindMUMPS.cmake | 8 +- deal.II/cmake/modules/FindP4EST.cmake | 5 +- deal.II/cmake/modules/FindPETSC.cmake | 7 +- deal.II/cmake/modules/FindSLEPC.cmake | 2 + deal.II/cmake/modules/FindTBB.cmake | 2 - deal.II/cmake/modules/FindTRILINOS.cmake | 114 ++++++++---------- deal.II/cmake/modules/FindUMFPACK.cmake | 11 +- deal.II/cmake/setup_deal_ii.cmake | 14 +++ deal.II/cmake/setup_finalize.cmake | 26 ++-- deal.II/cmake/setup_write_config.cmake | 9 +- 22 files changed, 176 insertions(+), 237 deletions(-) create mode 100644 deal.II/cmake/macros/macro_purge_feature.cmake diff --git a/deal.II/cmake/configure/configure_2_metis.cmake b/deal.II/cmake/configure/configure_2_metis.cmake index 739c7a6274..34a47ca1d8 100644 --- a/deal.II/cmake/configure/configure_2_metis.cmake +++ b/deal.II/cmake/configure/configure_2_metis.cmake @@ -21,25 +21,16 @@ MACRO(FEATURE_METIS_FIND_EXTERNAL var) FIND_PACKAGE(METIS) - IF(METIS_FOUND) - IF(METIS_VERSION_MAJOR GREATER 4) - SET(${var} TRUE) - ELSE() - MESSAGE(STATUS "Insufficient metis installation found: " - "Version 5.x required!" - ) - SET(METIS_ADDITIONAL_ERROR_STRING - "Could not find a sufficient modern metis installation: " - "Version 5.x required!\n" - ) - - UNSET(METIS_LIBRARY CACHE) - UNSET(METIS_INCLUDE_DIR CACHE) - SET(METIS_DIR "" CACHE PATH - "An optional hint to a metis directory" - ) - MARK_AS_ADVANCED(CLEAR METIS_DIR) - ENDIF() + IF(METIS_FOUND AND METIS_VERSION_MAJOR GREATER 4) + SET(${var} TRUE) + ELSE() + MESSAGE(STATUS "Insufficient metis installation found: " + "Version 5.x required!" + ) + SET(METIS_ADDITIONAL_ERROR_STRING + "Could not find a sufficient modern metis installation: " + "Version 5.x required!\n" + ) ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_2_trilinos.cmake b/deal.II/cmake/configure/configure_2_trilinos.cmake index b7b0006211..2977f38846 100644 --- a/deal.II/cmake/configure/configure_2_trilinos.cmake +++ b/deal.II/cmake/configure/configure_2_trilinos.cmake @@ -179,24 +179,11 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() ENDIF() - - ENDIF(TRILINOS_FOUND) - - IF(NOT ${var}) - UNSET(TRILINOS_CONFIG CACHE) - SET(TRILINOS_DIR "" CACHE STRING - "An optional hint to a Trilinos installation" - ) - MARK_AS_ADVANCED(CLEAR TRILINOS_DIR) ENDIF() - ENDMACRO() MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL) - - SET(TRILINOS_USER_INCLUDE_DIRS ${TRILINOS_INCLUDE_DIRS}) - SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::Vector") SET(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR "TrilinosWrappers::BlockVector") SET(DEAL_II_EXPAND_TRILINOS_SPARSITY_PATTERN "TrilinosWrappers::SparsityPattern") @@ -210,7 +197,6 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL) ENABLE_IF_SUPPORTED(TRILINOS_CXX_FLAGS "-Wno-unused") ENABLE_IF_SUPPORTED(TRILINOS_CXX_FLAGS "-Wno-extra") ENABLE_IF_SUPPORTED(TRILINOS_CXX_FLAGS "-Wno-overloaded-virtual") - ENDMACRO() diff --git a/deal.II/cmake/configure/configure_3_petsc.cmake b/deal.II/cmake/configure/configure_3_petsc.cmake index 81cdd69e30..60d0f8e10b 100644 --- a/deal.II/cmake/configure/configure_3_petsc.cmake +++ b/deal.II/cmake/configure/configure_3_petsc.cmake @@ -93,37 +93,20 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() - - IF(NOT ${var}) - UNSET(PETSC_INCLUDE_DIR_ARCH CACHE) - UNSET(PETSC_INCLUDE_DIR_COMMON CACHE) - UNSET(PETSC_LIBRARY CACHE) - UNSET(PETSC_PETSCVARIABLES CACHE) - SET(PETSC_DIR "" CACHE PATH - "An optional hint to a PETSc directory" - ) - SET(PETSC_ARCH "" CACHE STRING - "An optional hint to a PETSc arch" - ) - MARK_AS_ADVANCED(CLEAR PETSC_DIR PETSC_ARCH) - ENDIF() ENDIF() ENDMACRO() MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL) - - SET(PETSC_USER_INCLUDE_DIRS ${PETSC_INCLUDE_DIRS}) + SET(DEAL_II_EXPAND_PETSC_VECTOR "PETScWrappers::Vector") + SET(DEAL_II_EXPAND_PETSC_BLOCKVECTOR "PETScWrappers::BlockVector") + SET(DEAL_II_EXPAND_PETSC_MPI_VECTOR "PETScWrappers::MPI::Vector") + SET(DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR "PETScWrappers::MPI::BlockVector") # # Disable a bunch of warnings when compiling with petsc: # ENABLE_IF_SUPPORTED(PETSC_CXX_FLAGS "-Wno-long-long") - - SET(DEAL_II_EXPAND_PETSC_VECTOR "PETScWrappers::Vector") - SET(DEAL_II_EXPAND_PETSC_BLOCKVECTOR "PETScWrappers::BlockVector") - SET(DEAL_II_EXPAND_PETSC_MPI_VECTOR "PETScWrappers::MPI::Vector") - SET(DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR "PETScWrappers::MPI::BlockVector") ENDMACRO() diff --git a/deal.II/cmake/configure/configure_hdf5.cmake b/deal.II/cmake/configure/configure_hdf5.cmake index 5dd027d482..c86c9612f0 100644 --- a/deal.II/cmake/configure/configure_hdf5.cmake +++ b/deal.II/cmake/configure/configure_hdf5.cmake @@ -22,7 +22,6 @@ MACRO(FEATURE_HDF5_FIND_EXTERNAL var) FIND_PACKAGE(HDF5) IF(HDF5_FOUND) - IF( (HDF5_WITH_MPI AND DEAL_II_WITH_MPI) OR (NOT HDF5_WITH_MPI AND NOT DEAL_II_WITH_MPI) ) SET(${var} TRUE) @@ -38,19 +37,8 @@ MACRO(FEATURE_HDF5_FIND_EXTERNAL var) " DEAL_II_WITH_MPI = ${DEAL_II_WITH_MPI}\n" " HDF5_WITH_MPI = ${HDF5_WITH_MPI}\n" ) - UNSET(HDF5_HL_LIBRARY CACHE) - UNSET(HDF5_INCLUDE_DIR CACHE) - UNSET(HDF5_LIBRARY CACHE) - UNSET(HDF5_PUBCONF CACHE) ENDIF() ENDIF() ENDMACRO() - CONFIGURE_FEATURE(HDF5) - - -# -# The user has to know the location of the hdf5 headers as well: -# -SET(HDF5_USER_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS}) diff --git a/deal.II/cmake/configure/configure_mumps.cmake b/deal.II/cmake/configure/configure_mumps.cmake index a02e94d0b9..78b4bb0b00 100644 --- a/deal.II/cmake/configure/configure_mumps.cmake +++ b/deal.II/cmake/configure/configure_mumps.cmake @@ -20,10 +20,4 @@ SET(FEATURE_MUMPS_DEPENDS DEAL_II_WITH_MPI DEAL_II_WITH_LAPACK) - CONFIGURE_FEATURE(MUMPS) - -# -# The user has to know the location of the MUMPS headers as well: -# -SET(MUMPS_USER_INCLUDE_DIRS ${MUMPS_INCLUDE_DIRS}) diff --git a/deal.II/cmake/configure/configure_p4est.cmake b/deal.II/cmake/configure/configure_p4est.cmake index a54643b60c..967b10b565 100644 --- a/deal.II/cmake/configure/configure_p4est.cmake +++ b/deal.II/cmake/configure/configure_p4est.cmake @@ -54,30 +54,8 @@ MACRO(FEATURE_P4EST_FIND_EXTERNAL var) ) SET(${var} FALSE) ENDIF() - - # - # Reset configuration: - # - IF(NOT ${var}) - UNSET(P4EST_LIBRARY_OPTIMIZED CACHE) - UNSET(P4EST_LIBRARY_DEBUG CACHE) - UNSET(P4EST_INCLUDE_DIR CACHE) - UNSET(SC_LIBRARY_OPTIMIZED CACHE) - UNSET(SC_LIBRARY_DEBUG CACHE) - UNSET(SC_INCLUDE_DIR CACHE) - SET(P4EST_DIR "" CACHE PATH - "An optional hint to a p4est installation/directory" - ) - MARK_AS_ADVANCED(CLEAR P4EST_DIR) - ENDIF() - ENDIF() ENDMACRO() CONFIGURE_FEATURE(P4EST) - -# -# The user has to know the location of the P4est headers as well: -# -SET(P4EST_USER_INCLUDE_DIRS ${P4EST_INCLUDE_DIRS}) diff --git a/deal.II/cmake/configure/configure_slepc.cmake b/deal.II/cmake/configure/configure_slepc.cmake index a4b97958fc..1f98ed4ecb 100644 --- a/deal.II/cmake/configure/configure_slepc.cmake +++ b/deal.II/cmake/configure/configure_slepc.cmake @@ -78,8 +78,3 @@ ENDMACRO() CONFIGURE_FEATURE(SLEPC) - -# -# The user has to know the location of the SLEPC headers as well: -# -SET(SLEPC_USER_INCLUDE_DIRS ${SLEPC_INCLUDE_DIRS}) diff --git a/deal.II/cmake/macros/macro_configure_feature.cmake b/deal.II/cmake/macros/macro_configure_feature.cmake index 60930bf7bf..fa76a34841 100644 --- a/deal.II/cmake/macros/macro_configure_feature.cmake +++ b/deal.II/cmake/macros/macro_configure_feature.cmake @@ -195,6 +195,7 @@ MACRO(CONFIGURE_FEATURE _feature) "DEAL_II_WITH_${_feature} has unmet configuration requirements: " "${_dependency} has to be set to \"ON\"." ) + PURGE_FEATURE(${_feature}) SET_CACHED_OPTION(${_feature} OFF) ENDIF() SET(_dependencies_ok FALSE) @@ -206,6 +207,9 @@ MACRO(CONFIGURE_FEATURE _feature) # # First case: DEAL_II_FORCE_BUNDLED_${_feature} is defined: # + + PURGE_FEATURE(${_feature}) + IF(FEATURE_${_feature}_HAVE_BUNDLED) RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED()") MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.") @@ -241,6 +245,8 @@ MACRO(CONFIGURE_FEATURE _feature) ELSE(FEATURE_${_feature}_EXTERNAL_FOUND) + PURGE_FEATURE(${_feature}) + MESSAGE(STATUS "DEAL_II_WITH_${_feature} has unmet external dependencies.") IF(FEATURE_${_feature}_HAVE_BUNDLED AND DEAL_II_ALLOW_BUNDLED) @@ -272,6 +278,7 @@ MACRO(CONFIGURE_FEATURE _feature) # DEAL_II_WITH_${_feature} is defined and set to OFF, promote it to # cache nevertheless: # + PURGE_FEATURE(${_feature}) SET_CACHED_OPTION(${_feature} OFF) ENDIF() diff --git a/deal.II/cmake/macros/macro_deal_ii_package_handle.cmake b/deal.II/cmake/macros/macro_deal_ii_package_handle.cmake index 4472f74c61..8fa5e6142d 100644 --- a/deal.II/cmake/macros/macro_deal_ii_package_handle.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_package_handle.cmake @@ -56,7 +56,6 @@ MACRO(DEAL_II_PACKAGE_HANDLE _feature _var) SET(${_feature}_FOUND TRUE) SET(_variable ${_var}) - SET(_cleanup ${_var}) SET(${_feature}_${_variable} "") SET(_required TRUE) SET(_fine TRUE) @@ -82,7 +81,6 @@ MACRO(DEAL_II_PACKAGE_HANDLE _feature _var) # *Yay* a new keyword. # SET(_variable ${_arg}) - LIST(APPEND _cleanup ${_var}) SET(${_feature}_${_variable} "") SET(_required TRUE) SET(_fine TRUE) @@ -139,27 +137,22 @@ MACRO(DEAL_II_PACKAGE_HANDLE _feature _var) IF(${_feature}_FOUND) # - # Deduplicate entries in *_INCLUDE_DIRS and *_LIBRARIES + # Deduplicate entries: # - FOREACH(_suffix INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS) - REMOVE_DUPLICATES(${_feature}_${_suffix}) - ENDFOREACH() - FOREACH(_suffix - LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG - USER_DEFINITIONS USER_DEFINITIONS_DEBUG USER_DEFINITIONS_RELEASE - DEFINITIONS DEFINITIONS_DEBUG DEFINITIONS_RELEASE - ) - REMOVE_DUPLICATES(${_feature}_${_suffix} REVERSE) + FOREACH(_suffix ${DEAL_II_LIST_SUFFIXES}) + IF(_suffix MATCHES "INCLUDE_DIRS$") + REMOVE_DUPLICATES(${_feature}_${_suffix}) + ELSE() + REMOVE_DUPLICATES(${_feature}_${_suffix} REVERSE) + ENDIF() ENDFOREACH() MESSAGE(STATUS "Found ${_feature}") - MARK_AS_ADVANCED(${_feature}_DIR) + + MARK_AS_ADVANCED(${_feature}_DIR ${_feature}_ARCH) ELSE() - FOREACH(_v _cleanup) - SET(${_feature}_${_v}) - ENDFOREACH() MESSAGE(STATUS "Could NOT find ${_feature}") ENDIF() ENDMACRO() diff --git a/deal.II/cmake/macros/macro_purge_feature.cmake b/deal.II/cmake/macros/macro_purge_feature.cmake new file mode 100644 index 0000000000..3b5a493504 --- /dev/null +++ b/deal.II/cmake/macros/macro_purge_feature.cmake @@ -0,0 +1,45 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2014 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# Remove all cached and non cached variables associated with a feature. +# +# Usage: +# PURGE_FEATURE(feature) +# + +MACRO(PURGE_FEATURE _feature) + # + # uncached: + # + FOREACH(_var ${DEAL_II_LIST_SUFFIXES} ${DEAL_II_STRING_SUFFIXES}) + IF(NOT _var MATCHES BUNDLED) + SET(${_feature}_${_var}) + ENDIF() + ENDFOREACH() + + # + # cached: + # + FOREACH(_var ${${_feature}_CLEAR_VARIABLES}) + SET(${_var}) + UNSET(${_var} CACHE) + ENDFOREACH() + + UNSET(${_feature}_CLEAR_VARIABLES CACHE) + + MARK_AS_ADVANCED(CLEAR ${_feature}_DIR ${_feature}_ARCH) +ENDMACRO() diff --git a/deal.II/cmake/macros/macro_register_feature.cmake b/deal.II/cmake/macros/macro_register_feature.cmake index 1f6ed329a0..9fd0017190 100644 --- a/deal.II/cmake/macros/macro_register_feature.cmake +++ b/deal.II/cmake/macros/macro_register_feature.cmake @@ -25,14 +25,9 @@ # This macro will add # # _LIBRARIES (respecting general, optimized, debug keyword) -# _LIBRARIES(_DEBUG|_RELEASE) -# _(|BUNDLED_|USER_)INCLUDE_DIRS -# _DEFINITIONS(|_DEBUG|_RELEASE) -# _USER_DEFINITIONS(|_DEBUG|_RELEASE) -# _CXX_FLAGS(|_DEBUG|_RELEASE) -# _LINKER_FLAGS(|_DEBUG|_RELEASE) # -# to the corresponding DEAL_II_* variables +# and all other suffixes defined in DEAL_II_LIST_SUFFIXES and +# DEAL_II_STRING_SUFFIXES to the corresponding DEAL_II_* variables # MACRO(REGISTER_FEATURE _feature) @@ -63,21 +58,13 @@ MACRO(REGISTER_FEATURE _feature) ENDFOREACH() ENDIF() - FOREACH(_var - LIBRARIES_DEBUG LIBRARIES_RELEASE - INCLUDE_DIRS BUNDLED_INCLUDE_DIRS USER_INCLUDE_DIRS - DEFINITIONS DEFINITIONS_DEBUG DEFINITIONS_RELEASE - USER_DEFINITIONS USER_DEFINITIONS_DEBUG USER_DEFINITIONS_RELEASE - ) - IF(DEFINED ${_feature}_${_var}) + FOREACH(_var ${DEAL_II_LIST_SUFFIXES}) + IF(NOT "${_var}" STREQUAL "LIBRARIES" AND DEFINED ${_feature}_${_var}) LIST(APPEND DEAL_II_${_var} ${${_feature}_${_var}}) ENDIF() ENDFOREACH() - FOREACH(_var - CXX_FLAGS CXX_FLAGS_DEBUG CXX_FLAGS_RELEASE - LINKER_FLAGS LINKER_FLAGS_DEBUG LINKER_FLAGS_RELEASE - ) + FOREACH(_var ${DEAL_II_STRING_SUFFIXES}) IF(DEFINED ${_feature}_${_var}) ADD_FLAGS(DEAL_II_${_var} "${${_feature}_${_var}}") ENDIF() diff --git a/deal.II/cmake/modules/FindHDF5.cmake b/deal.II/cmake/modules/FindHDF5.cmake index ea5e594e3f..1b47573bf1 100644 --- a/deal.II/cmake/modules/FindHDF5.cmake +++ b/deal.II/cmake/modules/FindHDF5.cmake @@ -67,5 +67,7 @@ DEAL_II_PACKAGE_HANDLE(HDF5 OPTIONAL MPI_C_LIBRARIES INCLUDE_DIRS REQUIRED HDF5_INCLUDE_DIR + USER_INCLUDE_DIRS + REQUIRED HDF5_INCLUDE_DIR CLEAR HDF5_HL_LIBRARY HDF5_LIBRARY HDF5_INCLUDE_DIR HDF5_PUBCONF ) diff --git a/deal.II/cmake/modules/FindMUMPS.cmake b/deal.II/cmake/modules/FindMUMPS.cmake index 54cb744eba..697e2bbec1 100644 --- a/deal.II/cmake/modules/FindMUMPS.cmake +++ b/deal.II/cmake/modules/FindMUMPS.cmake @@ -56,7 +56,6 @@ FOREACH(_lib blacs blacsCinit blacsF77init) HINTS ${BLACS_DIR} ${SCALAPACK_DIR} ${SCALAPACK_DIR}/../blacs/ PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib LIB ) - MARK_AS_ADVANCED(${_lib_upper}_LIBRARY) ENDFOREACH() # @@ -88,11 +87,6 @@ FIND_LIBRARY(PORD_LIBRARY HINTS ${MUMPS_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) -MARK_AS_ADVANCED(PORD_LIBRARY) -IF(PORD_LIBRARY MATCHES "-NOTFOUND") - SET(PORD_LIBRARY "") - UNSET(PORD_LIBRARY CACHE) -ENDIF() IF(EXISTS ${MUMPS_INCLUDE_DIR}/dmumps_c.h) FILE(STRINGS "${MUMPS_INCLUDE_DIR}/dmumps_c.h" MUMPS_VERSION_STRING @@ -120,6 +114,8 @@ DEAL_II_PACKAGE_HANDLE(MUMPS OPTIONAL METIS_LIBRARIES MPI_Fortran_LIBRARIES INCLUDE_DIRS REQUIRED MUMPS_INCLUDE_DIR + USER_INCLUDE_DIRS + REQUIRED MUMPS_INCLUDE_DIR LINKER_FLAGS OPTIONAL LAPACK_LINKER_FLAGS CLEAR diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake index 3888f7973d..8246a0a5aa 100644 --- a/deal.II/cmake/modules/FindP4EST.cmake +++ b/deal.II/cmake/modules/FindP4EST.cmake @@ -28,8 +28,6 @@ # P4EST_VERSION_PATCH # -INCLUDE(FindPackageHandleStandardArgs) - SET(P4EST_DIR "" CACHE PATH "An optional hint to a p4est installation/directory" ) @@ -87,7 +85,6 @@ FIND_LIBRARY(SC_LIBRARY_DEBUG HINTS ${SC_DIR}/DEBUG ${P4EST_DIR}/DEBUG PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src sc/src ) -MARK_AS_ADVANCED(P4EST_LIBRARY_DEBUG SC_LIBRARY_DEBUG) IF( ( "${P4EST_LIBRARY_OPTIMIZED}" STREQUAL "${P4EST_LIBRARY_DEBUG}" AND "${SC_LIBRARY_OPTIMIZED}" STREQUAL "${SC_LIBRARY_DEBUG}" ) @@ -156,6 +153,8 @@ DEAL_II_PACKAGE_HANDLE(P4EST OPTIONAL LAPACK_LIBRARIES MPI_C_LIBRARIES INCLUDE_DIRS REQUIRED P4EST_INCLUDE_DIR SC_INCLUDE_DIR + USER_INCLUDE_DIRS + REQUIRED P4EST_INCLUDE_DIR SC_INCLUDE_DIR CLEAR SC_INCLUDE_DIR P4EST_LIBRARY_OPTIMIZED SC_LIBRARY_OPTIMIZED P4EST_LIBRARY_DEBUG SC_LIBRARY_DEBUG P4EST_INCLUDE_DIR diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index c21090fbd6..574c545f3e 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -225,11 +225,16 @@ DEAL_II_PACKAGE_HANDLE(PETSC INCLUDE_DIRS REQUIRED PETSC_INCLUDE_DIR_COMMON PETSC_INCLUDE_DIR_ARCH OPTIONAL _petsc_includes + USER_INCLUDE_DIRS + REQUIRED PETSC_INCLUDE_DIR_COMMON PETSC_INCLUDE_DIR_ARCH + OPTIONAL _petsc_includes CLEAR PETSC_LIBRARY PETSC_INCLUDE_DIR_COMMON PETSC_INCLUDE_DIR_ARCH - ${_cleanup_variables} + PETSC_PETSCVARIABLES ${_cleanup_variables} ) IF(PETSC_FOUND) MARK_AS_ADVANCED(PETSC_ARCH) +ELSE() + MARK_AS_ADVANCED(CLEAR PETSC_ARCH) ENDIF() diff --git a/deal.II/cmake/modules/FindSLEPC.cmake b/deal.II/cmake/modules/FindSLEPC.cmake index b558e7a39e..f328927bdb 100644 --- a/deal.II/cmake/modules/FindSLEPC.cmake +++ b/deal.II/cmake/modules/FindSLEPC.cmake @@ -95,5 +95,7 @@ DEAL_II_PACKAGE_HANDLE(SLEPC REQUIRED SLEPC_LIBRARY PETSC_LIBRARIES INCLUDE_DIRS REQUIRED SLEPC_INCLUDE_DIR_ARCH SLEPC_INCLUDE_DIR_COMMON + USER_INCLUDE_DIRS + REQUIRED SLEPC_INCLUDE_DIR_ARCH SLEPC_INCLUDE_DIR_COMMON CLEAR SLEPC_LIBRARY SLEPC_INCLUDE_DIR_ARCH SLEPC_INCLUDE_DIR_COMMON ) diff --git a/deal.II/cmake/modules/FindTBB.cmake b/deal.II/cmake/modules/FindTBB.cmake index d2f07d7a59..828626cbc6 100644 --- a/deal.II/cmake/modules/FindTBB.cmake +++ b/deal.II/cmake/modules/FindTBB.cmake @@ -27,8 +27,6 @@ # TBB_VERSION_MINOR # -INCLUDE(FindPackageHandleStandardArgs) - SET(TBB_DIR "" CACHE PATH "An optional hint to a TBB installation") SET_IF_EMPTY(TBB_DIR "$ENV{TBB_DIR}") diff --git a/deal.II/cmake/modules/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake index eb1b9b5685..64a617ea48 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.cmake @@ -31,8 +31,6 @@ # TRILINOS_HAS_C99_TR1_WORKAROUND # -INCLUDE(FindPackageHandleStandardArgs) - SET(TRILINOS_DIR "" CACHE PATH "An optional hint to a Trilinos installation") SET_IF_EMPTY(TRILINOS_DIR "$ENV{TRILINOS_DIR}") @@ -52,11 +50,15 @@ FIND_PACKAGE(TRILINOS_CONFIG NO_SYSTEM_ENVIRONMENT_PATH ) -IF(NOT "${TRILINOS_CONFIG_DIR}" STREQUAL "${TRILINOS_CONFIG_DIR_SAVED}") - SET(_new_trilinos_config TRUE) +IF( DEFINED TRILINOS_CONFIG_DIR_SAVED AND + NOT "${TRILINOS_CONFIG_DIR}" STREQUAL "${TRILINOS_CONFIG_DIR_SAVED}" ) + SET(_backup ${TRILINOS_CONFIG_DIR}) + PURGE_FEATURE(TRILINOS) + SET(TRILINOS_CONFIG_DIR ${_backup} CACHE INTERNAL "") ENDIF() SET(TRILINOS_CONFIG_DIR_SAVED "${TRILINOS_CONFIG_DIR}" CACHE INTERNAL "" FORCE) + IF(DEFINED Trilinos_VERSION) # # Extract version numbers: @@ -79,18 +81,10 @@ ENDIF() # # Look for the one include file that we'll query for further information: # -# TODO: -IF(_new_trilinos_config) - UNSET(EPETRA_CONFIG_H CACHE) -ENDIF() FIND_FILE(EPETRA_CONFIG_H Epetra_config.h HINTS ${Trilinos_INCLUDE_DIRS} - NO_DEFAULT_PATH - NO_CMAKE_ENVIRONMENT_PATH - NO_CMAKE_PATH - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH - NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH ) IF(EXISTS ${EPETRA_CONFIG_H}) @@ -120,6 +114,44 @@ IF(EXISTS ${EPETRA_CONFIG_H}) ENDIF() ENDIF() +# +# Some versions of Sacado_cmath.hpp do things that aren't compatible +# with the -std=c++0x flag of GCC, see deal.II FAQ. +# Test whether that is indeed the case: +# + +FIND_FILE(SACADO_CMATH_HPP Sacado_cmath.hpp + HINTS ${Trilinos_INCLUDE_DIRS} + NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH + ) + +IF(EXISTS ${SACADO_CMATH_HPP}) + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${Trilinos_INCLUDE_DIRS}) + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}") + + CHECK_CXX_SOURCE_COMPILES( + " + #include + int main(){ return 0; } + " + TRILINOS_SUPPORTS_CPP11 + ) + + # + # Try whether exporting HAS_C99_TR1_CMATH helps: + # + PUSH_CMAKE_REQUIRED("-DHAS_C99_TR1_CMATH") + CHECK_CXX_SOURCE_COMPILES( + " + #include + int main(){ return 0; } + " + TRILINOS_HAS_C99_TR1_WORKAROUND + ) + RESET_CMAKE_REQUIRED() +ENDIF() + # # *Boy* Sanitize the include paths given by TrilinosConfig.cmake... # @@ -135,10 +167,7 @@ STRING(REGEX REPLACE # SET(_libraries "") FOREACH(_library ${Trilinos_LIBRARIES}) - IF(_new_trilinos_config) - UNSET(TRILINOS_LIBRARY_${_library} CACHE) - ENDIF() - + LIST(APPEND _libraries TRILINOS_LIBRARY_${_library}) FIND_LIBRARY(TRILINOS_LIBRARY_${_library} NAMES ${_library} HINTS ${Trilinos_LIBRARY_DIRS} @@ -149,55 +178,18 @@ FOREACH(_library ${Trilinos_LIBRARIES}) NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH ) - - LIST(APPEND _libraries TRILINOS_LIBRARY_${_library}) ENDFOREACH() + DEAL_II_PACKAGE_HANDLE(TRILINOS LIBRARIES REQUIRED ${_libraries} Trilinos_TPL_LIBRARIES OPTIONAL MPI_CXX_LIBRARIES INCLUDE_DIRS REQUIRED Trilinos_INCLUDE_DIRS - CLEAR TRILINOS_CONFIG EPETRA_CONFIG_H ${_libraries} + USER_INCLUDE_DIRS + REQUIRED Trilinos_INCLUDE_DIRS + CLEAR + TRILINOS_CONFIG_DIR EPETRA_CONFIG_H SACADO_CMATH_HPP ${_libraries} + TRILINOS_SUPPORTS_CPP11 TRILINOS_HAS_C99_TR1_WORKAROUND ) - -IF(TRILINOS_FOUND) - # - # Some versions of Sacado_cmath.hpp do things that aren't compatible - # with the -std=c++0x flag of GCC, see deal.II FAQ. - # Test whether that is indeed the case: - # - IF(_new_trilinos_config) - UNSET(TRILINOS_SUPPORTS_CPP11 CACHE) - UNSET(TRILINOS_HAS_C99_TR1_WORKAROUND CACHE) - ENDIF() - - LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIRS}) - PUSH_CMAKE_REQUIRED("${DEAL_II_CXX11_FLAG}") - - CHECK_CXX_SOURCE_COMPILES( - " - #include - int main(){ return 0; } - " - TRILINOS_SUPPORTS_CPP11 - ) - - # - # Try whether exporting HAS_C99_TR1_CMATH helps: - # - PUSH_CMAKE_REQUIRED("-DHAS_C99_TR1_CMATH") - CHECK_CXX_SOURCE_COMPILES( - " - #include - int main(){ return 0; } - " - TRILINOS_HAS_C99_TR1_WORKAROUND - ) - RESET_CMAKE_REQUIRED() - -ELSE() - - UNSET(TRILINOS_CONFIG_DIR_SAVED CACHE) -ENDIF() diff --git a/deal.II/cmake/modules/FindUMFPACK.cmake b/deal.II/cmake/modules/FindUMFPACK.cmake index 7a42e42a9e..9db0d3546f 100644 --- a/deal.II/cmake/modules/FindUMFPACK.cmake +++ b/deal.II/cmake/modules/FindUMFPACK.cmake @@ -28,8 +28,6 @@ # UMFPACK_VERSION_SUBMINOR # -INCLUDE(FindPackageHandleStandardArgs) - SET(UMFPACK_DIR "" CACHE PATH "An optional hint to an UMFPACK directory") SET(SUITESPARSE_DIR "" CACHE PATH "An optional hint to a SUITESPARSE directory" @@ -146,6 +144,7 @@ ENDIF() # by ldd :-( ): # FIND_SYSTEM_LIBRARY(rt_LIBRARY NAMES rt) +MARK_AS_ADVANCED(rt_LIBRARY) DEAL_II_PACKAGE_HANDLE(UMFPACK LIBRARIES @@ -160,12 +159,12 @@ DEAL_II_PACKAGE_HANDLE(UMFPACK OPTIONAL LAPACK_LINKER_FLAGS CLEAR UMFPACK_LIBRARY CHOLMOD_LIBRARY CCOLAMD_LIBRARY COLAMD_LIBRARY - CAMD_LIBRARY SuiteSparse_config_LIBRARY AMD_LIBRARY METIS_LIBRARIES - LAPACK_LIBRARIES UMFPACK_INCLUDE_DIR AMD_INCLUDE_DIR - SuiteSparse_config_INCLUDE_DIR + CAMD_LIBRARY SuiteSparse_config_LIBRARY AMD_LIBRARY UMFPACK_INCLUDE_DIR + AMD_INCLUDE_DIR SuiteSparse_config_INCLUDE_DIR ) IF(UMFPACK_FOUND) MARK_AS_ADVANCED(SUITESPARSE_DIR) +ELSE() + MARK_AS_ADVANCED(CLEAR SUITESPARSE_DIR) ENDIF() -MARK_AS_ADVANCED(SuiteSparse_config_LIBRARY rt_LIBRARY) diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index 777c066931..6ef18d05cb 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -52,6 +52,8 @@ # DEAL_II_PROJECT_CONFIG_RELDIR *) # # DEAL_II_BUILD_TYPES +# DEAL_II_LIST_SUFFIXES +# DEAL_II_STRING_SUFFIXES # # *) Can be overwritten by the command line via -D<...> # @@ -134,6 +136,18 @@ IF(CMAKE_BUILD_TYPE MATCHES "Release") LIST(APPEND DEAL_II_BUILD_TYPES "RELEASE") ENDIF() +SET(DEAL_II_LIST_SUFFIXES + DEFINITIONS DEFINITIONS_RELEASE DEFINITIONS_DEBUG + USER_DEFINITIONS USER_DEFINITIONS_RELEASE USER_DEFINITIONS_DEBUG + INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS + LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG + ) + +SET(DEAL_II_STRING_SUFFIXES + CXX_FLAGS CXX_FLAGS_RELEASE CXX_FLAGS_DEBUG + LINKER_FLAGS LINKER_FLAGS_RELEASE LINKER_FLAGS_DEBUG + ) + ######################################################################## # # diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index 4d228ea4ae..a568672b89 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -55,14 +55,7 @@ ENDFOREACH() # Save base configuration into variables BASE_* for later use in # setup_write_config.cmake: # -FOREACH(_suffix - CXX_FLAGS CXX_FLAGS_RELEASE CXX_FLAGS_DEBUG - DEFINITIONS DEFINITIONS_RELEASE DEFINITIONS_DEBUG - USER_DEFINITIONS USER_DEFINITIONS_RELEASE USER_DEFINITIONS_DEBUG - LINKER_FLAGS LINKER_FLAGS_RELEASE LINKER_FLAGS_DEBUG - INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS - LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG - ) +FOREACH(_suffix ${DEAL_II_STRING_SUFFIXES} ${DEAL_II_LIST_SUFFIXES}) SET(BASE_${_suffix} ${DEAL_II_${_suffix}}) ENDFOREACH() @@ -70,22 +63,19 @@ ENDFOREACH() # Register features: # FOREACH(_feature ${DEAL_II_FEATURES}) - FILTER_SYSTEM_LIBRARIES(${_feature}) + FILTER_SYSTEM_LIBRARIES(${_feature}) # TODO, remove here REGISTER_FEATURE(${_feature}) ENDFOREACH() # # Deduplicate entries one more time :-] # -FOREACH(_suffix INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS) - REMOVE_DUPLICATES(DEAL_II_${_suffix}) -ENDFOREACH() -FOREACH(_suffix - LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG - USER_DEFINITIONS USER_DEFINITIONS_DEBUG USER_DEFINITIONS_RELEASE - DEFINITIONS DEFINITIONS_DEBUG DEFINITIONS_RELEASE - ) - REMOVE_DUPLICATES(DEAL_II_${_suffix} REVERSE) +FOREACH(_suffix ${DEAL_II_LIST_SUFFIXES}) + IF(_suffix MATCHES "INCLUDE_DIRS$") + REMOVE_DUPLICATES(DEAL_II_${_suffix}) + ELSE() + REMOVE_DUPLICATES(DEAL_II_${_suffix} REVERSE) + ENDIF() ENDFOREACH() # diff --git a/deal.II/cmake/setup_write_config.cmake b/deal.II/cmake/setup_write_config.cmake index 1afca5ff20..6acc88aefa 100644 --- a/deal.II/cmake/setup_write_config.cmake +++ b/deal.II/cmake/setup_write_config.cmake @@ -199,13 +199,8 @@ FOREACH(_var ${_features}) # Print the feature configuration: # FOREACH(_var2 - C_COMPILER CXX_COMPILER Fortran_COMPILER - CXX_FLAGS CXX_FLAGS_RELEASE CXX_FLAGS_DEBUG - DEFINITIONS DEFINITIONS_RELEASE DEFINITIONS_DEBUG - USER_DEFINITIONS USER_DEFINITIONS_RELEASE USER_DEFINITIONS_DEBUG - LINKER_FLAGS LINKER_FLAGS_RELEASE LINKER_FLAGS_DEBUG - INCLUDE_DIRS USER_INCLUDE_DIRS BUNDLED_INCLUDE_DIRS - LIBRARIES LIBRARIES_RELEASE LIBRARIES_DEBUG + C_COMPILER CXX_COMPILER Fortran_COMPILER + ${DEAL_II_STRING_SUFFIXES} ${DEAL_II_LIST_SUFFIXES} ) IF(DEFINED ${_feature}_${_var2}) _detailed("# ${_feature}_${_var2} = ${${_feature}_${_var2}}\n") -- 2.39.5