]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Fix a TODO in FindTBB.cmake
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 23 Mar 2013 23:57:17 +0000 (23:57 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 23 Mar 2013 23:57:17 +0000 (23:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@29000 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/configure/configure_1_threads.cmake
deal.II/cmake/modules/FindTBB.cmake
deal.II/doc/development/Config.sample
deal.II/doc/development/cmake.html

index b1f5decacd7256772353ae50f83301a459ad0d17..0beb2d1af08fcf6bce09c90609e67b9e371a9cd7 100644 (file)
@@ -115,26 +115,22 @@ ENDMACRO()
 MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL)
   INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR})
 
-  IF (CMAKE_BUILD_TYPE MATCHES "Debug")
-    IF(TBB_DEBUG_FOUND)
-      LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${TBB_DEBUG_LIBRARY})
+  SPLIT_DEBUG_RELEASE(_tbb_debug _tbb_release ${TBB_LIBRARIES})
+
+  IF(CMAKE_BUILD_TYPE MATCHES "Debug")
+    IF(TBB_WITH_DEBUG_LIB)
       LIST(APPEND DEAL_II_DEFINITIONS_DEBUG
         "TBB_USE_DEBUG=1" "TBB_DO_ASSERT=1"
         )
-    ELSE()
-      MESSAGE(STATUS
-        "No debug tbb library was found. "
-        "The regular tbb lib will be used for the debug target instead."
-        )
-      LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${TBB_LIBRARY})
     ENDIF()
+
+    LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_tbb_debug})
   ENDIF()
 
-  IF (CMAKE_BUILD_TYPE MATCHES "Release")
-    LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${TBB_LIBRARY})
+  IF(CMAKE_BUILD_TYPE MATCHES "Release")
+    LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_tbb_release})
   ENDIF()
 
-  # Setup threading and if successfull return TRUE:
   SETUP_THREADING()
 ENDMACRO()
 
index 17d9d1c8941229e5b288a475e91ecf4e03fa35dc..998b80cf9ac0965aea4e0c5e7883348be9c71d61 100644 (file)
 #
 # Try to find the Threading Building Blocks library
 #
-# TODO: Obey naming convention "LIBRARIES" and "INCLUDE_DIRS"
+# This module exports
+#
+#   TBB_LIBRARIES
+#   TBB_INCLUDE_DIRS
+#   TBB_WITH_DEBUGLIB
 #
 
 INCLUDE(FindPackageHandleStandardArgs)
 
-FIND_PATH(TBB_INCLUDE_DIR tbb/parallel_reduce.h)
+SET_IF_EMPTY(TBB_DIR "$ENV{TBB_DIR}")
+
+FIND_PATH(TBB_INCLUDE_DIR tbb/parallel_reduce.h
+  HINTS
+    ${TBB_DIR}
+  PATH_SUFFIXES include include/tbb tbb)
 
 FIND_LIBRARY(TBB_LIBRARY
   NAMES tbb
+  HINTS
+    ${TBB_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
   )
 
 FIND_LIBRARY(TBB_DEBUG_LIBRARY
   NAMES tbb_debug
+  HINTS
+    ${TBB_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
   )
 
@@ -36,16 +49,23 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG
   TBB_LIBRARY
   TBB_INCLUDE_DIR
   )
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB_DEBUG DEFAULT_MSG
-  TBB_DEBUG_LIBRARY
-  TBB_INCLUDE_DIR
-  )
 
 IF(TBB_FOUND)
-  MARK_AS_ADVANCED(
-    TBB_LIBRARY
-    TBB_DEBUG_LIBRARY
-    TBB_INCLUDE_DIR
-  )
+  MARK_AS_ADVANCED(TBB_LIBRARY TBB_DEBUG_LIBRARY TBB_INCLUDE_DIR)
+
+  IF(NOT TBB_DEBUG_LIBRARY MATCHES "-NOTFOUND")
+    SET(TBB_WITH_DEBUGLIB TRUE)
+    SET(TBB_LIBRARIES debug ${TBB_LIBARY} release ${TBB_LIBRARY})
+  ELSE()
+    SET(TBB_LIBRARIES ${TBB_LIBARY})
+  ENDIF()
+
+  SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
+
+ELSE()
+
+  SET(TBB_DIR "" CACHE PATH
+    "An optional hint to a TBB installation"
+    )
 ENDIF()
 
index c264cc55924b02b87685a9d49ced5c747da111e4..e683bf23897ecabf6d54693baa55bbfd231a774d 100644 (file)
 #   "Always use the bundled tbb library instead of an external one."
 #   )
 #
-# TODO
+# Automatic setup:
+#
+# Specify a hint with CMAKE_PREFIX_PATH or by setting
+# SET(TBB_DIR "/.../..." CACHE PATH "")
+#
+# Manual setup:
+#
+# SET(TBB_FOUND TRUE CACHE BOOL "")
+# SET(TBB_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "")
+# SET(TBB_INCLUDE_DIRS "semicolon;separated;list;of;include;dirs" CACHE STRING "")
+# SET(TBB_WITH_DEBUGLIB TRUE CACHE BOOL "")
 #
 
 
index 538a7c46fd44f5affc8c155dcec171ea4eb491e2..9f53eabdcfccfc095aa4fb186e31cc6c439df02d 100644 (file)
     P4EST_DIR (and SC_DIR),
     PETSC_DIR and PETSC_ARCH (forming ${PETSC_DIR}/${PETSC_ARCH}),
     SLEPC_DIR and SLEPC_ARCH (forming ${SLEPC_DIR}/${SLEPC_ARCH}),
+    TBB_DIR,
     TRILINOS_DIR,
     UMFPACK_DIR and SUITESPARSE_DIR (AMD_DIR, CHOLMOD_DIR, COLAMD_DIR, SUITESPARSECONFIG_DIR)
            </pre>

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.