Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert to python3 #622

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 1 addition & 41 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,9 @@ FetchContent_GetProperties(pybind11)
# search for FindPython3.cmake instead of legacy modules
set(PYBIND11_FINDPYTHON ON)

# Wouraround Python_VERSION_MAJOR and MINOR not being set by finding
# Python package instead of Python3
macro(ov_find_python_no_3 find_package_mode)
# Settings for FindPython3.cmake
if(NOT DEFINED Python3_USE_STATIC_LIBS)
set(Python3_USE_STATIC_LIBS OFF)
endif()

if(NOT DEFINED Python3_FIND_VIRTUALENV)
set(Python3_FIND_VIRTUALENV FIRST)
endif()

if(NOT DEFINED Python3_FIND_IMPLEMENTATIONS)
set(Python3_FIND_IMPLEMENTATIONS CPython PyPy)
endif()

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
set(python3_development_component Development.Module)
else()
set(python3_development_component Development)
endif()

if(CMAKE_CROSSCOMPILING AND LINUX)
# allow to find python headers from host in case of cross-compilation
# e.g. install libpython3-dev:<foreign arch> and finds its headers
set(_old_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE})
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
ov_cross_compile_define_debian_arch()
endif()

find_package(Python ${find_package_mode} COMPONENTS Interpreter ${python3_development_component})

if(CMAKE_CROSSCOMPILING AND LINUX)
ov_cross_compile_define_debian_arch_reset()
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ${_old_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE})
endif()

unset(python3_development_component)
endmacro()

# the following two calls are required for cross-compilation
if(OpenVINODeveloperPackage_DIR)
ov_find_python_no_3(REQUIRED)
ov_find_python3(REQUIRED)
ov_detect_python_module_extension()
else()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
Expand Down
Loading