From e54e45ea9f692c45d0d08f1438b95231d304a698 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Tue, 12 Dec 2023 15:26:25 +0400 Subject: [PATCH] Added LC_RPATH to additionally point to openvino's libs --- .../user_ie_extensions/CMakeLists.txt | 13 +++++++++++-- .../python/openvino_tokenizers/__init__.py | 8 +++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/custom_operations/user_ie_extensions/CMakeLists.txt b/modules/custom_operations/user_ie_extensions/CMakeLists.txt index b14006a2b9..763ea875f3 100644 --- a/modules/custom_operations/user_ie_extensions/CMakeLists.txt +++ b/modules/custom_operations/user_ie_extensions/CMakeLists.txt @@ -117,9 +117,18 @@ include(GNUInstallDirs) # setting RPATH / LC_RPATH depending on platform if(LINUX) - set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN") + # to find libcore_tokenizer.so in the same folder + set(rpaths "$ORIGIN") elseif(APPLE) - set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path") + # to find libcore_tokenizer.dylib in the same folder + set(rpaths "@loader_path") + if(DEFINED SKBUILD) + # in case we build pip package, we need to refer to libopenvino.dylib from 'openvino' package + list(APPEND rpaths "@loader_path/../../openvino/libs") + endif() +endif() +if(rpaths) + set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpaths}") endif() # Installing the extension module to the root of the package diff --git a/modules/custom_operations/user_ie_extensions/tokenizer/python/openvino_tokenizers/__init__.py b/modules/custom_operations/user_ie_extensions/tokenizer/python/openvino_tokenizers/__init__.py index b6a998eb76..c2a0b6a5a3 100644 --- a/modules/custom_operations/user_ie_extensions/tokenizer/python/openvino_tokenizers/__init__.py +++ b/modules/custom_operations/user_ie_extensions/tokenizer/python/openvino_tokenizers/__init__.py @@ -33,15 +33,13 @@ else: sys.exit(f"Error: extension does not support the platform {sys.platform}") -# conda-forge case -conda_forge_lib_path = Path(os.path.join(os.path.dirname(__file__), "..", "..", "..")) -if os.path.exists(conda_forge_lib_path / _ext_name): - _ext_path = conda_forge_lib_path / _ext_name -else: +conda_forge_lib_path = Path(__file__).parent() / ".." / ".." / ".." +if not (_ext_path := conda_forge_lib_path / _ext_name).exists(): _ext_path = _ext_libs_path / _ext_name del _ext_name del _ext_libs_path +del _extension_path del conda_forge_lib_path # patching openvino