Geant4 Cross Reference |
1 # - Find ThreadingBuildingBlocks include dirs << 1 # Module for locating Intel's Threading Building Blocks (TBB). 2 # Use this module by invoking find_package wit << 2 # 3 # find_package(TBB << 3 # Customizable variables: 4 # [REQUIRED] # Fail with error << 4 # TBB_ROOT_DIR 5 # ) # << 5 # Specifies TBB's root directory. 6 # Once done, this will define << 6 # 7 # << 7 # Read-only variables: 8 # TBB_FOUND - system has TBB << 8 # TBB_FOUND 9 # TBB_INCLUDE_DIRS - the TBB include director << 9 # Indicates whether the library has been found. 10 # TBB_LIBRARIES - TBB libraries to be lined, << 10 # 11 # malloc proxy << 11 # TBB_INCLUDE_DIRS 12 # TBB::tbb - imported target for the TBB libr << 12 # Specifies TBB's include directory. 13 # << 13 # 14 # TBB_VERSION_MAJOR - Major Product Version N << 14 # TBB_LIBRARIES 15 # TBB_VERSION_MINOR - Minor Product Version N << 15 # Specifies TBB libraries that should be passed to target_link_libararies. 16 # TBB_INTERFACE_VERSION - Engineering Focused << 16 # 17 # TBB_COMPATIBLE_INTERFACE_VERSION - The olde << 17 # TBB_<COMPONENT>_LIBRARIES 18 # still su << 18 # Specifies the libraries of a specific <COMPONENT>. 19 # focused << 19 # 20 # << 20 # TBB_<COMPONENT>_FOUND 21 # TBB_MALLOC_FOUND - system has TBB malloc li << 21 # Indicates whether the specified <COMPONENT> was found. 22 # TBB_MALLOC_INCLUDE_DIRS - the TBB malloc in << 22 # 23 # TBB_MALLOC_LIBRARIES - The TBB malloc libra << 23 # 24 # TBB::malloc - imported target for the TBB m << 24 # Copyright (c) 2012 Sergiu Dotenco 25 # << 25 # 26 # TBB_MALLOC_PROXY_FOUND - system has TBB mal << 26 # Permission is hereby granted, free of charge, to any person obtaining a copy 27 # TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB mal << 27 # of this software and associated documentation files (the "Software"), to deal 28 # TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc << 28 # in the Software without restriction, including without limitation the rights 29 # TBB::malloc_proxy - imported target for the << 29 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30 # << 30 # copies of the Software, and to permit persons to whom the Software is 31 # << 31 # furnished to do so, subject to the following conditions: 32 # This module reads hints about search locatio << 32 # 33 # ENV TBB_ARCH_PLATFORM - for eg. set it to " << 33 # The above copyright notice and this permission notice shall be included in all 34 # ENV TBB_ROOT or just TBB_ROOT - root direct << 34 # copies or substantial portions of the Software. 35 # ENV TBB_BUILD_PREFIX - specifies the build << 35 # 36 # libraries. Should be << 36 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 37 # and optionally... << 37 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 38 # ENV TBB_BUILD_DIR - if build directory is d << 38 # FITNESS FOR A PARTTBBLAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 39 # << 39 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 40 # << 40 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 41 # Modified by Robert Maynard from the original << 41 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 42 # << 42 # SOFTWARE. 43 #--------------------------------------------- << 43 44 # This file is part of the CMake build system << 44 INCLUDE (FindPackageHandleStandardArgs) 45 # (Object-oriented Graphics Rendering Engi << 45 46 # For the latest info, see http://www.ogre3d.o << 46 IF (CMAKE_VERSION VERSION_GREATER 2.8.7) 47 # << 47 SET (_TBB_CHECK_COMPONENTS FALSE) 48 # The contents of this file are placed in the << 48 ELSE (CMAKE_VERSION VERSION_GREATER 2.8.7) 49 # free to make use of it in any way you like. << 49 SET (_TBB_CHECK_COMPONENTS TRUE) 50 #--------------------------------------------- << 50 ENDIF (CMAKE_VERSION VERSION_GREATER 2.8.7) 51 # << 51 52 #============================================= << 52 FIND_PATH (TBB_ROOT_DIR 53 # Copyright 2010-2012 Kitware, Inc. << 53 NAMES include/tbb/tbb.h 54 # Copyright 2012 Rolf Eike Beer <eike@sf- << 54 PATHS ENV TBBROOT 55 # << 55 ENV TBB40_INSTALL_DIR 56 # Distributed under the OSI-approved BSD Licen << 56 ENV TBB30_INSTALL_DIR 57 # see accompanying file COPYING-CMAKE-SCRIPTS << 57 ENV TBB22_INSTALL_DIR 58 # << 58 ENV TBB21_INSTALL_DIR 59 # This software is distributed WITHOUT ANY WAR << 59 ENV TBB_ROOT_DIR 60 # implied warranty of MERCHANTABILITY or FITNE << 60 DOC "TBB root directory") 61 # See the License for more information. << 61 62 #============================================= << 62 FIND_PATH (TBB_INCLUDE_DIR 63 << 63 NAMES tbb/tbb.h 64 #============================================= << 64 HINTS ${TBB_ROOT_DIR} 65 # FindTBB helper functions and macros << 65 PATH_SUFFIXES include 66 # << 66 DOC "TBB include directory") 67 << 67 68 # Use TBBConfig.cmake if possible. << 68 IF (MSVC11) 69 << 69 SET (_TBB_COMPILER vc11) 70 set(_tbb_find_quiet) << 70 ELSEIF (MSVC10) 71 if (TBB_FIND_QUIETLY) << 71 SET (_TBB_COMPILER vc10) 72 set(_tbb_find_quiet QUIET) << 72 ELSEIF (MSVC90) 73 endif () << 73 SET (_TBB_COMPILER vc9) 74 set(_tbb_find_components) << 74 ELSEIF (MSVC80) 75 set(_tbb_find_optional_components) << 75 SET (_TBB_COMPILER vc8) 76 foreach (_tbb_find_component IN LISTS TBB_FIND << 76 ELSEIF (WIN32) 77 if (TBB_FIND_REQUIRED_${_tbb_find_component} << 77 SET (_TBB_COMPILER vc_mt) 78 list(APPEND _tbb_find_components "${_tbb_f << 78 ENDIF (MSVC11) 79 else () << 79 80 list(APPEND _tbb_find_optional_components << 80 IF (CMAKE_SIZEOF_VOID_P EQUAL 8) 81 endif () << 81 SET (_TBB_POSSIBLE_LIB_SUFFIXES lib/intel64/${_TBB_COMPILER}) 82 endforeach () << 82 SET (_TBB_POSSIBLE_BIN_SUFFIXES bin/intel64/${_TBB_COMPILER}) 83 unset(_tbb_find_component) << 83 ELSE (CMAKE_SIZEOF_VOID_P EQUAL 8) 84 find_package(TBB CONFIG ${_tbb_find_quiet} << 84 SET (_TBB_POSSIBLE_LIB_SUFFIXES lib/ia32/${_TBB_COMPILER}) 85 COMPONENTS ${_tbb_find_components} << 85 SET (_TBB_POSSIBLE_BIN_SUFFIXES bin/ia32/${_TBB_COMPILER}) 86 OPTIONAL_COMPONENTS ${_tbb_find_optional_com << 86 ENDIF (CMAKE_SIZEOF_VOID_P EQUAL 8) 87 unset(_tbb_find_quiet) << 87 88 unset(_tbb_find_components) << 88 LIST (APPEND _TBB_POSSIBLE_LIB_SUFFIXES lib/$ENV{TBB_ARCH_PLATFORM}) 89 unset(_tbb_find_optional_components) << 89 90 if (TBB_FOUND) << 90 FIND_LIBRARY (TBB_LIBRARY_RELEASE 91 return () << 91 NAMES tbb 92 endif () << 92 HINTS ${TBB_ROOT_DIR} 93 << 93 PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES} 94 #============================================= << 94 DOC "TBB release library") 95 # Fix the library path in case it is a linker << 95 96 #============================================= << 96 FIND_LIBRARY (TBB_LIBRARY_DEBUG 97 function(tbb_extract_real_library library real << 97 NAMES tbb_debug 98 if(NOT UNIX OR NOT EXISTS ${library}) << 98 HINTS ${TBB_ROOT_DIR} 99 set(${real_library} "${library}" PARENT_SC << 99 PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES} 100 return() << 100 DOC "TBB debug library") 101 endif() << 101 102 << 102 IF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG) 103 #Read in the first 4 bytes and see if they a << 103 IF (NOT TBB_LIBRARY) 104 set(_elf_magic "7f454c46") << 104 SET (TBB_LIBRARY optimized ${TBB_LIBRARY_RELEASE} debug ${TBB_LIBRARY_DEBUG} 105 file(READ ${library} _hex_data OFFSET 0 LIMI << 105 CACHE DOC "TBB library" FORCE) 106 if(_hex_data STREQUAL _elf_magic) << 106 ENDIF (NOT TBB_LIBRARY) 107 #we have opened a elf binary so this is wh << 107 ELSEIF (TBB_LIBRARY_RELEASE) 108 #we should link to << 108 IF (NOT TBB_LIBRARY) 109 set(${real_library} "${library}" PARENT_SC << 109 SET (TBB_LIBRARY ${TBB_LIBRARY_RELEASE} CACHE DOC "TBB library" FORCE) 110 return() << 110 ENDIF (NOT TBB_LIBRARY) 111 endif() << 111 ENDIF (TBB_LIBRARY_RELEASE AND TBB_LIBRARY_DEBUG) 112 << 112 113 file(READ ${library} _data OFFSET 0 LIMIT 10 << 113 IF (TBB_LIBRARY_DEBUG) 114 if("${_data}" MATCHES "INPUT \\(([^(]+)\\)") << 114 LIST (APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_DEBUG}) 115 #extract out the .so name from REGEX MATCH << 115 ENDIF (TBB_LIBRARY_DEBUG) 116 set(_proper_so_name "${CMAKE_MATCH_1}") << 116 117 << 117 IF (TBB_LIBRARY_RELEASE) 118 #construct path to the real .so which is p << 118 LIST (APPEND _TBB_ALL_LIBS ${TBB_LIBRARY_RELEASE}) 119 #as the input file << 119 ENDIF (TBB_LIBRARY_RELEASE) 120 get_filename_component(_so_dir "${library} << 120 121 set(${real_library} "${_so_dir}/${_proper_ << 121 FOREACH (_TBB_COMPONENT ${TBB_FIND_COMPONENTS}) 122 else() << 122 STRING (TOUPPER ${_TBB_COMPONENT} _TBB_COMPONENT_UPPER) 123 #unable to determine what this library is << 123 SET (_TBB_LIBRARY_BASE TBB_${_TBB_COMPONENT_UPPER}_LIBRARY) 124 #and pass it unmodified. << 124 125 set(${real_library} "${library}" PARENT_SC << 125 IF (${_TBB_COMPONENT} STREQUAL preview) 126 endif() << 126 SET (_TBB_LIBRARY_NAME tbb_${_TBB_COMPONENT}) 127 endfunction() << 127 ELSE (${_TBB_COMPONENT} STREQUAL preview) 128 << 128 SET (_TBB_LIBRARY_NAME tbb${_TBB_COMPONENT}) 129 #============================================= << 129 message(STATUS " FindTBB.cmake: Trying to find component " ${_TBB_COMPONENT} " using name " ${_TBB_LIBRARY_NAME} " " ) 130 # Do the final processing for the package find << 130 ENDIF (${_TBB_COMPONENT} STREQUAL preview) 131 #============================================= << 131 132 macro(findpkg_finish PREFIX TARGET_NAME) << 132 FIND_LIBRARY (${_TBB_LIBRARY_BASE}_RELEASE 133 if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBR << 133 NAMES ${_TBB_LIBRARY_NAME} 134 set(${PREFIX}_FOUND TRUE) << 134 HINTS ${TBB_ROOT_DIR} 135 set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_IN << 135 PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES} 136 set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRA << 136 DOC "TBB ${_TBB_COMPONENT} release library") 137 else () << 137 138 if (${PREFIX}_FIND_REQUIRED AND NOT ${PREF << 138 FIND_LIBRARY (${_TBB_LIBRARY_BASE}_DEBUG 139 message(FATAL_ERROR "Required library ${ << 139 NAMES ${_TBB_LIBRARY_NAME}_debug 140 endif () << 140 HINTS ${TBB_ROOT_DIR} 141 endif () << 141 PATH_SUFFIXES ${_TBB_POSSIBLE_LIB_SUFFIXES} 142 << 142 DOC "TBB ${_TBB_COMPONENT} debug library") 143 if (NOT TARGET "TBB::${TARGET_NAME}") << 143 144 if (${PREFIX}_LIBRARY_RELEASE) << 144 MARK_AS_ADVANCED (${_TBB_LIBRARY_BASE} ${_TBB_LIBRARY_BASE}_DEBUG) 145 tbb_extract_real_library(${${PREFIX}_LIB << 145 146 endif () << 146 SET (TBB_${_TBB_COMPONENT_UPPER}_FOUND TRUE) 147 if (${PREFIX}_LIBRARY_DEBUG) << 147 148 tbb_extract_real_library(${${PREFIX}_LIB << 148 IF (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE) 149 endif () << 149 SET (${_TBB_LIBRARY_BASE} 150 add_library(TBB::${TARGET_NAME} UNKNOWN IM << 150 debug ${${_TBB_LIBRARY_BASE}_DEBUG} 151 set_target_properties(TBB::${TARGET_NAME} << 151 optimized ${${_TBB_LIBRARY_BASE}_RELEASE} CACHE DOC 152 INTERFACE_INCLUDE_DIRECTORIES "${${PREFI << 152 "TBB ${_TBB_COMPONENT} library") 153 if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_ << 153 ELSEIF (${_TBB_LIBRARY_BASE}_DEBUG) 154 set_target_properties(TBB::${TARGET_NAME << 154 SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_DEBUG}) 155 IMPORTED_LOCATION "${real_release}" << 155 ELSEIF (${_TBB_LIBRARY_BASE}_RELEASE) 156 IMPORTED_LOCATION_DEBUG "${real_debug} << 156 SET (${_TBB_LIBRARY_BASE} ${${_TBB_LIBRARY_BASE}_RELEASE} 157 IMPORTED_LOCATION_RELEASE "${real_rele << 157 CACHE DOC "TBB ${_TBB_COMPONENT} library") 158 elseif (${PREFIX}_LIBRARY_RELEASE) << 158 ELSE (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE) 159 set_target_properties(TBB::${TARGET_NAME << 159 # Component missing: record it for a later report 160 IMPORTED_LOCATION "${real_release}") << 160 LIST (APPEND _TBB_MISSING_COMPONENTS ${_TBB_COMPONENT}) 161 elseif (${PREFIX}_LIBRARY_DEBUG) << 161 SET (TBB_${_TBB_COMPONENT_UPPER}_FOUND FALSE) 162 set_target_properties(TBB::${TARGET_NAME << 162 ENDIF (${_TBB_LIBRARY_BASE}_DEBUG AND ${_TBB_LIBRARY_BASE}_RELEASE) 163 IMPORTED_LOCATION "${real_debug}") << 163 164 endif () << 164 IF (${_TBB_LIBRARY_BASE}_DEBUG) 165 endif () << 165 LIST (APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_DEBUG}) 166 << 166 ENDIF (${_TBB_LIBRARY_BASE}_DEBUG) 167 #mark the following variables as internal va << 167 168 mark_as_advanced(${PREFIX}_INCLUDE_DIR << 168 IF (${_TBB_LIBRARY_BASE}_RELEASE) 169 ${PREFIX}_LIBRARY << 169 LIST (APPEND _TBB_ALL_LIBS ${${_TBB_LIBRARY_BASE}_RELEASE}) 170 ${PREFIX}_LIBRARY_DEBUG << 170 ENDIF (${_TBB_LIBRARY_BASE}_RELEASE) 171 ${PREFIX}_LIBRARY_RELEASE) << 171 172 endmacro() << 172 SET (TBB_${_TBB_COMPONENT}_FOUND ${TBB_${_TBB_COMPONENT_UPPER}_FOUND}) 173 << 173 174 #============================================= << 174 IF (${_TBB_LIBRARY_BASE}) 175 # Generate debug names from given release name << 175 # setup the TBB_<COMPONENT>_LIBRARIES variable 176 #============================================= << 176 SET (TBB_${_TBB_COMPONENT_UPPER}_LIBRARIES ${${_TBB_LIBRARY_BASE}}) 177 macro(get_debug_names PREFIX) << 177 LIST (APPEND TBB_LIBRARIES ${${_TBB_LIBRARY_BASE}}) 178 foreach(i ${${PREFIX}}) << 178 ELSE (${_TBB_LIBRARY_BASE}) 179 set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i << 179 LIST (APPEND _TBB_MISSING_LIBRARIES ${_TBB_LIBRARY_BASE}) 180 endforeach() << 180 ENDIF (${_TBB_LIBRARY_BASE}) 181 endmacro() << 181 ENDFOREACH (_TBB_COMPONENT ${TBB_FIND_COMPONENTS}) 182 << 182 183 #============================================= << 183 LIST (APPEND TBB_LIBRARIES ${TBB_LIBRARY}) 184 # See if we have env vars to help us find tbb << 184 SET (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR}) 185 #============================================= << 185 186 macro(getenv_path VAR) << 186 IF (DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS) 187 set(ENV_${VAR} $ENV{${VAR}}) << 187 IF (NOT TBB_FIND_QUIETLY) 188 # replace won't work if var is blank << 188 MESSAGE (STATUS "One or more TBB components were not found:") 189 if (ENV_${VAR}) << 189 # Display missing components indented, each on a separate line 190 string( REGEX REPLACE "\\\\" "/" ENV_${VA << 190 FOREACH (_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS}) 191 endif () << 191 MESSAGE (STATUS " " ${_TBB_MISSING_COMPONENT}) 192 endmacro() << 192 ENDFOREACH (_TBB_MISSING_COMPONENT ${_TBB_MISSING_COMPONENTS}) 193 << 193 ENDIF (NOT TBB_FIND_QUIETLY) 194 #============================================= << 194 ENDIF (DEFINED _TBB_MISSING_COMPONENTS AND _TBB_CHECK_COMPONENTS) 195 # Couple a set of release AND debug libraries << 195 196 #============================================= << 196 # Determine library's version 197 macro(make_library_set PREFIX) << 197 198 if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG) << 198 SET (_TBB_VERSION_HEADER ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h) 199 set(${PREFIX} optimized ${${PREFIX}_RELEAS << 199 200 elseif (${PREFIX}_RELEASE) << 200 IF (EXISTS ${_TBB_VERSION_HEADER}) 201 set(${PREFIX} ${${PREFIX}_RELEASE}) << 201 FILE (READ ${_TBB_VERSION_HEADER} _TBB_VERSION_CONTENTS) 202 elseif (${PREFIX}_DEBUG) << 202 203 set(${PREFIX} ${${PREFIX}_DEBUG}) << 203 STRING (REGEX REPLACE ".*#define TBB_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" 204 endif () << 204 TBB_VERSION_MAJOR "${_TBB_VERSION_CONTENTS}") 205 endmacro() << 205 STRING (REGEX REPLACE ".*#define TBB_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" 206 << 206 TBB_VERSION_MINOR "${_TBB_VERSION_CONTENTS}") 207 << 207 208 #============================================= << 208 SET (TBB_VERSION ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}) 209 # Now to actually find TBB << 209 SET (TBB_VERSION_COMPONENTS 2) 210 # << 210 ENDIF (EXISTS ${_TBB_VERSION_HEADER}) 211 << 211 212 # Get path, convert backslashes as ${ENV_${var << 212 IF (WIN32) 213 getenv_path(TBB_ROOT) << 213 FIND_PROGRAM (LIB_EXECUTABLE NAMES lib 214 << 214 HINTS "$ENV{VS110COMNTOOLS}/../../VC/bin" 215 # initialize search paths << 215 "$ENV{VS100COMNTOOLS}/../../VC/bin" 216 set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT << 216 "$ENV{VS90COMNTOOLS}/../../VC/bin" 217 set(TBB_INC_SEARCH_PATH "") << 217 "$ENV{VS71COMNTOOLS}/../../VC/bin" 218 set(TBB_LIB_SEARCH_PATH "") << 218 "$ENV{VS80COMNTOOLS}/../../VC/bin" 219 << 219 DOC "Library manager") 220 << 220 221 # If user built from sources << 221 MARK_AS_ADVANCED (LIB_EXECUTABLE) 222 set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX}) << 222 ENDIF (WIN32) 223 if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT) << 223 224 getenv_path(TBB_BUILD_DIR) << 224 MACRO (GET_LIB_REQUISITES LIB REQUISITES) 225 if (NOT ENV_TBB_BUILD_DIR) << 225 IF (LIB_EXECUTABLE) 226 set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/buil << 226 GET_FILENAME_COMPONENT (_LIB_PATH ${LIB_EXECUTABLE} PATH) 227 endif () << 227 228 << 228 IF (MSVC) 229 # include directory under ${ENV_TBB_ROOT}/in << 229 # Do not redirect the output 230 list(APPEND TBB_LIB_SEARCH_PATH << 230 UNSET (ENV{VS_UNICODE_OUTPUT}) 231 ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_r << 231 ENDIF (MSVC) 232 ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_d << 232 233 endif () << 233 EXECUTE_PROCESS (COMMAND ${LIB_EXECUTABLE} /nologo /list ${LIB} 234 << 234 WORKING_DIRECTORY ${_LIB_PATH}/../../Common7/IDE 235 << 235 OUTPUT_VARIABLE _LIB_OUTPUT ERROR_QUIET) 236 # For Windows, let's assume that the user migh << 236 237 # TBB packages from the main website. These us << 237 STRING (REPLACE "\n" ";" "${REQUISITES}" "${_LIB_OUTPUT}") 238 # structure (at least for automatically findin << 238 LIST (REMOVE_DUPLICATES ${REQUISITES}) 239 # on platform and compiler, but we'll do our b << 239 ENDIF (LIB_EXECUTABLE) 240 # Not adding the same effort for the precompil << 240 ENDMACRO (GET_LIB_REQUISITES) 241 # have different versions for CC compiler vers << 241 242 # will never adequately match the user's setup << 242 IF (_TBB_ALL_LIBS) 243 # to detect the "best" version to use. The use << 243 # collect lib requisites using the lib tool 244 # select the right files. (Chances are the dis << 244 FOREACH (_TBB_COMPONENT ${_TBB_ALL_LIBS}) 245 # custom version of tbb, anyway, so the proble << 245 GET_LIB_REQUISITES (${_TBB_COMPONENT} _TBB_REQUISITES) 246 if (WIN32 AND MSVC) << 246 ENDFOREACH (_TBB_COMPONENT) 247 set(COMPILER_PREFIX "vc7.1") << 247 ENDIF (_TBB_ALL_LIBS) 248 if (MSVC_VERSION EQUAL 1400) << 248 249 set(COMPILER_PREFIX "vc8") << 249 IF (NOT TBB_BINARY_DIR) 250 elseif(MSVC_VERSION EQUAL 1500) << 250 SET (_TBB_UPDATE_BINARY_DIR TRUE) 251 set(COMPILER_PREFIX "vc9") << 251 ELSE (NOT TBB_BINARY_DIR) 252 elseif(MSVC_VERSION EQUAL 1600) << 252 SET (_TBB_UPDATE_BINARY_DIR FALSE) 253 set(COMPILER_PREFIX "vc10") << 253 ENDIF (NOT TBB_BINARY_DIR) 254 elseif(MSVC_VERSION EQUAL 1700) << 254 255 set(COMPILER_PREFIX "vc11") << 255 SET (_TBB_BINARY_DIR_HINTS ${_TBB_POSSIBLE_BIN_SUFFIXES}) 256 elseif(MSVC_VERSION EQUAL 1800) << 256 257 set(COMPILER_PREFIX "vc12") << 257 IF (_TBB_REQUISITES) 258 elseif(MSVC_VERSION GREATER_EQUAL 1900) << 258 FIND_FILE (TBB_BINARY_DIR NAMES ${_TBB_REQUISITES} 259 set(COMPILER_PREFIX "vc14") << 259 HINTS ${TBB_ROOT_DIR} 260 endif () << 260 PATH_SUFFIXES ${_TBB_BINARY_DIR_HINTS} NO_DEFAULT_PATH) 261 << 261 ENDIF (_TBB_REQUISITES) 262 # for each prefix path, add ia32/64\${COMPIL << 262 263 foreach (dir IN LISTS TBB_PREFIX_PATH) << 263 IF (TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR) 264 if (CMAKE_CL_64) << 264 SET (_TBB_BINARY_DIR ${TBB_BINARY_DIR}) 265 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 265 UNSET (TBB_BINARY_DIR CACHE) 266 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 266 267 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 267 IF (_TBB_BINARY_DIR) 268 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 268 GET_FILENAME_COMPONENT (TBB_BINARY_DIR ${_TBB_BINARY_DIR} PATH) 269 else () << 269 ENDIF (_TBB_BINARY_DIR) 270 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 270 ENDIF (TBB_BINARY_DIR AND _TBB_UPDATE_BINARY_DIR) 271 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 271 272 endif () << 272 SET (TBB_BINARY_DIR ${TBB_BINARY_DIR} CACHE PATH "TBB binary directory") 273 endforeach () << 273 274 endif () << 274 MARK_AS_ADVANCED (TBB_INCLUDE_DIR TBB_LIBRARY TBB_LIBRARY_RELEASE 275 << 275 TBB_LIBRARY_DEBUG TBB_BINARY_DIR) 276 # For OS X binary distribution, choose libc++ << 276 277 # and above and AppleClang << 277 IF (NOT _TBB_CHECK_COMPONENTS) 278 if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND << 278 SET (_TBB_FPHSA_ADDITIONAL_ARGS HANDLE_COMPONENTS) 279 NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0 << 279 ENDIF (NOT _TBB_CHECK_COMPONENTS) 280 set (USE_LIBCXX OFF) << 280 281 cmake_policy(GET CMP0025 POLICY_VAR) << 281 IF (CMAKE_VERSION VERSION_GREATER 2.8.2) 282 << 282 LIST (APPEND _TBB_FPHSA_ADDITIONAL_ARGS VERSION_VAR TBB_VERSION) 283 if (POLICY_VAR STREQUAL "NEW") << 283 ENDIF (CMAKE_VERSION VERSION_GREATER 2.8.2) 284 if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleC << 284 285 set (USE_LIBCXX ON) << 285 FIND_PACKAGE_HANDLE_STANDARD_ARGS (TBB REQUIRED_VARS TBB_ROOT_DIR 286 endif () << 286 TBB_INCLUDE_DIR TBB_LIBRARY ${_TBB_MISSING_LIBRARIES} 287 else () << 287 ${_TBB_FPHSA_ADDITIONAL_ARGS}) 288 if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" << 289 set (USE_LIBCXX ON) << 290 endif () << 291 endif () << 292 << 293 if (USE_LIBCXX) << 294 foreach (dir IN LISTS TBB_PREFIX_PATH) << 295 list (APPEND TBB_LIB_SEARCH_PATH ${dir}/ << 296 endforeach () << 297 endif () << 298 endif () << 299 << 300 # check compiler ABI << 301 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") << 302 set(COMPILER_PREFIX) << 303 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 304 list(APPEND COMPILER_PREFIX "gcc4.8") << 305 endif() << 306 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 307 list(APPEND COMPILER_PREFIX "gcc4.7") << 308 endif() << 309 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 310 list(APPEND COMPILER_PREFIX "gcc4.4") << 311 endif() << 312 list(APPEND COMPILER_PREFIX "gcc4.1") << 313 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") << 314 set(COMPILER_PREFIX) << 315 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 316 list(APPEND COMPILER_PREFIX "gcc4.8") << 317 endif() << 318 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_L << 319 list(APPEND COMPILER_PREFIX "gcc4.7") << 320 endif() << 321 list(APPEND COMPILER_PREFIX "gcc4.4") << 322 else() # Assume compatibility with 4.4 for oth << 323 list(APPEND COMPILER_PREFIX "gcc4.4") << 324 endif () << 325 << 326 # if platform architecture is explicitly speci << 327 set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM}) << 328 if (TBB_ARCH_PLATFORM) << 329 foreach (dir IN LISTS TBB_PREFIX_PATH) << 330 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${T << 331 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib << 332 endforeach () << 333 endif () << 334 << 335 foreach (dir IN LISTS TBB_PREFIX_PATH) << 336 foreach (prefix IN LISTS COMPILER_PREFIX) << 337 if (CMAKE_SIZEOF_VOID_P EQUAL 8) << 338 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 339 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 340 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 341 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 342 else () << 343 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 344 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/l << 345 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 346 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/i << 347 endif () << 348 endforeach() << 349 endforeach () << 350 << 351 # add general search paths << 352 foreach (dir IN LISTS TBB_PREFIX_PATH) << 353 list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib $ << 354 ${dir}/Libs) << 355 list(APPEND TBB_INC_SEARCH_PATH ${dir}/inclu << 356 ${dir}/include/tbb) << 357 endforeach () << 358 << 359 set(TBB_LIBRARY_NAMES tbb) << 360 get_debug_names(TBB_LIBRARY_NAMES) << 361 << 362 << 363 find_path(TBB_INCLUDE_DIR << 364 NAMES tbb/tbb.h << 365 PATHS ${TBB_INC_SEARCH_PATH}) << 366 << 367 find_library(TBB_LIBRARY_RELEASE << 368 NAMES ${TBB_LIBRARY_NAMES} << 369 PATHS ${TBB_LIB_SEARCH_PATH}) << 370 find_library(TBB_LIBRARY_DEBUG << 371 NAMES ${TBB_LIBRARY_NAMES_DEBUG} << 372 PATHS ${TBB_LIB_SEARCH_PATH}) << 373 make_library_set(TBB_LIBRARY) << 374 << 375 findpkg_finish(TBB tbb) << 376 << 377 #if we haven't found TBB no point on going any << 378 if (NOT TBB_FOUND) << 379 return() << 380 endif () << 381 << 382 #============================================= << 383 # Look for TBB's malloc package << 384 set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc) << 385 get_debug_names(TBB_MALLOC_LIBRARY_NAMES) << 386 << 387 find_path(TBB_MALLOC_INCLUDE_DIR << 388 NAMES tbb/tbb.h << 389 PATHS ${TBB_INC_SEARCH_PATH}) << 390 << 391 find_library(TBB_MALLOC_LIBRARY_RELEASE << 392 NAMES ${TBB_MALLOC_LIBRARY_NAMES} << 393 PATHS ${TBB_LIB_SEARCH_PATH}) << 394 find_library(TBB_MALLOC_LIBRARY_DEBUG << 395 NAMES ${TBB_MALLOC_LIBRARY_NAMES_ << 396 PATHS ${TBB_LIB_SEARCH_PATH}) << 397 make_library_set(TBB_MALLOC_LIBRARY) << 398 << 399 findpkg_finish(TBB_MALLOC tbbmalloc) << 400 << 401 #============================================= << 402 # Look for TBB's malloc proxy package << 403 set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_p << 404 get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES << 405 << 406 find_path(TBB_MALLOC_PROXY_INCLUDE_DIR << 407 NAMES tbb/tbbmalloc_proxy.h << 408 PATHS ${TBB_INC_SEARCH_PATH}) << 409 << 410 find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE << 411 NAMES ${TBB_MALLOC_PROXY_LIBRARY_ << 412 PATHS ${TBB_LIB_SEARCH_PATH}) << 413 find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG << 414 NAMES ${TBB_MALLOC_PROXY_LIBRARY_ << 415 PATHS ${TBB_LIB_SEARCH_PATH}) << 416 make_library_set(TBB_MALLOC_PROXY_LIBRARY) << 417 << 418 findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_prox << 419 << 420 << 421 #============================================= << 422 #parse all the version numbers from tbb << 423 if(NOT TBB_VERSION) << 424 if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/ve << 425 file(STRINGS << 426 "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h << 427 TBB_VERSION_CONTENTS << 428 REGEX "VERSION") << 429 else() << 430 #only read the start of the file << 431 file(STRINGS << 432 "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" << 433 TBB_VERSION_CONTENTS << 434 REGEX "VERSION") << 435 endif() << 436 << 437 string(REGEX REPLACE << 438 ".*#define TBB_VERSION_MAJOR ([0-9]+).*" " << 439 TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS} << 440 << 441 string(REGEX REPLACE << 442 ".*#define TBB_VERSION_MINOR ([0-9]+).*" " << 443 TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS} << 444 << 445 string(REGEX REPLACE << 446 ".*#define TBB_INTERFACE_VERSION ([0-9 << 447 TBB_INTERFACE_VERSION "${TBB_VERSION_C << 448 << 449 string(REGEX REPLACE << 450 ".*#define TBB_COMPATIBLE_INTERFACE_VE << 451 TBB_COMPATIBLE_INTERFACE_VERSION "${TB << 452 << 453 set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_ << 454 << 455 endif() << 456 << 457 include(FindPackageHandleStandardArgs) << 458 find_package_handle_standard_args(TBB << 459 REQUIRED_VARS TBB_INCLUDE_DIR TBB_LIBRARY << 460 VERSION_VAR TBB_VERSION) <<