-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


Intel Threading Building Blocks CMake

, 14 2017 . 09:47 +


, habrahabr. , CMake , , Intel Threading Building Blocks (Intel TBB) CMake . Intel TBB GitHub, Linux* OS, Windows* OS macOS*, Intel TBB 2017 Update 7.


Intel TBB CMake


Intel TBB , GitHub . .


TBBConfig.cmake TBBConfigVersion.cmake Intel TBB. /cmake Linux* OS, Windows* OS macOS*, Intel TBB 2017 Update 7.
:
  1. .
  2. CMAKE_PREFIX_PATH TBB_DIR.
  3. find_package (TBB), .
  4. / .

COMPONENTS REQUIRED find_package, , tbb, tbbmalloc, tbb_preview .. tbb, tbbmalloc tbbmalloc_proxy. TBB::.
:
TBB_FOUND
Intel TBB
TBB__FOUND

TBB_IMPORTED_TARGETS

TBB_VERSION
Intel TBB (: .)
TBB_INTERFACE_VERSION
Intel TBB

: ., . TBB_INTERFACE_VERSION.

Intel TBB TBBBuild


TBBBuild.cmake tbb_build, (Makefile). Linux* OS macOS* make-, Windows* OS gmake. /cmake.
tbb_build :
TBB_ROOT
,
CONFIG_DIR
, ;
-NOTFOUND
MAKE_ARGS
make-;
, :
  • compiler=
  • tbb_build_dir=
  • tbb_build_prefix=
  • -j


:
include(/TBBBuild.cmake)
tbb_build(TBB_ROOT  CONFIG_DIR TBB_DIR)
find_package(TBB )


Intel TBB TBBGet


TBBGet.cmake tbb_get, Intel TBB GitHub. Intel TBB 2017 Update 7 /cmake.
tbb_get :
TBB_ROOT
, ;
-NOTFOUND
RELEASE_TAG |LATEST
;
LATEST
SAVE_TO
;
${CMAKE_CURRENT_BINARY_DIR}/tbb_downloaded
SYSTEM_NAME Linux|Windows|Darwin
, ;
CMAKE_SYSTEM_NAME
CONFIG_DIR
, ;
, SOURCE_CODE
SOURCE_CODE
,

:

  1. include(/TBBGet.cmake)
    tbb_get(TBB_ROOT tbb_root CONFIG_DIR TBB_DIR)
    find_package(TBB )

  2. ,
    include(/TBBGet.cmake)
    include(/TBBBuild.cmake)
    tbb_get(TBB_ROOT tbb_root SOURCE_CODE)
    tbb_build(TBB_ROOT ${tbb_root} CONFIG_DIR TBB_DIR)
    find_package(TBB )
    


- GettingStarted/sub_string_finder Intel TBB



Windows* OS
CMake GettingStarted/sub_string_finder Intel TBB. Windows* OS (Microsoft* Visual Studio), .
.

:
  • CMake 3.0.0
  • Microsoft* Visual Studio 11 ( Intel TBB 2017 Update 7)
  • Intel TBB 2017 Update 7

:
  1. Intel TBB Windows* OS C:\demo_tbb_cmake
  2. C:\demo_tbb_cmake\tbb_oss\examples\GettingStarted\sub_string_finder CMakeLists.txt :
    cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
    project(sub_string_finder CXX)
    add_executable(sub_string_finder sub_string_finder.cpp)
    #  find_package  TBBConfig,  
    # CMAKE_PREFIX_PATH  TBB_DIR.
    find_package(TBB REQUIRED tbb)
    # "TBB::tbb"    "${TBB_IMPORTED_TARGETS}"
    target_link_libraries(sub_string_finder ${TBB_IMPORTED_TARGETS})
     
  3. CMake GUI
    • ( Browse Source... Browse Build...):
      Where is the source ode:
      C:/demo_tbb_cmake/tbb_oss/examples/GettingStarted/sub_string_finder
      Where to build the binaries:
      C:/demo_tbb_cmake/tbb_oss/examples/GettingStarted/sub_string_finder/build
    • Add Entry:
      Name: CMAKE_PREFIX_PATH
      Type: PATH
      Value: C:/demo_tbb_cmake/tbb_oss
    • C Microsoft* Visual Studio, Generate.
  4. Microsoft* Visual Studio (, Open Project CMake GUI) . :
    C:\demo_tbb_cmake\tbb_oss\examples\GettingStarted\sub_string_finder\build\sub_string_finder.sln.
    CMake GUI :



CMake GettingStarted/sub_string_finder, Intel TBB Community Preview Features (CPF). Linux* OS, .
:
  • CMake 3.0.0

:
  1. Intel TBB ~/demo_tbb_cmake:
    mkdir ~/demo_tbb_cmake
    cd ~/demo_tbb_cmake
    git clone https://github.com/01org/tbb.git
    

  2. ~/demo_tbb_cmake/tbb/examples/GettingStarted/sub_string_finder CMakeLists.txt :
    cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
    project(sub_string_finder CXX)
    add_executable(sub_string_finder sub_string_finder.cpp)
     include(${TBB_ROOT}/cmake/TBBBuild.cmake)
     #  Intel TBB   Community Preview Features (CPF).
    tbb_build(TBB_ROOT ${TBB_ROOT} CONFIG_DIR TBB_DIR MAKE_ARGS tbb_cpf=1)
     find_package(TBB REQUIRED tbb_preview)
     # "TBB::tbb_preview"    "${TBB_IMPORTED_TARGETS}".
    target_link_libraries(sub_string_finder ${TBB_IMPORTED_TARGETS})
    

  3. :
    mkdir ~/demo_tbb_cmake/tbb/examples/GettingStarted/sub_string_finder/build
    cd ~/demo_tbb_cmake/tbb/examples/GettingStarted/sub_string_finder/build
  4. CMake, Intel TBB:
    cmake -DTBB_ROOT=${HOME}/demo_tbb_cmake/tbb ..
  5. :
    make
    ./sub_string_finder
    




Intel TBB CMake . . . , , .
:


*
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/335346/

:  

: [1] []
 

:
: 

: ( )

:

  URL