]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Some sanity, part I:
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 15 May 2014 16:14:42 +0000 (16:14 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 15 May 2014 16:14:42 +0000 (16:14 +0000)
Save all cached variables belonging to a feature in a variable
FEATURE_CLEAR_VARIABLES so that we know what cache entry belongs to a
feature.

git-svn-id: https://svn.dealii.org/trunk@32903 0785d39b-7218-0410-832d-ea1e28bc413d

14 files changed:
deal.II/cmake/macros/macro_deal_ii_package_handle.cmake
deal.II/cmake/modules/FindARPACK.cmake
deal.II/cmake/modules/FindHDF5.cmake
deal.II/cmake/modules/FindMETIS.cmake
deal.II/cmake/modules/FindMUMPS.cmake
deal.II/cmake/modules/FindMUPARSER.cmake
deal.II/cmake/modules/FindNETCDF.cmake
deal.II/cmake/modules/FindP4EST.cmake
deal.II/cmake/modules/FindPETSC.cmake
deal.II/cmake/modules/FindSCALAPACK.cmake [deleted file]
deal.II/cmake/modules/FindSLEPC.cmake
deal.II/cmake/modules/FindTBB.cmake
deal.II/cmake/modules/FindTRILINOS.cmake
deal.II/cmake/modules/FindUMFPACK.cmake

index 460f5b5d35bc2c61512c0a92207632c9c81f95a1..4472f74c6142ca5f375a246f5302eb78b42d4b15 100644 (file)
 ## ---------------------------------------------------------------------
 
 #
-# DEAL_II_PACKAGE_HANDLE
+# DEAL_II_PACKAGE_HANDLE(<feature>
+#  {<conf. variable> {(REQUIRED|OPTIONAL) <variables>}}
+#  [CLEAR <variables>]
+#  )
 #
-# TODO: Documentation
+# This macro is an alternative implementation of the
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS macro shipped with CMake - aka do
+# everything that was expected from CMake in the first place *sigh*
+#
+# It's usage is
+# best explained with an example:
+#
+#   DEAL_II_PACKAGE_HANDLE(PETSC
+#     LIBRARIES
+#       REQUIRED PETSC_LIBRARY
+#       OPTIONAL _petsc_libraries
+#     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
+#     )
+#
+# This will check whether all REQUIRED variables are non-empty and
+# different from "-NOTFOUND". If so, PETSC_LIBRARIES and PETSC_INCLUDE_DIRS
+# is defined and populated with the contents of all specified variables.
+# Optional variables with no content or whose content is "-NOTFOUND" are
+# filtered out.
+# After the 'CLEAR' statement all internally cached variables should be
+# listed - this is used to provide a possibility to undo a feature
+# search.
 #
 
 MACRO(DEAL_II_PACKAGE_HANDLE _feature _var)
@@ -33,6 +60,8 @@ MACRO(DEAL_II_PACKAGE_HANDLE _feature _var)
   SET(${_feature}_${_variable} "")
   SET(_required TRUE)
   SET(_fine TRUE)
+  SET(_fill_clear FALSE)
+  SET(_clear "")
 
   FOREACH(_arg ${ARGN})
     IF(_arg MATCHES "^LIBRARIES(|_DEBUG|_RELEASE)$"
@@ -62,34 +91,44 @@ MACRO(DEAL_II_PACKAGE_HANDLE _feature _var)
       SET(_required TRUE)
     ELSEIF("${_arg}" STREQUAL "OPTIONAL")
       SET(_required FALSE)
-    ELSEIF( _arg MATCHES "^(optimized|debug|general)$"
+    ELSEIF(_arg MATCHES "^(optimized|debug|general)$"
             AND "${_variable}" STREQUAL "LIBRARIES")
       #
       # Keywords are special...
       #
       LIST(APPEND ${_feature}_${_variable} ${_arg})
+    ELSEIF("${_arg}" STREQUAL "CLEAR")
+      SET(_fill_clear TRUE)
     ELSE()
       MARK_AS_ADVANCED(${_arg})
-      IF(NOT DEFINED ${_arg} OR ${_arg} MATCHES "-NOTFOUND")
-        IF(_required AND _fine)
-          IF(NOT DEFINED ${_arg})
-            MESSAGE(STATUS
-              "  ${_feature}_${_variable}: *** Required variable \"${_arg}\" undefined ***"
-              )
-          ELSE()
-            MESSAGE(STATUS
-              "  ${_feature}_${_variable}: *** Required variable \"${_arg}\" set to NOTFOUND ***"
-              )
-          ENDIF()
-          SET(${_feature}_FOUND FALSE)
-          SET(_fine FALSE)
+      IF(_fill_clear)
+        IF(NOT _arg MATCHES "^(optimized|debug|general)$")
+          LIST(APPEND _clear ${_arg})
         ENDIF()
       ELSE()
-        LIST(APPEND ${_feature}_${_variable} ${${_arg}})
+        IF(NOT DEFINED ${_arg} OR ${_arg} MATCHES "-NOTFOUND")
+          IF(_required AND _fine)
+            IF(NOT DEFINED ${_arg})
+              MESSAGE(STATUS
+                "  ${_feature}_${_variable}: *** Required variable \"${_arg}\" undefined ***"
+                )
+            ELSE()
+              MESSAGE(STATUS
+                "  ${_feature}_${_variable}: *** Required variable \"${_arg}\" set to NOTFOUND ***"
+                )
+            ENDIF()
+            SET(${_feature}_FOUND FALSE)
+            SET(_fine FALSE)
+          ENDIF()
+        ELSE()
+          LIST(APPEND ${_feature}_${_variable} ${${_arg}})
+        ENDIF()
       ENDIF()
     ENDIF()
   ENDFOREACH()
 
+  SET(${_feature}_CLEAR_VARIABLES ${_clear} CACHE INTERNAL "")
+
   IF(_fine)
     IF(_variable MATCHES "^CXX_FLAGS(|_DEBUG|_RELEASE)"
        OR _variable MATCHES "^LINKER_FLAGS(|_DEBUG|_RELEASE)")
index c739c0ece8657fb2e7fe4d51838bc58e01c11586..f87bb19c6433d653bc4b72d64b1717cbf6dbfcba 100644 (file)
@@ -39,4 +39,5 @@ FIND_LIBRARY(ARPACK_LIBRARY
 DEAL_II_PACKAGE_HANDLE(ARPACK
   LIBRARIES REQUIRED ARPACK_LIBRARY LAPACK_LIBRARIES
   LINKER_FLAGS OPTIONAL LAPACK_LINKER_FLAGS
+  CLEAR ARPACK_LIBRARY
   )
index 258621b53e82af5a153175562d0c4e891a6f12ea..ea5e594e3fab2694a9c6f3097cd3a6856f24d266 100644 (file)
@@ -46,7 +46,6 @@ FIND_FILE(HDF5_PUBCONF NAMES H5pubconf.h H5pubconf-64.h
   HINTS ${HDF5_INCLUDE_DIR} ${HDF5_DIR}
   PATH_SUFFIXES hdf5 hdf5/include include/hdf5 include
   )
-MARK_AS_ADVANCED(HDF5_PUBCONF)
 
 IF(EXISTS ${HDF5_PUBCONF})
   #
@@ -68,4 +67,5 @@ DEAL_II_PACKAGE_HANDLE(HDF5
     OPTIONAL MPI_C_LIBRARIES
   INCLUDE_DIRS
     REQUIRED HDF5_INCLUDE_DIR
+  CLEAR HDF5_HL_LIBRARY HDF5_LIBRARY HDF5_INCLUDE_DIR HDF5_PUBCONF
   )
index 01483cf68983b2a237e5305eb01f0c6faa74a982..5f73bfdf92acaf71c76e3f66ca05d57267306f9f 100644 (file)
@@ -101,4 +101,5 @@ DEAL_II_PACKAGE_HANDLE(METIS
     OPTIONAL MPI_C_LIBRARIES
   INCLUDE_DIRS
     REQUIRED METIS_INCLUDE_DIR
+  CLEAR METIS_LIBRARY PARMETIS_LIBRARY METIS_INCLUDE_DIR
   )
index b6d56d2ca1f29fadfd123cd12f644463838197d3..54cb744ebad1a2a3d1ecbcf10e0a59d18c5c2fb3 100644 (file)
 #
 
 SET(MUMPS_DIR "" CACHE PATH "An optional hint to a mumps directory")
+SET(SCALAPACK_DIR "" CACHE PATH "An optional hint to a SCALAPACK directory")
+SET(BLACS_DIR "" CACHE PATH "An optional hint to a BLACS directory")
 SET_IF_EMPTY(MUMPS_DIR "$ENV{MUMPS_DIR}")
+SET_IF_EMPTY(SCALAPACK_DIR "$ENV{SCALAPACK_DIR}")
+SET_IF_EMPTY(BLACS_DIR "$ENV{BLACS_DIR}")
 
 #
-# Search for all known dependencies of MUMPS:
-# (We'll rely on the user of FindMUMPS, setting up mpi *cough*)
+# Search for scalapack:
 #
-FIND_PACKAGE(SCALAPACK) # which will also include lapack and blas
 
+FIND_LIBRARY(SCALAPACK_LIBRARY NAMES scalapack
+  HINTS ${SCALAPACK_DIR}
+  PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
+  )
+
+#
+# Well, depending on the version of scalapack and the distribution it might
+# be necessary to search for blacs, too. So we do this in a very
+# probabilistic way...
+#
+FOREACH(_lib blacs blacsCinit blacsF77init)
+  STRING(TOUPPER "${_lib}" _lib_upper)
+  FIND_LIBRARY(${_lib_upper}_LIBRARY
+    NAMES ${_lib} ${_lib}_MPI-LINUX-0 ${_lib}_MPI-DARWIN-0
+    HINTS ${BLACS_DIR} ${SCALAPACK_DIR} ${SCALAPACK_DIR}/../blacs/
+    PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib LIB
+  )
+  MARK_AS_ADVANCED(${_lib_upper}_LIBRARY)
+ENDFOREACH()
+
+#
+# Search for mumps:
+#
 
 FIND_PATH(MUMPS_INCLUDE_DIR dmumps_c.h
   HINTS ${MUMPS_DIR}
@@ -90,10 +115,14 @@ DEAL_II_PACKAGE_HANDLE(MUMPS
   LIBRARIES
     REQUIRED DMUMPS_LIBRARY MUMPS_COMMON_LIBRARY
     OPTIONAL PORD_LIBRARY
-    REQUIRED SCALAPACK_LIBRARIES
+    REQUIRED SCALAPACK_LIBRARY LAPACK_LIBRARIES
+    OPTIONAL BLACS_LIBRARY BLACSCINIT_LIBRARY BLACSF77INIT_LIBRARY MPI_Fortran_LIBRARIES
     OPTIONAL METIS_LIBRARIES MPI_Fortran_LIBRARIES
   INCLUDE_DIRS
     REQUIRED MUMPS_INCLUDE_DIR
   LINKER_FLAGS
-    OPTIONAL SCALAPACK_LINKER_FLAGS
+    OPTIONAL LAPACK_LINKER_FLAGS
+  CLEAR
+    DMUMPS_LIBRARY MUMPS_COMMON_LIBRARY PORD_LIBRARY SCALAPACK_LIBRARY
+    BLACS_LIBRARY BLACSCINIT_LIBRARY BLACSF77INIT_LIBRARY MUMPS_INCLUDE_DIR
   )
index d6e42eaf4d223fbfc8777e90d2d0968d22948436..ce861d9f2c580302ed0d7af6d670ab5181f0b7e8 100644 (file)
@@ -62,4 +62,5 @@ ENDIF()
 DEAL_II_PACKAGE_HANDLE(MUPARSER
   LIBRARIES REQUIRED MUPARSER_LIBRARY
   INCLUDE_DIRS REQUIRED MUPARSER_INCLUDE_DIR
+  CLEAR MUPARSER_LIBRARY MUPARSER_INCLUDE_DIR
   )
index 9b99e8b1631e817eb06899c1b708d4593239d3dc..55d802ff40aa539341089da788eb73ddd3d26805 100644 (file)
@@ -51,4 +51,5 @@ FIND_LIBRARY(NETCDF_C_LIBRARY NAMES netcdf
 DEAL_II_PACKAGE_HANDLE(NETCDF
   LIBRARIES REQUIRED NETCDF_CPLUSPLUS_LIBRARY NETCDF_C_LIBRARY
   INCLUDE_DIRS REQUIRED NETCDF_INCLUDE_DIR
+  CLEAR NETCDF_CPLUSPLUS_LIBRARY NETCDF_C_LIBRARY NETCDF_INCLUDE_DIR
   )
index 204fdd09359f4e2eae9974872c32f0af74ce6c0e..3888f7973d49da5a048700cc2df8cdeb520d2997 100644 (file)
@@ -156,4 +156,7 @@ DEAL_II_PACKAGE_HANDLE(P4EST
     OPTIONAL LAPACK_LIBRARIES MPI_C_LIBRARIES
   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
   )
index 9011d48c17b0d2c1104fbca6044572d581ab46f6..c21090fbd6269644862fd4485f5e005b78430290 100644 (file)
@@ -183,6 +183,7 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND")
 
   SET(_hints)
   SET(_petsc_libraries)
+  SET(_cleanup_variables)
   FOREACH(_token ${PETSC_EXTERNAL_LINK_LINE}})
     IF(_token MATCHES "^-L")
       # Build up hints with the help of all tokens passed with -L:
@@ -192,6 +193,8 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND")
       # Search for every library that was specified with -l:
       STRING(REGEX REPLACE "^-l" "" _token "${_token}")
 
+      # TODO:
+      LIST(APPEND _cleanup_variables PETSC_LIBRARY_${_token})
       IF(_new_petsc_external_link_line)
         UNSET(PETSC_LIBRARY_${_token} CACHE)
       ENDIF()
@@ -222,6 +225,9 @@ DEAL_II_PACKAGE_HANDLE(PETSC
   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}
   )
 
 IF(PETSC_FOUND)
diff --git a/deal.II/cmake/modules/FindSCALAPACK.cmake b/deal.II/cmake/modules/FindSCALAPACK.cmake
deleted file mode 100644 (file)
index d8a2950..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-## ---------------------------------------------------------------------
-## $Id$
-##
-## Copyright (C) 2012 - 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.
-##
-## ---------------------------------------------------------------------
-
-#
-# Try to find the SCALAPACK library
-#
-# Used as a helper module for FindMUMPS.cmake
-#
-# This module exports
-#
-#   SCALAPACK_LIBRARIES
-#   SCALAPACK_LINKER_FLAGS
-#
-
-SET(SCALAPACK_DIR "" CACHE PATH "An optional hint to a SCALAPACK directory")
-SET(BLACS_DIR "" CACHE PATH "An optional hint to a BLACS directory")
-SET_IF_EMPTY(SCALAPACK_DIR "$ENV{SCALAPACK_DIR}")
-SET_IF_EMPTY(BLACS_DIR "$ENV{BLACS_DIR}")
-
-FIND_LIBRARY(SCALAPACK_LIBRARY NAMES scalapack
-  HINTS ${SCALAPACK_DIR}
-  PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
-  )
-
-#
-# Well, depending on the version of scalapack and the distribution it might
-# be necessary to search for blacs, too. So we do this in a very
-# probabilistic way...
-#
-FOREACH(_lib blacs blacsCinit blacsF77init)
-  STRING(TOUPPER "${_lib}" _lib_upper)
-  FIND_LIBRARY(${_lib_upper}_LIBRARY
-    NAMES ${_lib} ${_lib}_MPI-LINUX-0 ${_lib}_MPI-DARWIN-0
-    HINTS ${BLACS_DIR} ${SCALAPACK_DIR} ${SCALAPACK_DIR}/../blacs/
-    PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib LIB
-  )
-  MARK_AS_ADVANCED(${_lib_upper}_LIBRARY)
-ENDFOREACH()
-
-DEAL_II_PACKAGE_HANDLE(SCALAPACK
-  LIBRARIES
-    REQUIRED SCALAPACK_LIBRARY LAPACK_LIBRARIES
-    OPTIONAL BLACS_LIBRARY BLACSCINIT_LIBRARY BLACSF77INIT_LIBRARY MPI_Fortran_LIBRARIES
-  LINKER_FLAGS
-    OPTIONAL LAPACK_LINKER_FLAGS
-  )
-
-IF(SCALAPACK_FOUND)
-  MARK_AS_ADVANCED(BLACS_DIR)
-ENDIF()
index 28892f9b9abf9c118041ddebd72371a8d7ade25d..b558e7a39ee17e86ac258adb68f80129df6d3b49 100644 (file)
@@ -95,4 +95,5 @@ DEAL_II_PACKAGE_HANDLE(SLEPC
     REQUIRED SLEPC_LIBRARY PETSC_LIBRARIES
   INCLUDE_DIRS
     REQUIRED SLEPC_INCLUDE_DIR_ARCH SLEPC_INCLUDE_DIR_COMMON
+  CLEAR SLEPC_LIBRARY SLEPC_INCLUDE_DIR_ARCH SLEPC_INCLUDE_DIR_COMMON
   )
index cf19170f4f21ae96f6a1737f68c40b7011b38606..d2f07d7a590ed0becf0982cc5cb54f7b4b2f6e53 100644 (file)
@@ -84,4 +84,5 @@ ENDIF()
 DEAL_II_PACKAGE_HANDLE(TBB
   LIBRARIES REQUIRED ${_libraries}
   INCLUDE_DIRS REQUIRED TBB_INCLUDE_DIR
+  CLEAR TBB_DEBUG_LIBRARY TBB_LIBRARY TBB_INCLUDE_DIR
   )
index f1c493b05b46295db5bea959e8fcc8ae0aa5db4c..eb1b9b568504b01f348828d76e8cc81ab7c0a68b 100644 (file)
@@ -79,6 +79,7 @@ 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()
@@ -158,6 +159,7 @@ DEAL_II_PACKAGE_HANDLE(TRILINOS
     OPTIONAL MPI_CXX_LIBRARIES
   INCLUDE_DIRS
     REQUIRED Trilinos_INCLUDE_DIRS
+  CLEAR TRILINOS_CONFIG EPETRA_CONFIG_H ${_libraries}
   )
 
 IF(TRILINOS_FOUND)
index 0ab55c36b76950e75c02cb4053f3e37fccb81f0c..7a42e42a9ebc7b10e074fc93173734a1ee2fc541 100644 (file)
@@ -158,6 +158,11 @@ DEAL_II_PACKAGE_HANDLE(UMFPACK
     OPTIONAL SuiteSparse_config_INCLUDE_DIR
   LINKER_FLAGS
     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
   )
 
 IF(UMFPACK_FOUND)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.