# Find TBB # # This module defines # TBB_FOUND # TBB_LIBRARIES # # Copyright (c) 2012 I-maginer # # This program is free software; you can 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 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA, or go to # http://www.gnu.org/copyleft/lesser.txt # # On a new cmake run, we do not need to be verbose IF(TBB_INCLUDE_DIR AND TBB_LIBRARY) SET(TBB_FIND_QUIETLY TRUE) ENDIF() if( MSVC ) # in order to prevent DLL hell, each of the DLLs have to be suffixed with the major version and msvc prefix if( MSVC70 OR MSVC71 ) set(MSVC_PREFIX "vc70") elseif( MSVC80 ) set(MSVC_PREFIX "vc80") elseif( MSVC90 ) set(MSVC_PREFIX "vc90") elseif( MSVC10 ) set(MSVC_PREFIX "vc10") elseif( MSVC11 ) set(MSVC_PREFIX "vc11") elseif( MSVC12 ) set(MSVC_PREFIX "vc12") else() set(MSVC_PREFIX "vc13") endif() set(TBB_FOLDER_SUFFIX ${MSVC_PREFIX} CACHE STRING "the suffix for the assimp windows library" FORCE) else() set(TBB_FOLDER_SUFFIX "" CACHE STRING "the suffix for the assimp library" FORCE) endif() # If TBB_ROOT was defined in the environment, use it. if (NOT TBB_ROOT) if(NOT "$ENV{TBB_ROOT}" STREQUAL "") set(TBB_ROOT $ENV{TBB_ROOT}) else() if(ANDROID) set(TBB_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/OpenCV/SDK/android/${ANDROID_ABI} CACHE PATH "TBB SDK path" FORCE) elseif(WIN32) set(TBB_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/OpenCV/SDK/windows/x86/x86/${TBB_FOLDER_SUFFIX} CACHE PATH "TBB SDK path" FORCE) elseif(WIN32 AND (WIN64 OR (CMAKE_SIZEOF_VOID_P EQUAL 8))) set(TBB_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/OpenCV/SDK/windows/x64 CACHE PATH "TBB SDK path" FORCE) elseif(APPLE AND NOT APPLE_IOS) set(TBB_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/OpenCV/SDK/apple/OSX CACHE PATH "TBB SDK path" FORCE) elseif(APPLE AND APPLE_IOS) set(TBB_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/OpenCV/SDK/apple/IOS CACHE PATH "TBB SDK path" FORCE) else() set(TBB_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/OpenCV/SDK CACHE PATH "TBB SDK path" FORCE) endif() endif() endif() MARK_AS_ADVANCED( TBB_FOLDER_SUFFIX ) # concat all the search paths IF(TBB_ROOT) SET(TBB_LIBRARY_SEARCH_RELEASE_DIRS ${TBB_LIBRARY_SEARCH_DIRS} ${TBB_ROOT}/lib ${TBB_ROOT}/staticlib ${TBB_ROOT}/sdk/native/3rdparty/libs/${ANDROID_ABI} ) SET(TBB_LIBRARY_SEARCH_DEBUG_DIRS ${TBB_LIBRARY_SEARCH_DIRS} ${TBB_ROOT}/lib ${TBB_ROOT}/staticlib ${TBB_ROOT}/sdk/native/3rdparty/libs/${ANDROID_ABI} ) ENDIF() # log message IF (NOT TBB_FIND_QUIETLY) MESSAGE(STATUS "Checking for TBB library") ENDIF() # Search for libraries files (release mode) FIND_LIBRARY(TBB_LIBRARY_RELEASE tbb libtbb PATHS ${TBB_LIBRARY_SEARCH_RELEASE_DIRS}) # Search for libraries files (debug mode) FIND_LIBRARY(TBB_LIBRARY_DEBUG tbb_debug tbb libtbb PATHS ${TBB_LIBRARY_SEARCH_DEBUG_DIRS}) # Configure libraries for debug/release SET(TBB_LIBRARY debug ${TBB_LIBRARY_DEBUG} optimized ${TBB_LIBRARY_RELEASE}) SET(TBB_LIBRARIES ${TBB_LIBRARY} CACHE STRING "TBB libraries files") IF(TBB_LIBRARY) SET(TBB_FOUND TRUE) ENDIF() # Hide those variables in GUI SET(TBB_LIBRARY_RELEASE ${TBB_LIBRARY_RELEASE} CACHE INTERNAL "") SET(TBB_LIBRARY_DEBUG ${TBB_LIBRARY_DEBUG} CACHE INTERNAL "") SET(TBB_LIBRARY ${TBB_LIBRARY} CACHE INTERNAL "") # log find result IF(TBB_FOUND) IF(NOT TBB_FIND_QUIETLY) MESSAGE(STATUS " libraries: ${TBB_LIBRARIES}") ENDIF() ELSE(TBB_FOUND) IF(NOT TBB_LIBRARIES) MESSAGE(STATUS, "TBB library or one of it dependencies could not be found.") ENDIF() IF(NOT TBB_INCLUDE_DIRS) MESSAGE(STATUS "TBB include files could not be found.") ENDIF() ENDIF(TBB_FOUND)