Enable make install for openvino/tools folder (#5326)

* enable make install for openvino/tools folder

* fix component name

* use python_tools as component name

* update ie_cpack_add_component name

* enable CPack for python tools

* use find_package(PythonInterp)
This commit is contained in:
Sergey Lyubimtsev 2021-04-26 18:06:39 +03:00 committed by GitHub
parent e15d9efe30
commit 5912c983d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 23 deletions

View File

@ -148,6 +148,7 @@ build_ngraph()
add_subdirectory(inference-engine)
add_subdirectory(model-optimizer)
add_subdirectory(docs)
add_subdirectory(tools)
#
# Shellcheck

View File

@ -67,14 +67,6 @@ add_custom_command(TARGET ${TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_BRIDGE_SRC_ROOT}/src/openvino/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../__init__.py
)
# creates a folder in openvino directory and a symlink to benchmark
# inside bin directory for developers for running python benchmark_app
add_custom_command(TARGET ${TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../tools
COMMAND ${CMAKE_COMMAND} -E copy_directory ${OpenVINO_MAIN_SOURCE_DIR}/tools/benchmark ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/../tools/benchmark
)
# install
install(TARGETS ${INSTALLED_TARGETS}

View File

@ -3,19 +3,4 @@
#
add_subdirectory(vpu)
add_subdirectory(compile_tool)
# install
if(ENABLE_PYTHON)
ie_cpack_add_component(python_tools DEPENDS core)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/benchmark_tool
DESTINATION deployment_tools/tools
COMPONENT python_tools)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cross_check_tool
DESTINATION deployment_tools/tools
COMPONENT python_tools)
endif()

55
tools/CMakeLists.txt Normal file
View File

@ -0,0 +1,55 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13)
project(python_tools)
if(NOT DEFINED OpenVINO_MAIN_SOURCE_DIR)
find_package(InferenceEngineDeveloperPackage QUIET)
endif()
find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
set(PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
else()
message(FATAL_ERROR "Python Interpreter was not found!")
endif()
set(TARGET_NAME "python_tools")
if(WIN32)
set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<CONFIG>/python_api/${PYTHON_VERSION}/openvino)
else()
set(PYTHON_BRIDGE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/python_api/${PYTHON_VERSION}/openvino)
endif()
if(ENABLE_PYTHON)
# creates a copy inside bin directory for developers to have ability running python benchmark_app
add_custom_target(${TARGET_NAME} ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools
COMMAND ${CMAKE_COMMAND} -E copy_directory ${OpenVINO_MAIN_SOURCE_DIR}/tools/benchmark ${PYTHON_BRIDGE_OUTPUT_DIRECTORY}/tools/benchmark
)
ie_cpack_add_component(python_tools_${PYTHON_VERSION})
ie_cpack_add_component(python_tools)
install(DIRECTORY ../inference-engine/tools/benchmark_tool
DESTINATION deployment_tools/tools
COMPONENT python_tools)
install(DIRECTORY ../inference-engine/tools/cross_check_tool
DESTINATION deployment_tools/tools
COMPONENT python_tools)
install(FILES README.md
DESTINATION python/${PYTHON_VERSION}/openvino/tools
COMPONENT python_tools_${PYTHON_VERSION})
install(DIRECTORY benchmark/
DESTINATION python/${PYTHON_VERSION}/openvino/tools
USE_SOURCE_PERMISSIONS
COMPONENT python_tools_${PYTHON_VERSION})
ie_cpack(python_tools python_tools_${PYTHON_VERSION})
endif()