fix for new TBB version
This commit is contained in:
parent
d32036e863
commit
de540f7b9f
|
@ -1,283 +1,468 @@
|
||||||
# Locate Intel Threading Building Blocks include paths and libraries
|
# - Find ThreadingBuildingBlocks include dirs and libraries
|
||||||
# FindTBB.cmake can be found at https://code.google.com/p/findtbb/
|
# Use this module by invoking find_package with the form:
|
||||||
# Written by Hannes Hofmann <hannes.hofmann _at_ informatik.uni-erlangen.de>
|
# find_package(TBB
|
||||||
# Improvements by Gino van den Bergen <gino _at_ dtecta.com>,
|
# [REQUIRED] # Fail with error if TBB is not found
|
||||||
# Florian Uhlig <F.Uhlig _at_ gsi.de>,
|
# ) #
|
||||||
# Jiri Marsik <jiri.marsik89 _at_ gmail.com>
|
# Once done, this will define
|
||||||
|
|
||||||
# The MIT License
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Hannes Hofmann
|
# TBB_FOUND - system has TBB
|
||||||
|
# TBB_INCLUDE_DIRS - the TBB include directories
|
||||||
|
# TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
|
||||||
|
# malloc proxy
|
||||||
|
# TBB::tbb - imported target for the TBB library
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# TBB_VERSION_MAJOR - Major Product Version Number
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# TBB_VERSION_MINOR - Minor Product Version Number
|
||||||
# in the Software without restriction, including without limitation the rights
|
# TBB_INTERFACE_VERSION - Engineering Focused Version Number
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
# TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
# still supported. This uses the engineering
|
||||||
# furnished to do so, subject to the following conditions:
|
# focused interface version numbers.
|
||||||
#
|
#
|
||||||
# The above copyright notice and this permission notice shall be included in
|
# TBB_MALLOC_FOUND - system has TBB malloc library
|
||||||
# all copies or substantial portions of the Software.
|
# TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
|
||||||
|
# TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
|
||||||
|
# TBB::malloc - imported target for the TBB malloc library
|
||||||
#
|
#
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
# TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
# TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
# TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
# TBB::malloc_proxy - imported target for the TBB malloc proxy library
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
|
|
||||||
# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
|
|
||||||
# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
|
|
||||||
# in the TBB installation directory (TBB_INSTALL_DIR).
|
|
||||||
#
|
#
|
||||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
|
||||||
#
|
#
|
||||||
# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
|
# This module reads hints about search locations from variables:
|
||||||
# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
|
# ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds
|
||||||
# which architecture to use
|
# ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation
|
||||||
# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
|
# ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb
|
||||||
# which compiler to use (detected automatically on Windows)
|
# libraries. Should be specified with ENV TBB_ROOT
|
||||||
|
# and optionally...
|
||||||
|
# ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Modified by Robert Maynard from the original OGRE source
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
# This file is part of the CMake build system for OGRE
|
||||||
|
# (Object-oriented Graphics Rendering Engine)
|
||||||
|
# For the latest info, see http://www.ogre3d.org/
|
||||||
|
#
|
||||||
|
# The contents of this file are placed in the public domain. Feel
|
||||||
|
# free to make use of it in any way you like.
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# =========================================================================
|
||||||
|
# Taken from Copyright.txt in the root of the VTK source tree as per
|
||||||
|
# instructions to substitute the full license in place of the summary
|
||||||
|
# reference when distributing outside of VTK
|
||||||
|
# =========================================================================
|
||||||
|
#
|
||||||
|
# Program: Visualization Toolkit
|
||||||
|
# Module: Copyright.txt
|
||||||
|
#
|
||||||
|
# Copyright (c) 1993-2015 Ken Martin, Will Schroeder, Bill Lorensen
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
|
||||||
|
# of any contributors may be used to endorse or promote products derived
|
||||||
|
# from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# =========================================================================*/
|
||||||
|
|
||||||
# This module respects
|
#=============================================================================
|
||||||
# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
|
# FindTBB helper functions and macros
|
||||||
|
#
|
||||||
|
|
||||||
# This module defines
|
#====================================================
|
||||||
# TBB_INCLUDE_DIRS, where to find tbb_stddef.h, etc.
|
# Fix the library path in case it is a linker script
|
||||||
# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
|
#====================================================
|
||||||
# TBB_DEBUG_LIBRARY_DIRS, where to find libtbb_debug, libtbbmalloc_debug
|
function(tbb_extract_real_library library real_library)
|
||||||
# TBB_INSTALL_DIR, the base TBB install directory
|
if(NOT UNIX OR NOT EXISTS ${library})
|
||||||
# TBB_LIBRARIES, the libraries to link against to use TBB.
|
set(${real_library} "${library}" PARENT_SCOPE)
|
||||||
# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
|
return()
|
||||||
# TBB_FOUND, If false, don't try to use TBB.
|
endif()
|
||||||
# TBB_INTERFACE_VERSION, as defined in tbb/tbb_stddef.h
|
|
||||||
|
#Read in the first 4 bytes and see if they are the ELF magic number
|
||||||
|
set(_elf_magic "7f454c46")
|
||||||
|
file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX)
|
||||||
|
if(_hex_data STREQUAL _elf_magic)
|
||||||
|
#we have opened a elf binary so this is what
|
||||||
|
#we should link to
|
||||||
|
set(${real_library} "${library}" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ ${library} _data OFFSET 0 LIMIT 1024)
|
||||||
|
if("${_data}" MATCHES "INPUT \\(([^(]+)\\)")
|
||||||
|
#extract out the .so name from REGEX MATCH command
|
||||||
|
set(_proper_so_name "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
#construct path to the real .so which is presumed to be in the same directory
|
||||||
|
#as the input file
|
||||||
|
get_filename_component(_so_dir "${library}" DIRECTORY)
|
||||||
|
set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
#unable to determine what this library is so just hope everything works
|
||||||
|
#and pass it unmodified.
|
||||||
|
set(${real_library} "${library}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# Do the final processing for the package find.
|
||||||
|
#===============================================
|
||||||
|
macro(findpkg_finish PREFIX TARGET_NAME)
|
||||||
|
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
|
||||||
|
set(${PREFIX}_FOUND TRUE)
|
||||||
|
set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
|
||||||
|
set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
|
||||||
|
else ()
|
||||||
|
if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
|
||||||
|
message(FATAL_ERROR "Required library ${PREFIX} not found.")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT TARGET "TBB::${TARGET_NAME}")
|
||||||
|
if (${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release)
|
||||||
|
endif ()
|
||||||
|
if (${PREFIX}_LIBRARY_DEBUG)
|
||||||
|
tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug)
|
||||||
|
endif ()
|
||||||
|
add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}")
|
||||||
|
if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${real_release}"
|
||||||
|
IMPORTED_LOCATION_DEBUG "${real_debug}"
|
||||||
|
IMPORTED_LOCATION_RELEASE "${real_release}")
|
||||||
|
elseif (${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${real_release}")
|
||||||
|
elseif (${PREFIX}_LIBRARY_DEBUG)
|
||||||
|
set_target_properties(TBB::${TARGET_NAME} PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${real_debug}")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
#mark the following variables as internal variables
|
||||||
|
mark_as_advanced(${PREFIX}_INCLUDE_DIR
|
||||||
|
${PREFIX}_LIBRARY
|
||||||
|
${PREFIX}_LIBRARY_DEBUG
|
||||||
|
${PREFIX}_LIBRARY_RELEASE)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# Generate debug names from given release names
|
||||||
|
#===============================================
|
||||||
|
macro(get_debug_names PREFIX)
|
||||||
|
foreach(i ${${PREFIX}})
|
||||||
|
set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# See if we have env vars to help us find tbb
|
||||||
|
#===============================================
|
||||||
|
macro(getenv_path VAR)
|
||||||
|
set(ENV_${VAR} $ENV{${VAR}})
|
||||||
|
# replace won't work if var is blank
|
||||||
|
if (ENV_${VAR})
|
||||||
|
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
|
||||||
|
endif ()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# Couple a set of release AND debug libraries
|
||||||
|
#===============================================
|
||||||
|
macro(make_library_set PREFIX)
|
||||||
|
if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
|
||||||
|
set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
|
||||||
|
elseif (${PREFIX}_RELEASE)
|
||||||
|
set(${PREFIX} ${${PREFIX}_RELEASE})
|
||||||
|
elseif (${PREFIX}_DEBUG)
|
||||||
|
set(${PREFIX} ${${PREFIX}_DEBUG})
|
||||||
|
endif ()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#===============================================
|
||||||
|
# Ensure that the release & debug libraries found are from the same installation.
|
||||||
|
#===============================================
|
||||||
|
macro(find_tbb_library_verifying_release_debug_locations PREFIX)
|
||||||
|
find_library(${PREFIX}_RELEASE
|
||||||
|
NAMES ${${PREFIX}_NAMES}
|
||||||
|
HINTS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
if (${PREFIX}_RELEASE)
|
||||||
|
# To avoid finding a mismatched set of release & debug libraries from
|
||||||
|
# different installations if the first found does not have debug libraries
|
||||||
|
# by forcing the search for debug to only occur within the detected release
|
||||||
|
# library directory (if found). Although this would break detection if the
|
||||||
|
# release & debug libraries were shipped in different directories, this is
|
||||||
|
# not the case in the official TBB releases for any platform.
|
||||||
|
get_filename_component(
|
||||||
|
FOUND_RELEASE_LIB_DIR "${${PREFIX}_RELEASE}" DIRECTORY)
|
||||||
|
find_library(${PREFIX}_DEBUG
|
||||||
|
NAMES ${${PREFIX}_NAMES_DEBUG}
|
||||||
|
HINTS ${FOUND_RELEASE_LIB_DIR}
|
||||||
|
NO_DEFAULT_PATH)
|
||||||
|
else()
|
||||||
|
find_library(${PREFIX}_DEBUG
|
||||||
|
NAMES ${${PREFIX}_NAMES_DEBUG}
|
||||||
|
HINTS ${TBB_LIB_SEARCH_PATH})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Now to actually find TBB
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get path, convert backslashes as ${ENV_${var}}
|
||||||
|
getenv_path(TBB_ROOT)
|
||||||
|
|
||||||
|
# initialize search paths
|
||||||
|
set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
|
||||||
|
set(TBB_INC_SEARCH_PATH "")
|
||||||
|
set(TBB_LIB_SEARCH_PATH "")
|
||||||
|
|
||||||
|
|
||||||
if (WIN32)
|
# If user built from sources
|
||||||
# has em64t/vc8 em64t/vc9
|
set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})
|
||||||
# has ia32/vc7.1 ia32/vc8 ia32/vc9
|
if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
|
getenv_path(TBB_BUILD_DIR)
|
||||||
set(_TBB_LIB_NAME "tbb")
|
if (NOT ENV_TBB_BUILD_DIR)
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build)
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
endif ()
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
if (MSVC71)
|
|
||||||
set (_TBB_COMPILER "vc7.1")
|
|
||||||
endif(MSVC71)
|
|
||||||
if (MSVC80)
|
|
||||||
set(_TBB_COMPILER "vc8")
|
|
||||||
endif(MSVC80)
|
|
||||||
if (MSVC90)
|
|
||||||
set(_TBB_COMPILER "vc9")
|
|
||||||
endif(MSVC90)
|
|
||||||
if(MSVC10)
|
|
||||||
set(_TBB_COMPILER "vc10")
|
|
||||||
endif(MSVC10)
|
|
||||||
# Todo: add other Windows compilers such as ICL.
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif (WIN32)
|
|
||||||
|
|
||||||
if (UNIX)
|
# include directory under ${ENV_TBB_ROOT}/include
|
||||||
if (APPLE)
|
list(APPEND TBB_LIB_SEARCH_PATH
|
||||||
# MAC
|
${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
|
${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug)
|
||||||
# libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
|
endif ()
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
# default flavor on apple: ia32/cc4.0.1_os10.4.9
|
|
||||||
# Jiri: There is no reason to presume there is only one flavor and
|
|
||||||
# that user's setting of variables should be ignored.
|
|
||||||
if(NOT TBB_COMPILER)
|
|
||||||
set(_TBB_COMPILER "cc4.0.1_os10.4.9")
|
|
||||||
elseif (NOT TBB_COMPILER)
|
|
||||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
|
||||||
endif(NOT TBB_COMPILER)
|
|
||||||
if(NOT TBB_ARCHITECTURE)
|
|
||||||
set(_TBB_ARCHITECTURE "ia32")
|
|
||||||
elseif(NOT TBB_ARCHITECTURE)
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif(NOT TBB_ARCHITECTURE)
|
|
||||||
else (APPLE)
|
|
||||||
# LINUX
|
|
||||||
set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
|
|
||||||
set(_TBB_LIB_NAME "tbb")
|
|
||||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|
||||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
|
||||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
|
||||||
# has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
|
|
||||||
# has ia32/*
|
|
||||||
# has itanium/*
|
|
||||||
set(_TBB_COMPILER ${TBB_COMPILER})
|
|
||||||
set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
|
|
||||||
endif (APPLE)
|
|
||||||
endif (UNIX)
|
|
||||||
|
|
||||||
if (CMAKE_SYSTEM MATCHES "SunOS.*")
|
|
||||||
# SUN
|
|
||||||
# not yet supported
|
|
||||||
# has em64t/cc3.4.3_kernel5.10
|
|
||||||
# has ia32/*
|
|
||||||
endif (CMAKE_SYSTEM MATCHES "SunOS.*")
|
|
||||||
|
|
||||||
|
|
||||||
#-- Clear the public variables
|
# For Windows, let's assume that the user might be using the precompiled
|
||||||
set (TBB_FOUND "NO")
|
# TBB packages from the main website. These use a rather awkward directory
|
||||||
|
# structure (at least for automatically finding the right files) depending
|
||||||
|
# on platform and compiler, but we'll do our best to accommodate it.
|
||||||
|
# Not adding the same effort for the precompiled linux builds, though. Those
|
||||||
|
# have different versions for CC compiler versions and linux kernels which
|
||||||
|
# will never adequately match the user's setup, so there is no feasible way
|
||||||
|
# to detect the "best" version to use. The user will have to manually
|
||||||
|
# select the right files. (Chances are the distributions are shipping their
|
||||||
|
# custom version of tbb, anyway, so the problem is probably nonexistent.)
|
||||||
|
if (WIN32 AND MSVC)
|
||||||
|
set(COMPILER_PREFIX "vc7.1")
|
||||||
|
if (MSVC_VERSION EQUAL 1400)
|
||||||
|
set(COMPILER_PREFIX "vc8")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1500)
|
||||||
|
set(COMPILER_PREFIX "vc9")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1600)
|
||||||
|
set(COMPILER_PREFIX "vc10")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1700)
|
||||||
|
set(COMPILER_PREFIX "vc11")
|
||||||
|
elseif(MSVC_VERSION EQUAL 1800)
|
||||||
|
set(COMPILER_PREFIX "vc12")
|
||||||
|
elseif(MSVC_VERSION GREATER_EQUAL 1900)
|
||||||
|
set(COMPILER_PREFIX "vc14")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
if (CMAKE_CL_64)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
|
||||||
|
else ()
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
|
# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
|
||||||
# first: use CMake variable TBB_INSTALL_DIR
|
# and above and AppleClang
|
||||||
if (TBB_INSTALL_DIR)
|
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
|
||||||
set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
|
NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
|
||||||
endif (TBB_INSTALL_DIR)
|
set (USE_LIBCXX OFF)
|
||||||
# second: use environment variable
|
cmake_policy(GET CMP0025 POLICY_VAR)
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
|
|
||||||
# Intel recommends setting TBB21_INSTALL_DIR
|
|
||||||
if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
|
|
||||||
if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "")
|
|
||||||
if (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
|
||||||
set (_TBB_INSTALL_DIR $ENV{TBB30_INSTALL_DIR})
|
|
||||||
endif (NOT "$ENV{TBB30_INSTALL_DIR}" STREQUAL "")
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
# third: try to find path automatically
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
if (_TBB_DEFAULT_INSTALL_DIR)
|
|
||||||
set (_TBB_INSTALL_DIR ${_TBB_DEFAULT_INSTALL_DIR})
|
|
||||||
endif (_TBB_DEFAULT_INSTALL_DIR)
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
|
||||||
# sanity check
|
|
||||||
if (NOT _TBB_INSTALL_DIR)
|
|
||||||
message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
|
|
||||||
else (NOT _TBB_INSTALL_DIR)
|
|
||||||
# finally: set the cached CMake variable TBB_INSTALL_DIR
|
|
||||||
if (NOT TBB_INSTALL_DIR)
|
|
||||||
set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
|
|
||||||
mark_as_advanced(TBB_INSTALL_DIR)
|
|
||||||
endif (NOT TBB_INSTALL_DIR)
|
|
||||||
|
|
||||||
|
if (POLICY_VAR STREQUAL "NEW")
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
set (USE_LIBCXX ON)
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
set (USE_LIBCXX ON)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
#-- A macro to rewrite the paths of the library. This is necessary, because
|
if (USE_LIBCXX)
|
||||||
# find_library() always found the em64t/vc9 version of the TBB libs
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
macro(TBB_CORRECT_LIB_DIR var_name)
|
list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
|
||||||
# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
endforeach ()
|
||||||
string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
endif ()
|
||||||
# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
|
endif ()
|
||||||
string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
string(REPLACE vc10 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
|
|
||||||
endmacro(TBB_CORRECT_LIB_DIR var_content)
|
|
||||||
|
|
||||||
|
# check compiler ABI
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(COMPILER_PREFIX)
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.8")
|
||||||
|
endif()
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.7")
|
||||||
|
endif()
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.4")
|
||||||
|
endif()
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.1")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
set(COMPILER_PREFIX)
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.8")
|
||||||
|
endif()
|
||||||
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.7")
|
||||||
|
endif()
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.4")
|
||||||
|
else() # Assume compatibility with 4.4 for other compilers
|
||||||
|
list(APPEND COMPILER_PREFIX "gcc4.4")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# if platform architecture is explicitly specified
|
||||||
|
set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
|
||||||
|
if (TBB_ARCH_PLATFORM)
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
|
||||||
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
foreach (prefix IN LISTS COMPILER_PREFIX)
|
||||||
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
|
||||||
|
else ()
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
|
||||||
|
endif ()
|
||||||
|
endforeach()
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
# add general search paths
|
||||||
|
foreach (dir IN LISTS TBB_PREFIX_PATH)
|
||||||
|
list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
|
||||||
|
${dir}/Libs)
|
||||||
|
list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
|
||||||
|
${dir}/include/tbb)
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
set(TBB_LIBRARY_NAMES tbb)
|
||||||
|
get_debug_names(TBB_LIBRARY_NAMES)
|
||||||
|
|
||||||
#-- Look for include directory and set ${TBB_INCLUDE_DIR}
|
|
||||||
set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
|
|
||||||
# Jiri: tbbvars now sets the CPATH environment variable to the directory
|
|
||||||
# containing the headers.
|
|
||||||
find_path(TBB_INCLUDE_DIR
|
find_path(TBB_INCLUDE_DIR
|
||||||
tbb/tbb_stddef.h
|
NAMES tbb/tbb.h
|
||||||
PATHS ${TBB_INC_SEARCH_DIR} ENV CPATH
|
HINTS ${TBB_INC_SEARCH_PATH})
|
||||||
)
|
find_tbb_library_verifying_release_debug_locations(TBB_LIBRARY)
|
||||||
mark_as_advanced(TBB_INCLUDE_DIR)
|
make_library_set(TBB_LIBRARY)
|
||||||
|
|
||||||
|
findpkg_finish(TBB tbb)
|
||||||
|
|
||||||
#-- Look for libraries
|
#if we haven't found TBB no point on going any further
|
||||||
# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
|
|
||||||
if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
|
||||||
set (_TBB_LIBRARY_DIR
|
|
||||||
${_TBB_INSTALL_DIR}/lib/$ENV{TBB_ARCH_PLATFORM}
|
|
||||||
${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib
|
|
||||||
)
|
|
||||||
endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
|
|
||||||
# Jiri: This block isn't mutually exclusive with the previous one
|
|
||||||
# (hence no else), instead I test if the user really specified
|
|
||||||
# the variables in question.
|
|
||||||
if ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
|
||||||
# HH: deprecated
|
|
||||||
message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set \$ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
|
|
||||||
# Jiri: It doesn't hurt to look in more places, so I store the hints from
|
|
||||||
# ENV{TBB_ARCH_PLATFORM} and the TBB_ARCHITECTURE and TBB_COMPILER
|
|
||||||
# variables and search them both.
|
|
||||||
set (_TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib" ${_TBB_LIBRARY_DIR})
|
|
||||||
endif ((NOT ${TBB_ARCHITECTURE} STREQUAL "") AND (NOT ${TBB_COMPILER} STREQUAL ""))
|
|
||||||
|
|
||||||
# GvdB: Mac OS X distribution places libraries directly in lib directory.
|
|
||||||
list(APPEND _TBB_LIBRARY_DIR ${_TBB_INSTALL_DIR}/lib)
|
|
||||||
|
|
||||||
# Jiri: No reason not to check the default paths. From recent versions,
|
|
||||||
# tbbvars has started exporting the LIBRARY_PATH and LD_LIBRARY_PATH
|
|
||||||
# variables, which now point to the directories of the lib files.
|
|
||||||
# It all makes more sense to use the ${_TBB_LIBRARY_DIR} as a HINTS
|
|
||||||
# argument instead of the implicit PATHS as it isn't hard-coded
|
|
||||||
# but computed by system introspection. Searching the LIBRARY_PATH
|
|
||||||
# and LD_LIBRARY_PATH environment variables is now even more important
|
|
||||||
# that tbbvars doesn't export TBB_ARCH_PLATFORM and it facilitates
|
|
||||||
# the use of TBB built from sources.
|
|
||||||
find_library(TBB_LIBRARY ${_TBB_LIB_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
|
|
||||||
#Extract path from TBB_LIBRARY name
|
|
||||||
get_filename_component(TBB_LIBRARY_DIR ${TBB_LIBRARY} PATH)
|
|
||||||
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
|
|
||||||
mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
|
|
||||||
|
|
||||||
#-- Look for debug libraries
|
|
||||||
# Jiri: Changed the same way as for the release libraries.
|
|
||||||
find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} HINTS ${_TBB_LIBRARY_DIR}
|
|
||||||
PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH)
|
|
||||||
|
|
||||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
|
||||||
# Extract path from TBB_LIBRARY_DEBUG name
|
|
||||||
get_filename_component(TBB_LIBRARY_DEBUG_DIR ${TBB_LIBRARY_DEBUG} PATH)
|
|
||||||
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
|
|
||||||
#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
|
|
||||||
mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
|
|
||||||
|
|
||||||
|
|
||||||
if (TBB_INCLUDE_DIR)
|
|
||||||
if (TBB_LIBRARY)
|
|
||||||
set (TBB_FOUND "YES")
|
|
||||||
set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
|
|
||||||
set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
|
|
||||||
set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
|
|
||||||
set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
|
|
||||||
# Jiri: Self-built TBB stores the debug libraries in a separate directory.
|
|
||||||
set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE)
|
|
||||||
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
|
|
||||||
message(STATUS "Found Intel TBB")
|
|
||||||
endif (TBB_LIBRARY)
|
|
||||||
endif (TBB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if (NOT TBB_FOUND)
|
if (NOT TBB_FOUND)
|
||||||
message("ERROR: Intel TBB NOT found!")
|
return()
|
||||||
message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
|
endif ()
|
||||||
# do only throw fatal, if this pkg is REQUIRED
|
|
||||||
if (TBB_FIND_REQUIRED)
|
|
||||||
message(FATAL_ERROR "Could NOT find TBB library.")
|
|
||||||
endif (TBB_FIND_REQUIRED)
|
|
||||||
endif (NOT TBB_FOUND)
|
|
||||||
|
|
||||||
endif (NOT _TBB_INSTALL_DIR)
|
#=============================================================================
|
||||||
|
# Look for TBB's malloc package
|
||||||
|
set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
|
||||||
|
get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
|
||||||
|
|
||||||
if (TBB_FOUND)
|
find_path(TBB_MALLOC_INCLUDE_DIR
|
||||||
set(TBB_INTERFACE_VERSION 0)
|
NAMES tbb/tbb.h
|
||||||
FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS)
|
HINTS ${TBB_INC_SEARCH_PATH})
|
||||||
STRING(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_TBB_VERSION_CONTENTS}")
|
find_tbb_library_verifying_release_debug_locations(TBB_MALLOC_LIBRARY)
|
||||||
set(TBB_INTERFACE_VERSION "${TBB_INTERFACE_VERSION}")
|
make_library_set(TBB_MALLOC_LIBRARY)
|
||||||
endif (TBB_FOUND)
|
|
||||||
|
findpkg_finish(TBB_MALLOC tbbmalloc)
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Look for TBB's malloc proxy package
|
||||||
|
set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
|
||||||
|
get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
|
||||||
|
|
||||||
|
find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
|
||||||
|
NAMES tbb/tbbmalloc_proxy.h
|
||||||
|
HINTS ${TBB_INC_SEARCH_PATH})
|
||||||
|
find_tbb_library_verifying_release_debug_locations(TBB_MALLOC_PROXY_LIBRARY)
|
||||||
|
make_library_set(TBB_MALLOC_PROXY_LIBRARY)
|
||||||
|
|
||||||
|
findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
|
||||||
|
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
#parse all the version numbers from tbb
|
||||||
|
if(NOT TBB_VERSION)
|
||||||
|
set(TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1
|
||||||
|
"${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h")
|
||||||
|
set(TBB_VERSION_FILE_AFTER_TBB_2021_1
|
||||||
|
"${TBB_INCLUDE_DIR}/oneapi/tbb/version.h")
|
||||||
|
|
||||||
|
if (EXISTS "${TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1}")
|
||||||
|
set(TBB_VERSION_FILE "${TBB_VERSION_FILE_PRIOR_TO_TBB_2021_1}")
|
||||||
|
elseif (EXISTS "${TBB_VERSION_FILE_AFTER_TBB_2021_1}")
|
||||||
|
set(TBB_VERSION_FILE "${TBB_VERSION_FILE_AFTER_TBB_2021_1}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Found TBB installation: ${TBB_INCLUDE_DIR} "
|
||||||
|
"missing version header.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#only read the start of the file
|
||||||
|
file(STRINGS
|
||||||
|
"${TBB_VERSION_FILE}"
|
||||||
|
TBB_VERSION_CONTENTS
|
||||||
|
REGEX "VERSION")
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
|
||||||
|
TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
string(REGEX REPLACE
|
||||||
|
".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
|
||||||
|
TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
|
@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <basalt/utils/test_utils.h>
|
#include <basalt/utils/test_utils.h>
|
||||||
|
|
||||||
#include <tbb/blocked_range.h>
|
#include <tbb/blocked_range.h>
|
||||||
#include <tbb/tbb_stddef.h>
|
|
||||||
|
|
||||||
namespace basalt {
|
namespace basalt {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue