Automatically detect ENABLE_PYTHON, ENABLE_WHEEL default values (#12551)

* Add ENABLE_WHEEL=ON by default

* Adjust CMake options for GitHub checks

* Add ov_check_pip_package and ov_check_pip_packages CMake functions

* revert options

* skip empty lines

* formatting

* fix condition

* check for patchelf

* Add numpy dependency to condition

* Fix error:

    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (gast 0.4.0 (c:\hostedtoolcache\windows\python\3.7.6\x64\lib\site-packages), Requirement.parse('gast==0.3.3; platform_system == "Windows"'), {'paddlepaddle'})

* set DENABLE_WHEEL=OFF for openvino-onnx docker

* Supported newer versions of shellcheck

* Don't use excluded sources

* Improved NCC process of clang search

* Fixes

* A lot of updates

* Fixes after 2 PRs merge

* Fixed build

* Fixes

* Relaxed cython version a bit

* Try non-pip cython as well

* Fixed MacOsX

* Disable pybind usage for MO tests as well

* Added descriptive warning messages

* Fixed compilation on Windows

* Support for cmake < 3.15

* FIxed Windows linkage

* Fixed review comments

Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com>
This commit is contained in:
Ilya Lavrenov
2022-08-16 14:43:30 +04:00
committed by GitHub
parent d8237cd97c
commit 2e7284cfa0
24 changed files with 260 additions and 119 deletions

View File

@@ -275,46 +275,7 @@ function(ov_mark_target_as_cc)
ie_mark_target_as_cc(${ARGN})
endfunction()
# check python package
function(ie_check_pip_package full_name message_type)
find_package(PythonInterp 3 REQUIRED)
get_filename_component(PYTHON_EXEC_DIR ${PYTHON_EXECUTABLE} DIRECTORY)
# extract version if any
if(full_name MATCHES "^([a-z_]+)[~=<>!]*(.*)$")
set(name ${CMAKE_MATCH_1})
set(req_version ${CMAKE_MATCH_2})
else()
set(name ${full_name})
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -m pip show ${name}
WORKING_DIRECTORY ${PYTHON_EXEC_DIR}
RESULT_VARIABLE PIP_EXIT_CODE
OUTPUT_VARIABLE output)
if(NOT PIP_EXIT_CODE EQUAL 0)
set(${name}_FOUND OFF PARENT_SCOPE)
message(${message_type} "${name} package is not installed. Please use \"${PYTHON_EXECUTABLE} -m pip install ${full_name}\".")
else()
if(req_version)
string(REGEX MATCH "Version: ([0-9]+\.?[0-9]*\.?[0-9]*)\n" installed_version "${output}")
if(installed_version)
set(installed_version "${CMAKE_MATCH_1}")
endif()
if(NOT req_version STREQUAL installed_version)
message(${message_type} "${name} package is installed, but may have different version (${installed_version}). "
"Please use \"${PYTHON_EXECUTABLE} -m pip install ${full_name}\".")
endif()
else()
set(${name}_FOUND ON PARENT_SCOPE)
endif()
endif()
endfunction()
include(python_requirements)
# Code style utils