2013-03-15 02:35:15 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# Copyright 2013 Pixar
|
2013-03-15 02:35:15 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
# with the following modification; you may not use this file except in
|
|
|
|
# compliance with the Apache License and the following modification to it:
|
|
|
|
# Section 6. Trademarks. is deleted and replaced with:
|
2013-03-15 02:35:15 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
# names, trademarks, service marks, or product names of the Licensor
|
|
|
|
# and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
# the License and to reproduce the content of the NOTICE file.
|
2013-03-15 02:35:15 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# You may obtain a copy of the Apache License at
|
2013-03-15 02:35:15 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2013-07-18 21:19:50 +00:00
|
|
|
#
|
2013-09-26 19:04:57 +00:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the Apache License with the above modification is
|
|
|
|
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the Apache License for the specific
|
|
|
|
# language governing permissions and limitations under the Apache License.
|
2013-03-15 02:35:15 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# - Try to find Intel's Threading Building Blocks
|
|
|
|
# Once done this will define
|
|
|
|
#
|
|
|
|
# TBB_FOUND - System has OPENCL
|
|
|
|
# TBB_INCLUDE_DIR - The TBB include directory
|
|
|
|
# TBB_LIBRARIES - The libraries needed to use TBB
|
|
|
|
|
|
|
|
# Obtain include directory
|
|
|
|
if (WIN32)
|
|
|
|
find_path(TBB_INCLUDE_DIR
|
|
|
|
NAMES
|
|
|
|
tbb/tbb.h
|
2014-02-27 01:16:42 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${TBB_LOCATION}/include"
|
|
|
|
"$ENV{TBB_LOCATION}/include"
|
2015-03-31 22:09:14 +00:00
|
|
|
PATHS
|
2014-04-09 20:43:38 +00:00
|
|
|
"$ENV{PROGRAMFILES}/Intel/TBB/include"
|
2013-03-15 02:35:15 +00:00
|
|
|
/usr/include
|
|
|
|
DOC "The directory where TBB headers reside")
|
|
|
|
elseif (APPLE)
|
|
|
|
find_path(TBB_INCLUDE_DIR
|
|
|
|
NAMES
|
|
|
|
tbb/tbb.h
|
2014-02-27 01:16:42 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${TBB_LOCATION}/include"
|
|
|
|
"$ENV{TBB_LOCATION}/include"
|
2015-03-31 22:09:14 +00:00
|
|
|
PATHS
|
2013-03-15 02:35:15 +00:00
|
|
|
DOC "The directory where TBB headers reside")
|
|
|
|
else ()
|
|
|
|
find_path(TBB_INCLUDE_DIR
|
|
|
|
NAMES
|
|
|
|
tbb/tbb.h
|
2014-02-27 01:16:42 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${TBB_LOCATION}/include"
|
|
|
|
"$ENV{TBB_LOCATION}/include"
|
2015-03-31 22:09:14 +00:00
|
|
|
PATHS
|
2013-03-15 02:35:15 +00:00
|
|
|
/usr/include
|
|
|
|
/usr/local/include
|
|
|
|
/usr/openwin/share/include
|
|
|
|
/usr/openwin/include
|
|
|
|
DOC "The directory where TBB headers reside")
|
|
|
|
endif ()
|
|
|
|
|
2013-08-15 23:11:33 +00:00
|
|
|
set (TBB_LIB_ARCH "")
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
|
2015-05-20 06:52:51 +00:00
|
|
|
if ("${CMAKE_GENERATOR}" MATCHES "[Ww]in64")
|
2013-08-15 23:11:33 +00:00
|
|
|
set(WINPATH intel64)
|
|
|
|
else ()
|
|
|
|
set(WINPATH ia32)
|
|
|
|
endif()
|
|
|
|
|
2015-05-20 06:52:51 +00:00
|
|
|
if (MSVC80)
|
2013-08-15 23:11:33 +00:00
|
|
|
set(WINPATH "${WINPATH}/vc8")
|
|
|
|
elseif (MSVC90)
|
|
|
|
set(WINPATH "${WINPATH}/vc9")
|
|
|
|
elseif (MSVC10)
|
|
|
|
set(WINPATH "${WINPATH}/vc10")
|
|
|
|
elseif (MSVC11)
|
|
|
|
set(WINPATH "${WINPATH}/vc11")
|
2015-05-20 06:52:51 +00:00
|
|
|
elseif (MSVC12)
|
|
|
|
set(WINPATH "${WINPATH}/vc12")
|
2016-06-23 21:04:49 +00:00
|
|
|
elseif (MSVC14)
|
|
|
|
set(WINPATH "${WINPATH}/vc14")
|
2013-08-15 23:11:33 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND TBB_LIB_ARCH ${WINPATH})
|
|
|
|
|
|
|
|
elseif(ANDROID)
|
|
|
|
|
|
|
|
list(APPEND TBB_LIB_ARCH "android")
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
|
|
|
list(APPEND TBB_LIB_ARCH "intel64")
|
|
|
|
elseif(CMAKE_SIZEOF_VOID_P MATCHES "4")
|
|
|
|
list(APPEND TBB_LIB_ARCH "ia32")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-03-15 02:35:15 +00:00
|
|
|
# List library files
|
2013-08-15 23:11:33 +00:00
|
|
|
foreach(TBB_LIB tbb tbb_debug
|
2013-03-15 02:35:15 +00:00
|
|
|
tbbmalloc tbbmalloc_debug
|
|
|
|
tbbmalloc_proxy tbbmalloc_proxy_debug
|
|
|
|
tbb_preview tbb_preview_debug)
|
|
|
|
|
|
|
|
|
|
|
|
find_library(TBB_${TBB_LIB}_LIBRARY
|
|
|
|
NAMES
|
|
|
|
${TBB_LIB}
|
2014-02-27 01:16:42 +00:00
|
|
|
HINTS
|
2014-04-09 20:43:38 +00:00
|
|
|
"${TBB_LOCATION}/lib"
|
|
|
|
"${TBB_LOCATION}/bin"
|
|
|
|
"$ENV{TBB_LOCATION}/lib"
|
|
|
|
"$ENV{TBB_LOCATION}/bin"
|
|
|
|
"$ENV{PROGRAMFILES}/TBB/lib"
|
2013-03-15 02:35:15 +00:00
|
|
|
/usr/lib
|
|
|
|
/usr/lib/w32api
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/X11R6/lib
|
2013-08-15 23:11:33 +00:00
|
|
|
PATH_SUFFIXES
|
2014-04-09 20:43:38 +00:00
|
|
|
"${TBB_LIB_ARCH}"
|
|
|
|
"${TBB_LIB_ARCH}/${TBB_COMPILER}"
|
|
|
|
"${TBB_LIB_ARCH}/gcc4.4"
|
|
|
|
"${TBB_LIB_ARCH}/gcc4.1"
|
2013-08-15 23:11:33 +00:00
|
|
|
DOC "Intel's Threading Building Blocks library")
|
2013-03-15 02:35:15 +00:00
|
|
|
|
|
|
|
if (TBB_${TBB_LIB}_LIBRARY)
|
|
|
|
list(APPEND TBB_LIBRARIES ${TBB_${TBB_LIB}_LIBRARY})
|
|
|
|
endif()
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-03-15 02:35:15 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Obtain version information
|
|
|
|
if(TBB_INCLUDE_DIR)
|
|
|
|
|
|
|
|
# Tease the TBB version numbers from the lib headers
|
|
|
|
function(parseVersion FILENAME VARNAME)
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-03-15 02:35:15 +00:00
|
|
|
set(PATTERN "^#define ${VARNAME}.*$")
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-03-15 02:35:15 +00:00
|
|
|
file(STRINGS "${TBB_INCLUDE_DIR}/${FILENAME}" TMP REGEX ${PATTERN})
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-03-15 02:35:15 +00:00
|
|
|
string(REGEX MATCHALL "[0-9]+" TMP ${TMP})
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-03-15 02:35:15 +00:00
|
|
|
set(${VARNAME} ${TMP} PARENT_SCOPE)
|
2013-08-15 23:11:33 +00:00
|
|
|
|
2013-03-15 02:35:15 +00:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
if(EXISTS "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h")
|
|
|
|
parseVersion(tbb/tbb_stddef.h TBB_VERSION_MAJOR)
|
2013-08-15 23:11:33 +00:00
|
|
|
parseVersion(tbb/tbb_stddef.h TBB_VERSION_MINOR)
|
2013-03-15 02:35:15 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${TBB_VERSION_MAJOR} OR ${TBB_VERSION_MINOR})
|
|
|
|
set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
|
|
|
|
set(TBB_VERSION_STRING "${TBB_VERSION}")
|
|
|
|
mark_as_advanced(TBB_VERSION)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endif(TBB_INCLUDE_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
|
2013-08-15 23:11:33 +00:00
|
|
|
find_package_handle_standard_args(TBB
|
2013-03-15 02:35:15 +00:00
|
|
|
REQUIRED_VARS
|
|
|
|
TBB_INCLUDE_DIR
|
|
|
|
TBB_LIBRARIES
|
|
|
|
VERSION_VAR
|
|
|
|
TBB_VERSION
|
|
|
|
)
|
|
|
|
|
|
|
|
mark_as_advanced(
|
|
|
|
TBB_INCLUDE_DIR
|
|
|
|
TBB_LIBRARIES
|
|
|
|
)
|
|
|
|
|