From: maier Date: Sat, 23 Mar 2013 23:57:17 +0000 (+0000) Subject: CMake: Fix a TODO in FindTBB.cmake X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddab81f443100db739d135f648d416198503174a;p=dealii-svn.git CMake: Fix a TODO in FindTBB.cmake git-svn-id: https://svn.dealii.org/trunk@29000 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index b1f5decacd..0beb2d1af0 100644 --- a/deal.II/cmake/configure/configure_1_threads.cmake +++ b/deal.II/cmake/configure/configure_1_threads.cmake @@ -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() diff --git a/deal.II/cmake/modules/FindTBB.cmake b/deal.II/cmake/modules/FindTBB.cmake index 17d9d1c894..998b80cf9a 100644 --- a/deal.II/cmake/modules/FindTBB.cmake +++ b/deal.II/cmake/modules/FindTBB.cmake @@ -15,20 +15,33 @@ # # 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() diff --git a/deal.II/doc/development/Config.sample b/deal.II/doc/development/Config.sample index c264cc5592..e683bf2389 100644 --- a/deal.II/doc/development/Config.sample +++ b/deal.II/doc/development/Config.sample @@ -409,7 +409,17 @@ # "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 "") # diff --git a/deal.II/doc/development/cmake.html b/deal.II/doc/development/cmake.html index 538a7c46fd..9f53eabdcf 100644 --- a/deal.II/doc/development/cmake.html +++ b/deal.II/doc/development/cmake.html @@ -357,6 +357,7 @@ 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)