Skip to content

Commit

Permalink
Use OV threading backend instead of direct TBB (openvinotoolkit#230)
Browse files Browse the repository at this point in the history
* Use OV threading backend instead of direct TBB

* Update CMakeLists.txt
  • Loading branch information
ilya-lavrenov authored Aug 23, 2024
1 parent aa3c032 commit 016aa8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ if(BUILD_CPP_EXTENSION)
endif()

# Find OpenVINODeveloperPackage first to compile with SDL flags
find_package(OpenVINODeveloperPackage ${openvino_tokenizers_VERSION} QUIET PATHS "${OpenVINO_DIR}")
find_package(OpenVINODeveloperPackage ${openvino_tokenizers_VERSION} QUIET
COMPONENTS Runtime Threading
PATHS "${OpenVINO_DIR}")
if(NOT OpenVINODeveloperPackage_FOUND)
find_package(OpenVINO ${openvino_tokenizers_VERSION} REQUIRED COMPONENTS Runtime OPTIONAL_COMPONENTS TensorFlow PATHS "${OpenVINO_DIR_PY}")
find_package(OpenVINO ${openvino_tokenizers_VERSION} REQUIRED
COMPONENTS Runtime Threading
PATHS "${OpenVINO_DIR_PY}")
endif()

add_subdirectory(src)
Expand Down
5 changes: 1 addition & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,6 @@ function(ov_tokenizers_link_pcre2)
target_compile_definitions(${TARGET_NAME} PRIVATE PCRE2_CODE_UNIT_WIDTH=8)
endfunction()

find_package(TBB 2021.2 REQUIRED
PATHS "${OpenVINO_DIR_PY}")

#
# Build library
#
Expand All @@ -309,7 +306,7 @@ string(REPLACE " " ";" extra_flags "${c_cxx_flags} ${cxx_flags}")
set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_OPTIONS "${extra_flags}")

target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_OPENVINO_EXTENSION_API)
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime TBB::tbb)
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime)

#
# Post build steps to copy core_tokenizers dependencies
Expand Down

0 comments on commit 016aa8e

Please sign in to comment.