]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a dependency mechanism to macro_configure_feature
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 16 Sep 2012 18:10:10 +0000 (18:10 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 16 Sep 2012 18:10:10 +0000 (18:10 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26414 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/contrib/cmake/configure/configure_umfpack.cmake
deal.II/contrib/cmake/macros/macro_configure_feature.cmake

index f144c87831b8aa51e18a737b22e8d65ca9a23da1..8a7952e4fdceaf79ebbf6f3480167c7a9b8985ef 100644 (file)
@@ -85,7 +85,7 @@ OPTION(DEAL_II_FEATURE_AUTODETECTION
   "Enables feature autodetection. This will automatically overwrite all
   DEAL_II_WITH_<...> toggles depending on whether they can be supported or
   not."
-  ON)
+  OFF)
 
 OPTION(DEAL_II_ALLOW_CONTRIB
   "Allow the use of contrib libraries bundled with the source tarball.
@@ -93,7 +93,7 @@ OPTION(DEAL_II_ALLOW_CONTRIB
   packages, so to ensure that only external libraries are used
   DEAL_II_ALLOW_CONTRIB as well as all DEAL_II_FORCE_CONTRIB_* have to be
   OFF"
-  ON)
+  OFF)
 
 OPTION(DEAL_II_WITH_BLAS
   "Build deal.II with support for BLAS."
@@ -128,14 +128,14 @@ OPTION(DEAL_II_WITH_TBB
   OFF)
 OPTION(DEAL_II_FORCE_CONTRIB_TBB
   "Always use the bundled tbb library instead of an external one."
-  ON)
+  OFF)
 
 OPTION(DEAL_II_WITH_UMFPACK
   "Build deal.II with support for UMFPACK."
-  OFF)
+  ON)
 OPTION(DEAL_II_FORCE_CONTRIB_UMFPACK
   "Always use the bundled umfpack library instead of an external one."
-  ON)
+  OFF)
 
 OPTION(DEAL_II_WITH_ZLIB
   "Build deal.II with support for zlib."
index b75c63286b7108e11536750f160c1928e3dddd57..98018cf35b1ca838a2e04cd942c27b2479d68dae 100644 (file)
@@ -3,6 +3,12 @@
 #
 
 
+SET(FEATURE_UMFPACK_DEPENDS
+  DEAL_II_WITH_BLAS
+  DEAL_II_WITH_LAPACK
+  )
+
+
 MACRO(FIND_FEATURE_UMFPACK_EXTERNAL var)
 
   FIND_PACKAGE(UMFPACK)
@@ -77,25 +83,5 @@ by setting DEAL_II_ALLOW_CONTRIB=on or DEAL_II_FORCE_CONTRIB_UMFPACK=on.
 ")
 ENDMACRO()
 
-#
-# UMFPACK needs BLAS and LAPACK to be configured:
-#
-# TODO: Encapsulate this in a depend logic and migrate this check into the
-# macro
-
-IF(DEAL_II_WITH_BLAS AND DEAL_II_WITH_LAPACK)
-  CONFIGURE_FEATURE(UMFPACK)
-ELSE()
-  IF(DEAL_II_FEATURE_AUTODETECT)
-    MESSAGE(STATUS
-      "DEAL_II_WITH_UMFPACK has unmet configuration requirements: Both, DEAL_II_WITH_BLAS and DEAL_II_WITH_LAPACK have to be set."
-      )
-    SET_CACHED_OPTION(DEAL_II_WITH_UMFPACK OFF)
-  ELSE()
-    IF(DEA_II_WITH_UMFPACK)
-      MESSAGE(SEND_ERROR
-        "DEAL_II_WITH_UMFPACK has unmet configuration requirements: Both, DEAL_II_WITH_BLAS and DEAL_II_WITH_LAPACK have to be set."
-        )
-    ENDIF()
-  ENDIF()
-ENDIF()
+
+CONFIGURE_FEATURE(UMFPACK)
index 753e876e4ecc0e7c17aa40c3f4127e81811f466c..b163f125b5de1c70155d8fbf1d61d110d5e6c947 100644 (file)
@@ -7,6 +7,10 @@
 #
 # This macro assumes the following macros and variables to be defined:
 #
+# FEATURE_${feature_name}_DEPENDS (variable)
+#
+#  - A variable which contains an optional list of features this feature
+#    depends on (and which have to be enbled for this feature to work.)
 #
 # HAVE_CONTRIB_FEATURE_${feature_name}  (variable)
 #
@@ -75,91 +79,88 @@ MACRO(CONFIGURE_FEATURE feature)
   IF(DEAL_II_FEATURE_AUTODETECTION OR DEAL_II_WITH_${feature})
 
     #
-    # First case: DEAL_II_FORCE_CONTRIB_${feature} is defined:
+    # Are all dependencies fullfilled?
     #
-    IF(DEAL_II_FORCE_CONTRIB_${feature})
+    SET(macro_dependencies_ok TRUE)
 
-      IF(HAVE_CONTRIB_FEATURE_${feature})
-        RUN_COMMAND(
-          "
-          CONFIGURE_FEATURE_${feature}_CONTRIB(
-            FEATURE_${feature}_CONTRIB_CONFIGURED
-            )
-          "
-          )
-        IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+    FOREACH(macro_dependency ${FEATURE_${feature}_DEPENDS})
+      IF(NOT ${macro_dependency})
+
+        IF(DEAL_II_FEATURE_AUTODETECTION)
           MESSAGE(STATUS
-            "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+            "DEAL_II_WITH_${feature} has unmet configuration requirements: ${macro_dependency} has to be set to \"ON\"."
             )
-          IF(DEAL_II_FEATURE_AUTODETECTION)
-            SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON)
-          ENDIF()
+          SET_CACHED_OPTION(DEAL_II_WITH_${feature} OFF)
         ELSE()
-          # This should not happen. So give an error
           MESSAGE(SEND_ERROR
-            "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+            "DEAL_II_WITH_${feature} has unmet configuration requirements: ${macro_dependency} has to be set to \"ON\"."
             )
         ENDIF()
-      ELSE()
-        MESSAGE(FATAL_ERROR
-          "Internal build system error: DEAL_II_FORCE_CONTRIB_${feature} defined, but HAVE_CONTRIB_FEATURE_${feature} not present."
-          )
+
+        SET(macro_dependencies_ok FALSE)
       ENDIF()
+    ENDFOREACH()
 
-    ELSE(DEAL_II_FORCE_CONTRIB_${feature})
 
+    IF(macro_dependencies_ok)
       #
-      # Second case: We are allowed to search for an external library:
+      # First case: DEAL_II_FORCE_CONTRIB_${feature} is defined:
       #
-      RUN_COMMAND(
-        "FIND_FEATURE_${feature}_EXTERNAL(FEATURE_${feature}_EXTERNAL_FOUND)"
-        )
-
-      IF(FEATURE_${feature}_EXTERNAL_FOUND)
-
-        MESSAGE(STATUS
-          "All external dependencies for DEAL_II_WITH_${feature} are fullfilled."
-          )
-
-        RUN_COMMAND(
-          "
-          CONFIGURE_FEATURE_${feature}_EXTERNAL(
-            FEATURE_${feature}_EXTERNAL_CONFIGURED
-            )
-          "
-          )
+      IF(DEAL_II_FORCE_CONTRIB_${feature})
 
-        IF(FEATURE_${feature}_EXTERNAL_CONFIGURED)
-          MESSAGE(STATUS
-            "DEAL_II_WITH_${feature} successfully set up with external dependencies."
+        IF(HAVE_CONTRIB_FEATURE_${feature})
+          RUN_COMMAND(
+            "
+            CONFIGURE_FEATURE_${feature}_CONTRIB(
+              FEATURE_${feature}_CONTRIB_CONFIGURED
+              )
+            "
             )
-          IF(DEAL_II_FEATURE_AUTODETECTION)
-            SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON)
+          IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+            MESSAGE(STATUS
+              "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+              )
+            IF(DEAL_II_FEATURE_AUTODETECTION)
+              SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON)
+            ENDIF()
+          ELSE()
+            # This should not happen. So give an error
+            MESSAGE(SEND_ERROR
+              "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+              )
           ENDIF()
         ELSE()
-          # This should not happen. So give an error
-          MESSAGE(SEND_ERROR
-            "Failed to set up DEAL_II_WITH_${feature} with external dependencies."
+          MESSAGE(FATAL_ERROR
+            "Internal build system error: DEAL_II_FORCE_CONTRIB_${feature} defined, but HAVE_CONTRIB_FEATURE_${feature} not present."
             )
         ENDIF()
 
-      ELSE()
+      ELSE(DEAL_II_FORCE_CONTRIB_${feature})
 
-        MESSAGE(STATUS
-          "DEAL_II_WITH_${feature} has unmet external dependencies."
+        #
+        # Second case: We are allowed to search for an external library:
+        #
+        RUN_COMMAND(
+          "FIND_FEATURE_${feature}_EXTERNAL(FEATURE_${feature}_EXTERNAL_FOUND)"
           )
 
-        IF(HAVE_CONTRIB_FEATURE_${feature} AND DEAL_II_ALLOW_CONTRIB)
+        IF(FEATURE_${feature}_EXTERNAL_FOUND)
+
+          MESSAGE(STATUS
+            "All external dependencies for DEAL_II_WITH_${feature} are fullfilled."
+            )
+
           RUN_COMMAND(
             "
-            CONFIGURE_FEATURE_${feature}_CONTRIB(
-              FEATURE_${feature}_CONTRIB_CONFIGURED
+            CONFIGURE_FEATURE_${feature}_EXTERNAL(
+              FEATURE_${feature}_EXTERNAL_CONFIGURED
               )
             "
             )
-          IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+
+          IF(FEATURE_${feature}_EXTERNAL_CONFIGURED)
             MESSAGE(STATUS
-              "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+              "DEAL_II_WITH_${feature} successfully set up with external dependencies."
               )
             IF(DEAL_II_FEATURE_AUTODETECTION)
               SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON)
@@ -167,21 +168,50 @@ MACRO(CONFIGURE_FEATURE feature)
           ELSE()
             # This should not happen. So give an error
             MESSAGE(SEND_ERROR
-              "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+              "Failed to set up DEAL_II_WITH_${feature} with external dependencies."
               )
           ENDIF()
+
         ELSE()
-            IF(DEAL_II_FEATURE_AUTODETECTION)
-              SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON)
+
+          MESSAGE(STATUS
+            "DEAL_II_WITH_${feature} has unmet external dependencies."
+            )
+
+          IF(HAVE_CONTRIB_FEATURE_${feature} AND DEAL_II_ALLOW_CONTRIB)
+            RUN_COMMAND(
+              "
+              CONFIGURE_FEATURE_${feature}_CONTRIB(
+                FEATURE_${feature}_CONTRIB_CONFIGURED
+                )
+              "
+              )
+            IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+              MESSAGE(STATUS
+                "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+                )
+              IF(DEAL_II_FEATURE_AUTODETECTION)
+                SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON)
+              ENDIF()
             ELSE()
-              RUN_COMMAND(
-                "CONFIGURE_FEATURE_${feature}_ERROR_MESSAGE()"
+              # This should not happen. So give an error
+              MESSAGE(SEND_ERROR
+                "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
                 )
             ENDIF()
+          ELSE()
+              IF(DEAL_II_FEATURE_AUTODETECTION)
+                SET_CACHED_OPTION(DEAL_II_WITH_${feature} ON)
+              ELSE()
+                RUN_COMMAND(
+                  "CONFIGURE_FEATURE_${feature}_ERROR_MESSAGE()"
+                  )
+              ENDIF()
+          ENDIF()
         ENDIF()
+      ENDIF(DEAL_II_FORCE_CONTRIB_${feature})
 
-      ENDIF()
-    ENDIF(DEAL_II_FORCE_CONTRIB_${feature})
+    ENDIF()
 
   ENDIF()
 ENDMACRO()

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.