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()
#
# 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
)
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()
# "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 "")
#
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>