Skip to content

Commit

Permalink
Find python in extensions safely
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Dec 20, 2024
1 parent 375ebd2 commit 2d06f63
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/core/template_extension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ set(CMAKE_CXX_STANDARD 11)
set(TARGET_NAME "openvino_template_extension")

# The OpenVINO installed from PyPI can be used to find OpenVINO_DIR
find_package(Python3 REQUIRED)
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "from openvino.utils import get_cmake_path; print(get_cmake_path(), end='')"
OUTPUT_VARIABLE OpenVINO_DIR_PY
ERROR_QUIET
)
if(NOT CMAKE_CROSSCOMPILING)
find_package(Python3 QUIET COMPONENTS Interpreter)
if(Python3_Interpreter_FOUND)
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "from openvino.utils import get_cmake_path; print(get_cmake_path(), end='')"
OUTPUT_VARIABLE OpenVINO_DIR_PY
ERROR_QUIET)
endif()
endif()

find_package(OpenVINO REQUIRED PATHS "${OpenVINO_DIR_PY}")

Expand Down

0 comments on commit 2d06f63

Please sign in to comment.