]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Unify registration of feature configurations and provide a central
authorMatthias Maier <tamiko@kyomu.43-1.org>
Wed, 13 Nov 2013 23:48:05 +0000 (23:48 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Wed, 13 Nov 2013 23:48:05 +0000 (23:48 +0000)
possibility to filter configuration options in macro_register_feature.cmake

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

13 files changed:
deal.II/cmake/configure/configure_1_lapack.cmake
deal.II/cmake/configure/configure_1_mpi.cmake
deal.II/cmake/configure/configure_1_threads.cmake
deal.II/cmake/configure/configure_2_trilinos.cmake
deal.II/cmake/configure/configure_3_petsc.cmake
deal.II/cmake/configure/configure_boost.cmake
deal.II/cmake/configure/configure_hdf5.cmake
deal.II/cmake/configure/configure_mumps.cmake
deal.II/cmake/configure/configure_p4est.cmake
deal.II/cmake/configure/configure_slepc.cmake
deal.II/cmake/macros/macro_configure_feature.cmake
deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake [deleted file]
deal.II/cmake/macros/macro_register_feature.cmake [new file with mode: 0644]

index 65f52b38e827e04d41389d903906af501555765c..ede31c24ba7fc2445ea38b585d5ab44be565dc3a 100644 (file)
@@ -79,11 +79,8 @@ MACRO(RESET_LAPACK_FUNCTIONS_CACHE)
 ENDMACRO()
 
 
-
 MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL)
-  ADD_FLAGS(DEAL_II_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
-  DEAL_II_APPEND_LIBRARIES(${LAPACK_LIBRARIES})
-
+  REGISTER_FEATURE(LAPACK)
   CHECK_FOR_LAPACK_FUNCTIONS()
 ENDMACRO()
 
index cd92d2707cdc9af7e8ad1ac103e9c99e85ae285c..647ea4a81c96feb5520d1f13dc84531615a0fdbb 100644 (file)
@@ -143,14 +143,12 @@ ENDMACRO()
 
 
 MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL)
-  ADD_FLAGS(CMAKE_CXX_FLAGS "${MPI_CXX_COMPILE_FLAGS}")
-  ADD_FLAGS(DEAL_II_LINKER_FLAGS "${MPI_CXX_LINK_FLAGS}")
-
-  DEAL_II_APPEND_LIBRARIES(${MPI_CXX_LIBRARIES})
-  INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH})
-
+  #
   # The user has to know the location of the mpi headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${MPI_CXX_INCLUDE_PATH})
+  #
+  SET(MPI_CXX_ADD_TO_USER_INCLUDE_DIRS TRUE)
+
+  REGISTER_FEATURE(MPI_CXX)
 ENDMACRO()
 
 
index 52e16e0ab8cd0143f9259c94a3a0871864422552..bd75aae705ea6d60e3c7bdb433c807fa5430e94a 100644 (file)
@@ -151,9 +151,8 @@ ENDMACRO()
 
 
 MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL)
-  INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
 
-  DEAL_II_APPEND_LIBRARIES(${TBB_LIBRARIES})
+  REGISTER_FEATURE(TBB)
 
   IF(CMAKE_BUILD_TYPE MATCHES "Debug")
     IF(TBB_WITH_DEBUG_LIB)
@@ -161,7 +160,6 @@ MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL)
         "TBB_USE_DEBUG=1" "TBB_DO_ASSERT=1"
         )
     ENDIF()
-
   ENDIF()
 
   #
index 66930730424c59362620e07fca179cd0407fc7d9..0060efb50b07196606c83fddc4faff52554f4425 100644 (file)
@@ -195,12 +195,8 @@ ENDMACRO()
 
 MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL)
 
-  INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIRS})
-
-  # The user has to know the location of the trilinos headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${TRILINOS_INCLUDE_DIRS})
-
-  DEAL_II_APPEND_LIBRARIES(${TRILINOS_LIBRARIES})
+  SET(TRILINOS_ADD_TO_USER_INCLUDE_DIRS TRUE)
+  REGISTER_FEATURE(TRILINOS)
 
   SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::Vector")
   SET(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR "TrilinosWrappers::BlockVector")
index c1c71a4a83050e62cec88ef3b9ac532c7c5b8304..3627e7c49c1f239b06458fd01c36bb0aa99459e2 100644 (file)
@@ -114,10 +114,8 @@ ENDMACRO()
 MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL)
   INCLUDE_DIRECTORIES(${PETSC_INCLUDE_DIRS})
 
-  # The user has to know the location of the petsc headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${PETSC_INCLUDE_DIRS})
-
-  DEAL_II_APPEND_LIBRARIES(${PETSC_LIBRARIES})
+  SET(PETSC_ADD_TO_USER_INCLUDE_DIRS TRUE)
+  REGISTER_FEATURE(PETSC)
 
   #
   # Disable a bunch of warnings when compiling with petsc:
index b6ed7c3b2c825145d13c486eab977e4ed31e5900..9571fe9b0e31b97380d38112f42e447936a66de7 100644 (file)
@@ -74,21 +74,33 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var)
 
   MARK_AS_ADVANCED(Boost_DIR)
 
-  SET(BOOST_VERSION_MAJOR "${Boost_MAJOR_VERSION}")
-  SET(BOOST_VERSION_MINOR "${Boost_MINOR_VERSION}")
-  SET(BOOST_VERSION_SUBMINOR "${Boost_SUBMINOR_VERSION}")
-  SET(BOOST_VERSION
-    "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}"
-    )
-
 
   IF( Boost_SERIALIZATION_FOUND AND
       Boost_SYSTEM_FOUND AND
-      (NOT DEAL_II_WITH_THREADS OR Boost_THREAD_FOUND)
-    )
+      (NOT DEAL_II_WITH_THREADS OR Boost_THREAD_FOUND) )
+
+    SET(BOOST_VERSION_MAJOR "${Boost_MAJOR_VERSION}")
+    SET(BOOST_VERSION_MINOR "${Boost_MINOR_VERSION}")
+    SET(BOOST_VERSION_SUBMINOR "${Boost_SUBMINOR_VERSION}")
+    SET(BOOST_VERSION
+      "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}"
+      )
+
+    #
+    # Remove "pthread" from Boost_LIBRARIES. Threading, if necessary, is
+    # already set up via configure_1_threads.cmake.
+    #
+    LIST(REMOVE_ITEM Boost_LIBRARIES "pthread")
+
+    SET(BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
+    SET(BOOST_LIBRARIES ${Boost_LIBRARIES})
+
     MARK_AS_ADVANCED(BOOST_DIR)
+
     SET(${var} TRUE)
+
   ELSE()
+
     SET(BOOST_DIR "" CACHE PATH
       "An optional hint to a boost directory"
       )
@@ -96,21 +108,10 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var)
 ENDMACRO()
 
 
-MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL)
-  INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIRS})
-
-  # The user has to know the location of the boost headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
-
-  #
-  # Remove "pthread" from Boost_LIBRARIES. Threading, if necessary, is
-  # already set up via configure_1_threads.cmake.
-  #
-  LIST(REMOVE_ITEM Boost_LIBRARIES "pthread")
-
-  DEAL_II_APPEND_LIBRARIES(${Boost_LIBRARIES})
-
-ENDMACRO()
+#
+# The user has to know the location of the boost headers as well:
+#
+SET(BOOST_ADD_TO_USER_INCLUDE_DIRS TRUE)
 
 
 MACRO(FEATURE_BOOST_CONFIGURE_BUNDLED)
index a5a40a255ae712df9fb9b7fadb50546c11be589b..81e71ceffa7bf9b83ce5166fd3c8abbe3c5288a7 100644 (file)
@@ -47,14 +47,10 @@ MACRO(FEATURE_HDF5_FIND_EXTERNAL var)
 ENDMACRO()
 
 
-MACRO(FEATURE_HDF5_CONFIGURE_EXTERNAL)
-  INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
-
-  # The user has to know the location of the HDF5 headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS})
-
-  DEAL_II_APPEND_LIBRARIES(${HDF5_LIBRARIES})
-ENDMACRO()
+#
+# The user has to know the location of the hdf5 headers as well:
+#
+SET(HDF5_ADD_TO_USER_INCLUDE_DIRS TRUE)
 
 
 CONFIGURE_FEATURE(HDF5)
index 0739098602b54007e33dd76d6d314d46cf8be00c..4022f98026856d9e501ce4a5827f408042cfec91 100644 (file)
 
 SET(FEATURE_MUMPS_DEPENDS DEAL_II_WITH_MPI DEAL_II_WITH_LAPACK)
 
-MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL)
-  INCLUDE_DIRECTORIES(${MUMPS_INCLUDE_DIRS})
 
-  # The user has to know the location of the MUMPS headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${MUMPS_INCLUDE_DIRS})
+#
+# The user has to know the location of the MUMPS headers as well:
+#
+SET(MUMPS_ADD_TO_USER_INCLUDE_DIRS TRUE)
 
-  DEAL_II_APPEND_LIBRARIES(${MUMPS_LIBRARIES})
-ENDMACRO()
 
 CONFIGURE_FEATURE(MUMPS)
index de91ef6ea130537543702992bcbb69bf2c88aa20..4055c0f30cf494a5ca73e930b73fbec2fac8a737 100644 (file)
@@ -75,13 +75,10 @@ MACRO(FEATURE_P4EST_FIND_EXTERNAL var)
 ENDMACRO()
 
 
-MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL)
-  INCLUDE_DIRECTORIES(${P4EST_INCLUDE_DIRS})
-
-  # The user has to know the location of the P4EST headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${P4EST_INCLUDE_DIRS})
+#
+# The user has to know the location of the P4est headers as well:
+#
+SET(P4EST_ADD_TO_USER_INCLUDE_DIRS TRUE)
 
-  DEAL_II_APPEND_LIBRARIES(${P4EST_LIBRARIES})
-ENDMACRO()
 
 CONFIGURE_FEATURE(P4EST)
index bf5415a0ff1deaac7af641df706736bc08b89de0..fdb87649d01d34fe8a763dd928739d71e41df61c 100644 (file)
@@ -57,14 +57,11 @@ MACRO(FEATURE_SLEPC_FIND_EXTERNAL var)
   ENDIF()
 ENDMACRO()
 
-MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL)
-  INCLUDE_DIRECTORIES(${SLEPC_INCLUDE_DIRS})
 
-  # The user has to know the location of the SLEPC headers as well:
-  LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${SLEPC_INCLUDE_DIRS})
-
-  DEAL_II_APPEND_LIBRARIES(${SLEPC_LIBRARIES})
-ENDMACRO()
+#
+# The user has to know the location of the SLEPC headers as well:
+#
+SET(SLEPC_ADD_TO_USER_INCLUDE_DIRS TRUE)
 
 
 MACRO(FEATURE_SLEPC_ERROR_MESSAGE)
index 0ffbf4fb10481bbfaadd20c92dcd677187e1583f..4a35b260fddb5de54815f708823302294f3b88a7 100644 (file)
@@ -134,22 +134,6 @@ MACRO(FEATURE_FIND_EXTERNAL _feature _var)
 ENDMACRO()
 
 
-#
-# Default macro for basic external setup:
-#
-MACRO(FEATURE_CONFIGURE_EXTERNAL _feature)
-  IF(DEFINED ${_feature}_INCLUDE_DIRS)
-    INCLUDE_DIRECTORIES(${${_feature}_INCLUDE_DIRS})
-  ENDIF()
-  IF(DEFINED ${_feature}_LIBRARIES)
-    DEAL_II_APPEND_LIBRARIES(${${_feature}_LIBRARIES})
-  ENDIF()
-  IF(DEFINED ${_feature}_LINKER_FLAGS)
-    ADD_FLAGS(DEAL_II_LINKER_FLAGS "${${_feature}_LINKER_FLAGS}")
-  ENDIF()
-ENDMACRO()
-
-
 ########################################################################
 #                                                                      #
 #                          CONFIGURE_FEATURE:                          #
@@ -249,7 +233,7 @@ MACRO(CONFIGURE_FEATURE _feature)
           IF(COMMAND FEATURE_${_feature}_CONFIGURE_EXTERNAL)
             RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_EXTERNAL()")
           ELSE()
-            FEATURE_CONFIGURE_EXTERNAL(${_feature})
+            REGISTER_FEATURE(${_feature})
           ENDIF()
 
           MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with external dependencies.")
diff --git a/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake b/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake
deleted file mode 100644 (file)
index de291d3..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-## ---------------------------------------------------------------------
-## $Id$
-##
-## Copyright (C) 2013 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.
-##
-## ---------------------------------------------------------------------
-
-#
-# A small macro to add libraries to
-#   DEAL_II_EXTERNAL_LIBRARIES
-#   DEAL_II_EXTERNAL_LIBRARIES_DEBUG
-#   DEAL_II_EXTERNAL_LIBRARIES_RELEASE
-# depending on the "optmized", "debug" or "general" keyword
-#
-# Usage:
-#   DEAL_II_APPEND_LIBRARIES(<list of libraries>)
-#
-
-MACRO(DEAL_II_APPEND_LIBRARIES)
-
-  SET(_toggle "general")
-  FOREACH(_tmp ${ARGN})
-    IF( "${_tmp}" STREQUAL "debug" OR
-        "${_tmp}" STREQUAL "optimized" OR
-        "${_tmp}" STREQUAL "general" )
-      SET(_toggle "${_tmp}")
-    ELSE()
-      IF("${_toggle}" STREQUAL "general")
-        LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${_tmp})
-      ELSEIF("${_toggle}" STREQUAL "debug")
-        LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_tmp})
-      ELSEIF("${_toggle}" STREQUAL "optimized")
-        LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_tmp})
-      ENDIF()
-    ENDIF()
-  ENDFOREACH()
-
-ENDMACRO()
diff --git a/deal.II/cmake/macros/macro_register_feature.cmake b/deal.II/cmake/macros/macro_register_feature.cmake
new file mode 100644 (file)
index 0000000..a4408fe
--- /dev/null
@@ -0,0 +1,99 @@
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2013 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.
+##
+## ---------------------------------------------------------------------
+
+#
+# This macro is used for the feature configuration in deal.II
+#
+# Usage:
+#     REGISTER_FEATURE(feature)
+#
+# This macro will
+#
+#   - add ${feature}_INCLUDE_DIRS and ${feature}_INCLUDE_PATH
+#     to the list of (internal) include
+#     directories
+#   - and if ${feature}_ADD_TO_USER_INCLUDE_DIRS is defined also to
+#     DEAL_II_USER_INCLUDE_DIRS
+#
+#   - add ${feature}_LINKER_FLAGS and ${feature}_LINK_FLAGS to
+#     DEAL_II_LINKER_FLAGS
+#
+#   - add ${feature}_CXX_FLAGS and ${feature}_COMPILE_FLAGS to
+#     CMAKE_CXX_FLAGS
+#
+#   - add ${feature}_LIBRARIES to the list of deal.II libraries depending
+#     on general, optimized or debug keyword
+#
+
+
+MACRO(REGISTER_FEATURE _feature)
+  MESSAGE(STATUS "Register enabled external feature ${_feature}:")
+
+  # variables for include directories:
+  FOREACH(_var ${_feature}_INCLUDE_DIRS ${_feature}_INCLUDE_PATH)
+    IF(DEFINED ${_var})
+      MESSAGE(STATUS "  ${_var}")
+      INCLUDE_DIRECTORIES(${${_var}})
+      IF(${_feature}_ADD_TO_USER_INCLUDE_DIRS)
+        LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${${_var}})
+      ENDIF()
+    ENDIF()
+  ENDFOREACH()
+
+  # variables for linker flags:
+  FOREACH(_var ${_feature}_LINKER_FLAGS ${_feature}_LINK_FLAGS)
+    IF(DEFINED ${_var})
+      MESSAGE(STATUS "  ${_var}")
+      ADD_FLAGS(DEAL_II_LINKER_FLAGS "${${_var}}")
+    ENDIF()
+  ENDFOREACH()
+
+  # variables for compiler flags:
+  FOREACH(_var ${_feature}_CXX_FLAGS ${_feature}_COMPILE_FLAGS)
+    IF(DEFINED ${_var})
+      MESSAGE(STATUS "  ${_var}")
+      ADD_FLAGS(CMAKE_CXX_FLAGS "${${_var}}")
+    ENDIF()
+  ENDFOREACH()
+
+  IF(DEFINED ${_feature}_LIBRARIES)
+    MESSAGE(STATUS "  ${_feature}_LIBRARIES")
+    #
+    # Add ${_feature}_LIBRARIES to
+    #   DEAL_II_EXTERNAL_LIBRARIES
+    #   DEAL_II_EXTERNAL_LIBRARIES_DEBUG
+    #   DEAL_II_EXTERNAL_LIBRARIES_RELEASE
+    # depending on the "optmized", "debug" or "general" keyword
+    #
+    SET(_toggle "general")
+    FOREACH(_tmp ${${_feature}_LIBRARIES})
+      IF( "${_tmp}" STREQUAL "debug" OR
+          "${_tmp}" STREQUAL "optimized" OR
+          "${_tmp}" STREQUAL "general" )
+        SET(_toggle "${_tmp}")
+      ELSE()
+        IF("${_toggle}" STREQUAL "general")
+          LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${_tmp})
+        ELSEIF("${_toggle}" STREQUAL "debug")
+          LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_tmp})
+        ELSEIF("${_toggle}" STREQUAL "optimized")
+          LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_tmp})
+        ENDIF()
+      ENDIF()
+    ENDFOREACH()
+  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.