* Partial progress * Finish v1 * Cleanup * Remove useless files * Fix path to pdpd * Fix onnx path * Minor change * Rework MO * Minor change * Remove some costraints * Add MO constraints * Update gitignore for MO * Minor change * Apply tech sync discussion * Cleanup * CR comment * Debug ONNX FE * simplify ONNX FE * Update cmake * Hardcode ONNX requirement * Add dependency resolver to cmake * Add constraints for openvino/tests * Add missing pytest-html * Fix -c path * Revert debug changes to path * Add cmake to copy constraints.txt * Update dependabot * Remove slash * Remove cmake * Debug prints * Minor changes * Move reqs check to separate file * Add requirements parser to benchmark_tool * Fix smoke tests constraints * Minor fixes * Minor change * My fixes were apparently wrong * Debug - self.executable_path * Debug - add singledispatch to tests and tools * Debug - print IE_APP_PATHs * Revert "Debug - print IE_APP_PATHs" This reverts commit67ccb6d3f5. * Revert "Debug - add singledispatch to tests and tools" This reverts commit3b945931e2. * Revert "Debug - self.executable_path" This reverts commit3aa724eff6. * update dependabot * update dependabot * Skip benchmark_app tests * Use CMAKE_CURRENT_BINARY_DIR in cmake * Remove debug prints * minor change --------- Signed-off-by: p-wysocki <przemyslaw.wysocki@intel.com>
117 lines
4.0 KiB
CMake
117 lines
4.0 KiB
CMake
# Copyright (C) 2018-2023 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
#
|
|
# ov_check_pip_package(REQUIREMENT <single requirement>
|
|
# RESULT_VAR <result var name>
|
|
# [WARNING_MESSAGE <message>]
|
|
# [MESSAGE_MODE <WARNING | FATAL_ERROR | TRACE>])
|
|
#
|
|
function(ov_check_pip_package)
|
|
find_host_package(PythonInterp 3 QUIET)
|
|
|
|
set(oneValueOptionalArgs
|
|
MESSAGE_MODE # Set the type of message: { FATAL_ERROR | WARNING | ... }
|
|
WARNING_MESSAGE # callback message
|
|
)
|
|
set(oneValueRequiredArgs
|
|
REQUIREMENT # Requirement-specifier to check
|
|
RESULT_VAR # Result varibale to set return code {ON | OFF}
|
|
)
|
|
set(multiValueArgs)
|
|
|
|
cmake_parse_arguments(ARG "" "${oneValueRequiredArgs};${oneValueOptionalArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
foreach(argName ${oneValueRequiredArgs})
|
|
if (NOT ARG_${argName})
|
|
message(SEND_ERROR "Argument '${argName}' is required.")
|
|
endif()
|
|
endforeach()
|
|
|
|
if(NOT ARG_MESSAGE_MODE)
|
|
set(ARG_MESSAGE_MODE WARNING)
|
|
elseif(CMAKE_VERSION VERSION_LESS 3.15 AND ARG_MESSAGE_MODE STREQUAL "TRACE")
|
|
set(ARG_MESSAGE_MODE WARNING)
|
|
endif()
|
|
|
|
if(ARG_UNPARSED_ARGUMENTS)
|
|
message(SEND_ERROR "Unexpected parameters have passed to the function: ${ARG_UNPARSED_ARGUMENTS}")
|
|
endif()
|
|
|
|
# quote '3.x' with \'3.x\'
|
|
string(REPLACE "'" "\\'" REQ "${ARG_REQUIREMENT}")
|
|
|
|
if(PYTHONINTERP_FOUND)
|
|
execute_process(
|
|
COMMAND ${PYTHON_EXECUTABLE} -c "import pkg_resources ; pkg_resources.require('${REQ}')"
|
|
RESULT_VARIABLE EXIT_CODE
|
|
OUTPUT_VARIABLE OUTPUT_TEXT
|
|
ERROR_VARIABLE ERROR_TEXT)
|
|
endif()
|
|
|
|
if(NOT EXIT_CODE EQUAL 0)
|
|
set(${ARG_RESULT_VAR} OFF PARENT_SCOPE)
|
|
message(${ARG_MESSAGE_MODE} "Python module '${REQ}' is missed, ${ARG_WARNING_MESSAGE}")
|
|
else()
|
|
set(${ARG_RESULT_VAR} ON PARENT_SCOPE)
|
|
endif()
|
|
endfunction()
|
|
|
|
#
|
|
# ov_check_pip_packages(REQUIREMENTS_FILE <requirements.txt file>
|
|
# RESULT_VAR <result var name>
|
|
# [WARNING_MESSAGE <message>]
|
|
# [MESSAGE_MODE <WARNING | FATAL_ERROR | TRACE>])
|
|
#
|
|
function(ov_check_pip_packages)
|
|
find_host_package(PythonInterp 3 QUIET)
|
|
|
|
set(oneValueOptionalArgs
|
|
MESSAGE_MODE # Set the type of message: { FATAL_ERROR | WARNING | ... }
|
|
WARNING_MESSAGE # callback message
|
|
)
|
|
set(oneValueRequiredArgs
|
|
REQUIREMENTS_FILE # File with requirement-specifiers to check
|
|
RESULT_VAR # Result varibale to set return code {ON | OFF}
|
|
)
|
|
set(multiValueArgs)
|
|
|
|
cmake_parse_arguments(ARG "" "${oneValueOptionalArgs};${oneValueRequiredArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
foreach(argName ${oneValueRequiredArgs})
|
|
if (NOT ARG_${argName})
|
|
message(SEND_ERROR "Argument '${argName}' is required.")
|
|
endif()
|
|
endforeach()
|
|
|
|
if(NOT ARG_MESSAGE_MODE)
|
|
set(ARG_MESSAGE_MODE WARNING)
|
|
elseif(CMAKE_VERSION VERSION_LESS 3.15 AND ARG_MESSAGE_MODE STREQUAL "TRACE")
|
|
set(ARG_MESSAGE_MODE WARNING)
|
|
endif()
|
|
|
|
if(ARG_UNPARSED_ARGUMENTS)
|
|
message(SEND_ERROR "Unexpected parameters have passed to the function: ${ARG_UNPARSED_ARGUMENTS}")
|
|
endif()
|
|
|
|
if(PYTHONINTERP_FOUND)
|
|
execute_process(
|
|
COMMAND ${PYTHON_EXECUTABLE} -c "
|
|
from check_python_requirements import check_python_requirements ;
|
|
check_python_requirements('${ARG_REQUIREMENTS_FILE}') ;
|
|
"
|
|
WORKING_DIRECTORY "${IEDevScripts_DIR}"
|
|
RESULT_VARIABLE EXIT_CODE
|
|
OUTPUT_VARIABLE OUTPUT_TEXT
|
|
ERROR_VARIABLE ERROR_TEXT)
|
|
endif()
|
|
|
|
if(NOT EXIT_CODE EQUAL 0)
|
|
set(${ARG_RESULT_VAR} OFF PARENT_SCOPE)
|
|
message(${ARG_MESSAGE_MODE} "Python requirement file ${ARG_REQUIREMENTS_FILE} is not installed, ${ARG_WARNING_MESSAGE}")
|
|
else()
|
|
set(${ARG_RESULT_VAR} ON PARENT_SCOPE)
|
|
endif()
|
|
endfunction()
|