[Dist/Tizen] Replace patch file resolving dependency on TBB with new one
[platform/upstream/dldt.git] / packaging / 0002-CMake-Add-a-variable-to-resolve-dependency-on-TBB-us.patch
1 From cecdd587a8a62d979b8391fba29bae21bf7d2027 Mon Sep 17 00:00:00 2001
2 From: Wook Song <wook16.song@samsung.com>
3 Date: Wed, 13 Nov 2019 14:57:03 +0900
4 Subject: [PATCH 2/2] [CMake] Add a variable to resolve dependency on TBB using
5  system library
6
7 In order to resolve the build dependency on TBB using one installed in
8 the system, this patch adds a variable to the dependencies.cmake file.
9
10 Change-Id: Ie07a0ce99c7539687b2d2059377da464b9159c8e
11 Signed-off-by: Wook Song <wook16.song@samsung.com>
12 ---
13  inference-engine/cmake/dependencies.cmake | 21 +++++++++++++++------
14  inference-engine/cmake/ie_parallel.cmake  | 10 ++++++++--
15  2 files changed, 23 insertions(+), 8 deletions(-)
16
17 diff --git a/inference-engine/cmake/dependencies.cmake b/inference-engine/cmake/dependencies.cmake
18 index 89d0c41f..561b057a 100644
19 --- a/inference-engine/cmake/dependencies.cmake
20 +++ b/inference-engine/cmake/dependencies.cmake
21 @@ -7,6 +7,9 @@ cmake_policy(SET CMP0054 NEW)
22  #we have number of dependencies stored on ftp
23  include(dependency_solver)
24  
25 +include(FindPkgConfig)
26 +find_package(PkgConfig REQUIRED)
27 +
28  set_temp_directory(TEMP "${IE_MAIN_SOURCE_DIR}")
29  
30  include(ExternalProject)
31 @@ -79,10 +82,14 @@ if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
32                  ENVIRONMENT "TBBROOT"
33                  VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*")
34      elseif(LINUX)
35 -        RESOLVE_DEPENDENCY(TBB
36 -                ARCHIVE_LIN "tbb2019_20181010_lin.tgz"
37 -                TARGET_PATH "${TEMP}/tbb"
38 -                ENVIRONMENT "TBBROOT")
39 +        if (USE_TBB_SYSTEM_DEPS)
40 +            pkg_search_module(TBB REQUIRED libtbb)
41 +        else(USE_TBB_SYSTEM_DEPS)
42 +            RESOLVE_DEPENDENCY(TBB
43 +                    ARCHIVE_LIN "tbb2019_20181010_lin.tgz"
44 +                    TARGET_PATH "${TEMP}/tbb"
45 +                    ENVIRONMENT "TBBROOT")
46 +        endif (USE_TBB_SYSTEM_DEPS)
47      else(APPLE)
48          RESOLVE_DEPENDENCY(TBB
49                  ARCHIVE_MAC "tbb2019_20190414_v1_mac.tgz"
50 @@ -90,8 +97,10 @@ if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
51                  ENVIRONMENT "TBBROOT"
52                  VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*")
53      endif()
54 -    log_rpath_from_dir(TBB "${TBB}/lib")
55 -    debug_message(STATUS "tbb=" ${TBB})
56 +    if (NOT USE_TBB_SYSTEM_DEPS)
57 +        log_rpath_from_dir(TBB "${TBB}/lib")
58 +        debug_message(STATUS "tbb=" ${TBB})
59 +    endif (NOT USE_TBB_SYSTEM_DEPS)
60  endif ()
61  
62  if (ENABLE_OPENCV)
63 diff --git a/inference-engine/cmake/ie_parallel.cmake b/inference-engine/cmake/ie_parallel.cmake
64 index 97e8c5e9..f8151a87 100644
65 --- a/inference-engine/cmake/ie_parallel.cmake
66 +++ b/inference-engine/cmake/ie_parallel.cmake
67 @@ -36,8 +36,14 @@ function(set_ie_threading_interface_for TARGET_NAME)
68              endif ()
69  
70              if (NOT TBB_INCLUDE_DIRS OR NOT TBB_LIBRARIES_RELEASE)
71 -                find_path(TBB_INCLUDE_DIRS tbb/tbb.h ${incl_path} NO_DEFAULT_PATH)
72 -                find_library(TBB_LIBRARIES_RELEASE tbb ${lib_rel_path} NO_DEFAULT_PATH)
73 +                if (USE_TBB_SYSTEM_DEPS)
74 +                    pkg_search_module(SYSTEM_TBB REQUIRED libtbb)
75 +                    set(incl_path ${SYSTEM_TBB_INCLUDE_DIRS})
76 +                    set(TBB_LIBRARIES_RELEASE ${SYSTEM_TBB_LIBRARIES})
77 +                else ()
78 +                    find_path(TBB_INCLUDE_DIRS tbb/tbb.h ${incl_path} NO_DEFAULT_PATH)
79 +                    find_library(TBB_LIBRARIES_RELEASE tbb ${lib_rel_path} NO_DEFAULT_PATH)
80 +                endif ()
81                  ext_message(STATUS "TBB include: ${TBB_INCLUDE_DIRS}")
82                  ext_message(STATUS "TBB Release lib: ${TBB_LIBRARIES_RELEASE}")
83                  if (NOT LINUX)
84 -- 
85 2.17.1
86