|
| 1 | +# Copyright (C) 2024 Intel Corporation |
| 2 | +# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | + |
| 5 | +message(STATUS "Checking for module 'tbb' using find_library()") |
| 6 | + |
| 7 | +find_library(TBB_LIBRARY NAMES tbbmalloc tbbmalloc) |
| 8 | +set(TBB_LIBRARIES ${TBB_LIBRARY}) |
| 9 | + |
| 10 | +get_filename_component(TBB_LIB_DIR ${TBB_LIBRARIES} DIRECTORY) |
| 11 | +set(TBB_LIBRARY_DIRS ${TBB_LIB_DIR}) |
| 12 | + |
| 13 | +find_file(TBB_HEADER NAMES "tbb/scalable_allocator.h") |
| 14 | +if(TBB_HEADER) |
| 15 | + get_filename_component(TBB_INCLUDE_DIR_TBB ${TBB_HEADER} DIRECTORY) |
| 16 | + get_filename_component(TBB_INCLUDE_DIR ${TBB_INCLUDE_DIR_TBB} DIRECTORY) |
| 17 | + set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR}) |
| 18 | +else() |
| 19 | + set(MSG_NOT_FOUND "<tbb/scalable_allocator.h> header NOT found (set CMAKE_PREFIX_PATH to point the location)") |
| 20 | + if(TBB_FIND_REQUIRED) |
| 21 | + message(FATAL_ERROR ${MSG_NOT_FOUND}) |
| 22 | + else() |
| 23 | + message(WARNING ${MSG_NOT_FOUND}) |
| 24 | + endif() |
| 25 | +endif() |
| 26 | + |
| 27 | +if(WINDOWS) |
| 28 | + find_file(TBB_DLL NAMES "bin/tbbmalloc.dll") |
| 29 | + get_filename_component(TBB_DLL_DIR ${TBB_DLL} DIRECTORY) |
| 30 | + set(TBB_DLL_DIRS ${TBB_DLL_DIR}) |
| 31 | +endif() |
| 32 | + |
| 33 | +if(TBB_LIBRARY) |
| 34 | + message(STATUS " Found tbb using find_library()") |
| 35 | + message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}") |
| 36 | + message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}") |
| 37 | + message(STATUS " TBB_LIBRARY_DIRS = ${TBB_LIBRARY_DIRS}") |
| 38 | + if(WINDOWS) |
| 39 | + message(STATUS " TBB_DLL_DIRS = ${TBB_DLL_DIRS}") |
| 40 | + endif() |
| 41 | +else() |
| 42 | + set(MSG_NOT_FOUND "tbb NOT found (set CMAKE_PREFIX_PATH to point the location)") |
| 43 | + if(TBB_FIND_REQUIRED) |
| 44 | + message(FATAL_ERROR ${MSG_NOT_FOUND}) |
| 45 | + else() |
| 46 | + message(WARNING ${MSG_NOT_FOUND}) |
| 47 | + endif() |
| 48 | +endif() |
0 commit comments