From 5a52a8e4a3b5b00cf4a2ce5a6c742e17e1c1839a Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 1 Dec 2021 14:34:50 +0300 Subject: [PATCH] Don't install content of openvino-dev; install wheels (#8820) * Don't install content of openvino-dev * Install MO in tests * Install python's BA tool only for tests --- CMakeLists.txt | 3 -- cmake/features.cmake | 5 ++ .../ie_bridges/python/CMakeLists.txt | 2 - .../offline_transformations/CMakeLists.txt | 3 -- .../ie_bridges/python/wheel/CMakeLists.txt | 8 ++++ model-optimizer/CMakeLists.txt | 23 +++++---- .../src/compatibility/pyngraph/CMakeLists.txt | 7 +-- .../python/src/pyopenvino/CMakeLists.txt | 7 +-- src/core/CMakeLists.txt | 3 ++ tools/CMakeLists.txt | 47 +++++++++---------- tools/openvino_dev/CMakeLists.txt | 8 ++++ 11 files changed, 58 insertions(+), 58 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 876264d863b..bab89e1e0db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,9 +86,6 @@ function(openvino_developer_export_targets) "A list of OpenVINO exported components" FORCE) endfunction() -ie_cpack_add_component(ngraph REQUIRED) -ie_cpack_add_component(ngraph_dev REQUIRED DEPENDS ngraph) - # add target with processed tests model zoo include(cmake/test_model_zoo.cmake) diff --git a/cmake/features.cmake b/cmake/features.cmake index f1521229ca8..4e17d853d3f 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -50,6 +50,11 @@ ie_dependent_option (ENABLE_PYTHON "enables ie python bridge build" OFF "PYTHONL find_package(PythonInterp 3 QUIET) ie_dependent_option (ENABLE_DOCS "Build docs using Doxygen" OFF "PYTHONINTERP_FOUND" OFF) +# this option should not be a part of InferenceEngineDeveloperPackage +# since wheels can be built only together with main OV build +cmake_dependent_option (ENABLE_WHEEL "Build wheel packages for PyPi" OFF + "PYTHONINTERP_FOUND;CMAKE_SOURCE_DIR STREQUAL OpenVINO_SOURCE_DIR" OFF) + # # Inference Engine specific options # diff --git a/inference-engine/ie_bridges/python/CMakeLists.txt b/inference-engine/ie_bridges/python/CMakeLists.txt index 4fbdf01e2da..ac9a310c721 100644 --- a/inference-engine/ie_bridges/python/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/CMakeLists.txt @@ -13,8 +13,6 @@ if(NOT DEFINED OpenVINO_SOURCE_DIR) endif() option(ENABLE_CONDA_FOLDER "Create output folder with conda python bindings" OFF) -cmake_dependent_option(ENABLE_WHEEL "Create wheel package" OFF - "PYTHONINTERP_FOUND;NOT CMAKE_SOURCE_DIR STREQUAL ie_python_api_SOURCE_DIR" OFF) set(PYTHON_BRIDGE_CPACK_PATH "python") diff --git a/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt index 72a69fb5904..e8526a96258 100644 --- a/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt @@ -55,9 +55,6 @@ add_custom_command(TARGET ${TARGET_NAME} # install -# TODO: use ${PYTHON_VERSION}_dev component below -# ie_cpack_add_component(${PYTHON_VERSION}_dev DEPENDS ${PYTHON_COMPONENT}) - install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${PYTHON_BRIDGE_CPACK_PATH}/${PYTHON_VERSION}/openvino/offline_transformations COMPONENT ${PYTHON_COMPONENT} LIBRARY DESTINATION ${PYTHON_BRIDGE_CPACK_PATH}/${PYTHON_VERSION}/openvino/offline_transformations COMPONENT ${PYTHON_COMPONENT}) diff --git a/inference-engine/ie_bridges/python/wheel/CMakeLists.txt b/inference-engine/ie_bridges/python/wheel/CMakeLists.txt index 61d4a5bf2f5..8ebcc215fd9 100644 --- a/inference-engine/ie_bridges/python/wheel/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/wheel/CMakeLists.txt @@ -71,3 +71,11 @@ add_custom_command(OUTPUT ${openvino_wheel_path} VERBATIM) add_custom_target(ie_wheel ALL DEPENDS ${openvino_wheel_path}) + +# install + +ie_cpack_add_component(python_wheels) + +install(FILES ${openvino_wheel_path} + DESTINATION tools + COMPONENT python_wheels) diff --git a/model-optimizer/CMakeLists.txt b/model-optimizer/CMakeLists.txt index 648707fda1b..8e95e364adf 100644 --- a/model-optimizer/CMakeLists.txt +++ b/model-optimizer/CMakeLists.txt @@ -6,26 +6,26 @@ if(NOT ENABLE_PYTHON) else() add_custom_target(model_optimizer DEPENDS ie_api offline_transformations_api ir_ov_frontend) if(ENABLE_TESTS) - add_subdirectory(unit_tests/mock_mo_frontend/mock_mo_ov_frontend) - add_dependencies(model_optimizer mock_mo_ov_frontend) + add_subdirectory(unit_tests/mock_mo_frontend/mock_mo_ov_frontend) + add_dependencies(model_optimizer mock_mo_ov_frontend) - add_subdirectory(unit_tests/mock_mo_frontend/mock_mo_python_api) - add_dependencies(model_optimizer mock_mo_python_api) + add_subdirectory(unit_tests/mock_mo_frontend/mock_mo_python_api) + add_dependencies(model_optimizer mock_mo_python_api) endif() endif() # install -ie_cpack_add_component(model_optimizer) -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/automation/version.txt.in" - "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" - @ONLY) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/automation/version.txt.in" + "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" @ONLY) + +# ie_cpack_add_component(model_optimizer) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION tools/model_optimizer USE_SOURCE_PERMISSIONS - COMPONENT model_optimizer + COMPONENT tests + EXCLUDE_FROM_ALL PATTERN ".*" EXCLUDE PATTERN "automation" EXCLUDE PATTERN "requirements_dev.txt" EXCLUDE @@ -42,8 +42,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ REGEX ".*\\.pyc$" EXCLUDE REGEX ".*\\.swp" EXCLUDE REGEX ".*\\.DS_Store$" EXCLUDE - REGEX ".*_test\.py$" EXCLUDE - ) + REGEX ".*_test\.py$" EXCLUDE) install(FILES requirements_dev.txt DESTINATION tests/model_optimizer diff --git a/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt b/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt index 6d9306a95a8..b75e01bf30f 100644 --- a/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt +++ b/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt @@ -65,10 +65,7 @@ if(OpenVINO_SOURCE_DIR) endif() if(OpenVINO_SOURCE_DIR OR InferenceEngineDeveloperPackage_FOUND) - if(COMMAND ie_python_minimal_api) - ie_python_minimal_api(_${PROJECT_NAME}) - endif() - + ie_python_minimal_api(_${PROJECT_NAME}) add_clang_format_target(_${PROJECT_NAME}_clang FOR_TARGETS _${PROJECT_NAME}) ie_cpack_add_component(pyngraph_${PYTHON_VERSION}) @@ -85,6 +82,4 @@ if(OpenVINO_SOURCE_DIR OR InferenceEngineDeveloperPackage_FOUND) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../../tests DESTINATION tests/${PROJECT_NAME} COMPONENT tests EXCLUDE_FROM_ALL) - - ie_cpack(pyngraph_${PYTHON_VERSION}) endif() diff --git a/src/bindings/python/src/pyopenvino/CMakeLists.txt b/src/bindings/python/src/pyopenvino/CMakeLists.txt index 7b377180f9e..5e7c5b12b19 100644 --- a/src/bindings/python/src/pyopenvino/CMakeLists.txt +++ b/src/bindings/python/src/pyopenvino/CMakeLists.txt @@ -48,10 +48,7 @@ if(OpenVINO_SOURCE_DIR) endif() if(OpenVINO_SOURCE_DIR OR InferenceEngineDeveloperPackage_FOUND) - if(COMMAND ie_python_minimal_api) - ie_python_minimal_api(${PROJECT_NAME}) - endif() - + ie_python_minimal_api(${PROJECT_NAME}) add_clang_format_target(${PROJECT_NAME}_clang FOR_TARGETS ${PROJECT_NAME}) ie_cpack_add_component(pyopenvino_${PYTHON_VERSION}) @@ -64,8 +61,6 @@ if(OpenVINO_SOURCE_DIR OR InferenceEngineDeveloperPackage_FOUND) install(TARGETS ${PROJECT_NAME} DESTINATION python/${PYTHON_VERSION}/openvino COMPONENT pyopenvino_${PYTHON_VERSION}) - - ie_cpack(pyopenvino_${PYTHON_VERSION}) endif() if(TARGET ie_wheel) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e28b939a82d..4cbb338d9e7 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -122,6 +122,9 @@ export(TARGETS ngraph NAMESPACE openvino:: # Installation logic... #----------------------------------------------------------------------------------------------- +ie_cpack_add_component(ngraph REQUIRED) +ie_cpack_add_component(ngraph_dev REQUIRED DEPENDS ngraph) + install(TARGETS ngraph EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index fb4dd45ca85..5f2c194563f 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,31 +1,27 @@ # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.13) - -project(OpenVINO_Tools DESCRIPTION "OpenVINO toolkit Development Tools") - -if(NOT DEFINED OpenVINO_SOURCE_DIR) - find_package(InferenceEngineDeveloperPackage QUIET) - set(python_tools_only ON) -endif() - +# # C++ tools +# -if(NOT python_tools_only) - add_subdirectory(compile_tool) -endif() +add_subdirectory(compile_tool) +# # Python tools +# # install deployment_manager ie_cpack_add_component(deployment_manager REQUIRED) + install(DIRECTORY deployment_manager DESTINATION tools COMPONENT deployment_manager USE_SOURCE_PERMISSIONS) +# copy benchmark_app scripts + if(ENABLE_PYTHON) find_package(PythonInterp 3 REQUIRED) set(PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) @@ -43,29 +39,28 @@ if(ENABLE_PYTHON) ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools/benchmark ) - ie_cpack_add_component(python_tools_${PYTHON_VERSION}) - ie_cpack_add_component(python_tools) - - # install benchmark_app tool + # install BA tool for tests install(FILES benchmark_tool/README.md benchmark_tool/requirements.txt DESTINATION tools/benchmark_tool - COMPONENT python_tools) + COMPONENT tests + EXCLUDE_FROM_ALL) install(PROGRAMS benchmark_tool/benchmark_app.py DESTINATION tools/benchmark_tool - COMPONENT python_tools) + COMPONENT tests + EXCLUDE_FROM_ALL) # install openvino/tools/benchmark as a python package install(DIRECTORY benchmark_tool/openvino/tools/benchmark DESTINATION python/${PYTHON_VERSION}/openvino/tools USE_SOURCE_PERMISSIONS - COMPONENT python_tools_${PYTHON_VERSION}) - - ie_cpack(python_tools python_tools_${PYTHON_VERSION}) - - if(ENABLE_WHEEL) - add_subdirectory(openvino_dev) - endif() - + COMPONENT tests + EXCLUDE_FROM_ALL) +endif() + +# build and install openvino-dev wheel + +if(ENABLE_WHEEL) + add_subdirectory(openvino_dev) endif() diff --git a/tools/openvino_dev/CMakeLists.txt b/tools/openvino_dev/CMakeLists.txt index 0418784dd52..3bb65604074 100644 --- a/tools/openvino_dev/CMakeLists.txt +++ b/tools/openvino_dev/CMakeLists.txt @@ -20,3 +20,11 @@ add_custom_command(OUTPUT ${openvino_wheel_path} VERBATIM) add_custom_target(openvino_dev_wheel ALL DEPENDS ${openvino_wheel_path}) + +# install + +ie_cpack_add_component(python_wheels) + +install(FILES ${openvino_wheel_path} + DESTINATION tools + COMPONENT python_wheels)