From 6ae131c3984ccf66f43cfae172b097279bd432d1 Mon Sep 17 00:00:00 2001 From: y Date: Mon, 6 Sep 2021 14:43:28 +0300 Subject: [PATCH 01/31] Added OpenVINOConfig.cmake --- cmake/templates/OpenVINOConfig.cmake.in | 202 ++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 cmake/templates/OpenVINOConfig.cmake.in diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in new file mode 100644 index 00000000000000..b8da66e48714b9 --- /dev/null +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -0,0 +1,202 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# +# FindOpenVINO +# ------ +# +# Provides OpenVINO runtime for model creation and inference, frontend libraries +# to convert models from framework specific formats. +# +# The following components are supported: +# * `Runtime`: OpenVINO C++ and C runtimes, IR frontend +# * `ONNX`: OpenVINO ONNX frontend +# * `PaddlePaddle`: OpenVINO PaddlePaddle frontend +# +# If no components are specified, all components are provided: +# +# find_package(OpenVINO REQUIRED) +# +# If specific components are required: +# +# find_package(OpenVINO REQUIRED COMPONENTS Runtime ONNX) +# +# Imported Targets: +# ------ +# +# Runtime targets: +# +# `OpenVINO::Runtime` +# The OpenVINO C++ Runtime Core & Inference +# +# `OpenVINO::Runtime::C` +# The OpenVINO C Inference Runtime +# +# Frontend specific targets: +# +# `OpenVINO::Frontend::Manager` +# OpenVINO frontend manager +# +# `OpenVINO::Frontend::IR` +# IR FrontEnd target +# +# `OpenVINO::Frontend::ONNX` +# ONNX FrontEnd target (optional) +# +# `OpenVINO::Frontend::PaddlePaddle` +# PaddlePaddle FrontEnd target (optional) +# +# Result variables: +# ------ +# +# The module sets the following variables in your project: +# +# `OpenVINO_FOUND` +# System has OpenVINO Runtime installed +# +# `OpenVINO_Frontend_ONNX_FOUND` +# OpenVINO ONNX frontend is available +# +# `OpenVINO_Frontend_PaddlePaddle_FOUND` +# OpenVINO PaddlePaddle frontend is available +# +# OpenVINO version variables: +# +# `OpenVINO_VERSION_MAJOR` +# Major version component +# +# `OpenVINO_VERSION_MINOR` +# minor version component +# +# `OpenVINO_VERSION_PATCH` +# Patch version component +# + +@PACKAGE_INIT@ + +# +# Common functions +# + +if(NOT DEFINED CMAKE_FIND_PACKAGE_NAME) + set(CMAKE_FIND_PACKAGE_NAME OpenVINO) + set(_need_package_name_reset ON) +endif() + +# we have to use our own version of find_dependency because of support cmake 3.7 +macro(_ov_find_dependency dep) + set(cmake_fd_quiet_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(cmake_fd_quiet_arg QUIET) + endif() + set(cmake_fd_required_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(cmake_fd_required_arg REQUIRED) + endif() + + get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY + _CMAKE_${dep}_TRANSITIVE_DEPENDENCY) + + find_package(${dep} ${ARGN} + ${cmake_fd_quiet_arg} + ${cmake_fd_required_arg}) + + if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive) + set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) + endif() + + if(NOT ${dep}_FOUND) + set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.") + set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() + endif() + + set(cmake_fd_required_arg) + set(cmake_fd_quiet_arg) +endmacro() + +function(_ov_target_no_deprecation_error) + if(NOT MSVC) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set(flags "-diag-warning=1786") + else() + set(flags "-Wno-error=deprecated-declarations") + endif() + if(CMAKE_CROSSCOMPILING) + set_target_properties(${ARGV} PROPERTIES + INTERFACE_LINK_OPTIONS "-Wl,--allow-shlib-undefined") + endif() + + set_target_properties(${ARGV} PROPERTIES INTERFACE_COMPILE_OPTIONS ${flags}) + endif() +endfunction() + +# +# OpenVINO config +# + +# need to store current PACKAGE_PREFIX_DIR, because it's overwritten by sub-package one +set(OV_PACKAGE_PREFIX_DIR "${PACKAGE_PREFIX_DIR}") + +set(THREADING "@THREADING@") +if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND) + set_and_check(_tbb_dir "@PACKAGE_IE_TBB_DIR@") + _ov_find_dependency(TBB + COMPONENTS tbb tbbmalloc + CONFIG + PATHS ${TBBROOT}/cmake + ${_tbb_dir} + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) +endif() + +# TODO: remove in a new package structure +set_and_check(_ngraph_dir "@PACKAGE_IE_NGRAPH_DIR@") +_ov_find_dependency(ngraph + CONFIG + PATHS ${_ngraph_dir} + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + +# TODO: replace target +if(NOT TARGET inference_engine) + set(_ov_as_external_package ON) + include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake") +endif() + +# mark components as available +foreach(comp inference_engine inference_engine_c_api) + set(${CMAKE_FIND_PACKAGE_NAME}_${comp}_FOUND ON) +endforeach() + +if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS inference_engine inference_engine_c_api) +endif() + +unset(OpenVINO_LIBRARIES) +foreach(comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) + # check if the component is available + if(${CMAKE_FIND_PACKAGE_NAME}_${comp}_FOUND) + set(pcomp ${comp}) + if(_ov_as_external_package) + set(pcomp IE::${comp}) + endif() + + list(APPEND OpenVINO_LIBRARIES ${pcomp}) + endif() +endforeach() + +if(_ov_as_external_package) + _ov_target_no_deprecation_error(${OpenVINO_LIBRARIES}) +endif() +unset(_ov_as_external_package) + +# restore PACKAGE_PREFIX_DIR +set(PACKAGE_PREFIX_DIR ${OV_PACKAGE_PREFIX_DIR}) +unset(OV_PACKAGE_PREFIX_DIR) + +check_required_components(${CMAKE_FIND_PACKAGE_NAME}) + +if(_need_package_name_reset) + unset(CMAKE_FIND_PACKAGE_NAME) + unset(_need_package_name_reset) +endif() From 00e269e338d8a7b076c0ceff7a373e98c0c2c7f7 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 12:12:45 +0300 Subject: [PATCH 02/31] OpenVINOConfig.cmake part 2 --- CMakeLists.txt | 1 + cmake/templates/OpenVINOConfig.cmake.in | 73 ++++++++++--------- .../ie_bridges/c/src/CMakeLists.txt | 4 + .../src/inference_engine/CMakeLists.txt | 35 ++++++++- .../src/transformations/CMakeLists.txt | 5 ++ .../frontend/frontend_manager/CMakeLists.txt | 14 ++-- ngraph/frontend/ir/CMakeLists.txt | 13 ---- ngraph/frontend/onnx/frontend/CMakeLists.txt | 8 +- ngraph/frontend/paddlepaddle/CMakeLists.txt | 8 +- 9 files changed, 93 insertions(+), 68 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cec8d2d5e8d68..38433190be22b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE}) # remove file with exported developer targets to force its regeneration file(REMOVE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") +file(REMOVE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") foreach(component IN LISTS openvino_export_components) file(REMOVE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake") unset(${component} CACHE) diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in index b8da66e48714b9..3ffe8554f55559 100644 --- a/cmake/templates/OpenVINOConfig.cmake.in +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -8,13 +8,14 @@ # to convert models from framework specific formats. # # The following components are supported: -# * `Runtime`: OpenVINO C++ and C runtimes, IR frontend +# +# * `Runtime`: OpenVINO C++ and C Core & Inference Runtime, frontend manager # * `ONNX`: OpenVINO ONNX frontend # * `PaddlePaddle`: OpenVINO PaddlePaddle frontend # -# If no components are specified, all components are provided: +# If no components are specified, `Runtime` component is provided: # -# find_package(OpenVINO REQUIRED) +# find_package(OpenVINO REQUIRED) # only Runtime component # # If specific components are required: # @@ -25,24 +26,24 @@ # # Runtime targets: # -# `OpenVINO::Runtime` -# The OpenVINO C++ Runtime Core & Inference +# `openvino::runtime` +# The OpenVINO C++ Core & Inference Runtime # -# `OpenVINO::Runtime::C` +# `openvino::runtime::c` # The OpenVINO C Inference Runtime # +# `openvino::core` +# The OpenVINO C++ Core Runtime +# # Frontend specific targets: # -# `OpenVINO::Frontend::Manager` +# `openvino::frontend::manager` # OpenVINO frontend manager # -# `OpenVINO::Frontend::IR` -# IR FrontEnd target -# -# `OpenVINO::Frontend::ONNX` +# `openvino::frontend::onnx` # ONNX FrontEnd target (optional) # -# `OpenVINO::Frontend::PaddlePaddle` +# `openvino::frontend::paddlepaddle` # PaddlePaddle FrontEnd target (optional) # # Result variables: @@ -53,6 +54,9 @@ # `OpenVINO_FOUND` # System has OpenVINO Runtime installed # +# `OpenVINO_Runtime_FOUND` +# OpenVINO C++ Core & Inference Runtime is available +# # `OpenVINO_Frontend_ONNX_FOUND` # OpenVINO ONNX frontend is available # @@ -135,7 +139,7 @@ endfunction() # # need to store current PACKAGE_PREFIX_DIR, because it's overwritten by sub-package one -set(OV_PACKAGE_PREFIX_DIR "${PACKAGE_PREFIX_DIR}") +set(_ov_package_prefix_dir "${PACKAGE_PREFIX_DIR}") set(THREADING "@THREADING@") if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND) @@ -149,50 +153,47 @@ if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND) NO_DEFAULT_PATH) endif() -# TODO: remove in a new package structure -set_and_check(_ngraph_dir "@PACKAGE_IE_NGRAPH_DIR@") -_ov_find_dependency(ngraph - CONFIG - PATHS ${_ngraph_dir} - NO_CMAKE_FIND_ROOT_PATH - NO_DEFAULT_PATH) - -# TODO: replace target if(NOT TARGET inference_engine) set(_ov_as_external_package ON) include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake") endif() -# mark components as available -foreach(comp inference_engine inference_engine_c_api) - set(${CMAKE_FIND_PACKAGE_NAME}_${comp}_FOUND ON) -endforeach() +# +# Components +# +set(${CMAKE_FIND_PACKAGE_NAME}_Runtime_FOUND ON) + +set(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@) +set(${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND @NGRAPH_PDPD_FRONTEND_ENABLE@) + +# if no components specified, only Runtime is provided if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) - set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS inference_engine inference_engine_c_api) + set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS Runtime) endif() -unset(OpenVINO_LIBRARIES) +# +# Apply common functions +# + +unset(_openvino_libraries) foreach(comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) # check if the component is available if(${CMAKE_FIND_PACKAGE_NAME}_${comp}_FOUND) set(pcomp ${comp}) if(_ov_as_external_package) - set(pcomp IE::${comp}) + set(pcomp openvino::${comp}) endif() - list(APPEND OpenVINO_LIBRARIES ${pcomp}) + list(APPEND _openvino_libraries ${pcomp}) + _ov_target_no_deprecation_error(${_openvino_libraries}) endif() endforeach() - -if(_ov_as_external_package) - _ov_target_no_deprecation_error(${OpenVINO_LIBRARIES}) -endif() unset(_ov_as_external_package) # restore PACKAGE_PREFIX_DIR -set(PACKAGE_PREFIX_DIR ${OV_PACKAGE_PREFIX_DIR}) -unset(OV_PACKAGE_PREFIX_DIR) +set(PACKAGE_PREFIX_DIR ${_ov_package_prefix_dir}) +unset(_ov_package_prefix_dir) check_required_components(${CMAKE_FIND_PACKAGE_NAME}) diff --git a/inference-engine/ie_bridges/c/src/CMakeLists.txt b/inference-engine/ie_bridges/c/src/CMakeLists.txt index a0e1b3469c937a..438078833556e1 100644 --- a/inference-engine/ie_bridges/c/src/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/src/CMakeLists.txt @@ -29,6 +29,10 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} export(TARGETS ${TARGET_NAME} NAMESPACE IE:: APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") +set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime::c) +export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") + # install ie_cpack_add_component(core_c DEPENDS core) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index e79a57093669c8..5533ffac4f45bd 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -221,10 +221,14 @@ set_target_properties(${TARGET_NAME}_s PROPERTIES EXCLUDE_FROM_ALL ON) set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) -# Export for build tree +# Export for build tree (WA for cmake) export(TARGETS ngraph ${TARGET_NAME} NAMESPACE IE:: - APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") + APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") + +set_target_properties(ngraph PROPERTIES EXPORT_NAME core) +export(TARGETS ngraph ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") # Export for developer package @@ -283,6 +287,12 @@ install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) +set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime) +install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) + install(FILES $/plugins.xml DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core) @@ -304,6 +314,12 @@ install(EXPORT InferenceEngineTargets DESTINATION ${IE_CPACK_IE_DIR}/share COMPONENT core_dev) +install(EXPORT OpenVINOTargets + FILE OpenVINOTargets.cmake + NAMESPACE openvino:: + DESTINATION ${IE_CPACK_IE_DIR}/share + COMPONENT core_dev) + set(IE_NGRAPH_DIR "${CMAKE_BINARY_DIR}/ngraph") set(IE_INCLUDE_DIR "${PUBLIC_HEADERS_DIR}/ie") set(IE_PARALLEL_CMAKE "${InferenceEngine_SOURCE_DIR}/cmake/ie_parallel.cmake") @@ -313,6 +329,11 @@ configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceE INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}" PATH_VARS ${PATH_VARS}) +configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig.cmake.in" + "${CMAKE_BINARY_DIR}/OpenVINOConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}" + PATH_VARS ${PATH_VARS}) + set(IE_INCLUDE_DIR "include/ie") set(IE_NGRAPH_DIR "../ngraph/cmake") set(IE_TBB_DIR "${IE_TBB_DIR_INSTALL}") @@ -323,9 +344,15 @@ configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceE INSTALL_DESTINATION share PATH_VARS ${PATH_VARS}) +configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig.cmake.in" + "${CMAKE_BINARY_DIR}/share/OpenVINOConfig.cmake" + INSTALL_DESTINATION share + PATH_VARS ${PATH_VARS}) + configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in" - "${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" - @ONLY) + "${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" @ONLY) +configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in" + "${CMAKE_BINARY_DIR}/OpenVINOConfig-version.cmake" @ONLY) install(FILES "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake" "${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" diff --git a/inference-engine/src/transformations/CMakeLists.txt b/inference-engine/src/transformations/CMakeLists.txt index bf4a4f31d6ae69..cf686b54e5bda0 100644 --- a/inference-engine/src/transformations/CMakeLists.txt +++ b/inference-engine/src/transformations/CMakeLists.txt @@ -53,3 +53,8 @@ install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) + +install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) diff --git a/ngraph/frontend/frontend_manager/CMakeLists.txt b/ngraph/frontend/frontend_manager/CMakeLists.txt index cdb93d5fc0f342..8e028a91df3a32 100644 --- a/ngraph/frontend/frontend_manager/CMakeLists.txt +++ b/ngraph/frontend/frontend_manager/CMakeLists.txt @@ -48,14 +48,14 @@ endif() # Installation rules for shared version only -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) +# install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets +# RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph +# ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph +# LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/frontend_manager - DESTINATION ${FRONTEND_INSTALL_INCLUDE} - COMPONENT ngraph_dev - FILES_MATCHING PATTERN "*.hpp") + DESTINATION ${FRONTEND_INSTALL_INCLUDE} + COMPONENT ngraph_dev + FILES_MATCHING PATTERN "*.hpp") export(TARGETS ${TARGET_NAME} NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") diff --git a/ngraph/frontend/ir/CMakeLists.txt b/ngraph/frontend/ir/CMakeLists.txt index 181bfda9d62e07..d3ece57ce36180 100644 --- a/ngraph/frontend/ir/CMakeLists.txt +++ b/ngraph/frontend/ir/CMakeLists.txt @@ -46,16 +46,3 @@ target_link_libraries(${TARGET_NAME} PRIVATE ngraph::frontend_manager::static add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) - -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) - -install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/ir_frontend - DESTINATION ${FRONTEND_INSTALL_INCLUDE} - COMPONENT ngraph_dev - FILES_MATCHING PATTERN "*.hpp" -) - -export(TARGETS ${TARGET_NAME} NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") diff --git a/ngraph/frontend/onnx/frontend/CMakeLists.txt b/ngraph/frontend/onnx/frontend/CMakeLists.txt index ad830d0ddbc6cb..a609d291e70b50 100644 --- a/ngraph/frontend/onnx/frontend/CMakeLists.txt +++ b/ngraph/frontend/onnx/frontend/CMakeLists.txt @@ -55,10 +55,10 @@ if(NGRAPH_USE_PROTOBUF_LITE) target_compile_definitions(onnx_ngraph_frontend PRIVATE NGRAPH_USE_PROTOBUF_LITE) endif() -install(TARGETS onnx_ngraph_frontend EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) +# install(TARGETS onnx_ngraph_frontend EXPORT ngraphTargets +# RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph +# ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph +# LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) install(DIRECTORY ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_frontend ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_import diff --git a/ngraph/frontend/paddlepaddle/CMakeLists.txt b/ngraph/frontend/paddlepaddle/CMakeLists.txt index 75a99e1e3855de..6f61d03d9b41e8 100644 --- a/ngraph/frontend/paddlepaddle/CMakeLists.txt +++ b/ngraph/frontend/paddlepaddle/CMakeLists.txt @@ -81,10 +81,10 @@ target_link_libraries(${TARGET_NAME} PRIVATE ngraph::frontend_manager::static add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) +# install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets +# RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph +# ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph +# LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/paddlepaddle_frontend DESTINATION ${FRONTEND_INSTALL_INCLUDE} From b84a30ee20838959e6728b9d9511ecb122ee9b5b Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 13:12:05 +0300 Subject: [PATCH 03/31] Trying to fix cmake generation --- .../templates/InferenceEngineConfig.cmake.in | 19 +++++++++++ .../templates/OpenVINOConfig-version.cmake.in | 21 ++++++++++++ cmake/templates/ngraphConfig.cmake.in | 23 ++++++++++++- .../ie_bridges/c/src/CMakeLists.txt | 10 ++++-- .../src/inference_engine/CMakeLists.txt | 17 +++------- ngraph/core/CMakeLists.txt | 32 +++++++++++++++++-- 6 files changed, 103 insertions(+), 19 deletions(-) create mode 100644 cmake/templates/OpenVINOConfig-version.cmake.in diff --git a/cmake/templates/InferenceEngineConfig.cmake.in b/cmake/templates/InferenceEngineConfig.cmake.in index 43408483f9af6e..c14e4f18ced82f 100644 --- a/cmake/templates/InferenceEngineConfig.cmake.in +++ b/cmake/templates/InferenceEngineConfig.cmake.in @@ -111,6 +111,25 @@ _ie_find_dependency(ngraph if(NOT TARGET inference_engine) set(_ie_as_external_package ON) include("${CMAKE_CURRENT_LIST_DIR}/InferenceEngineTargets.cmake") + + # create targets with old names for compatibility + if(TARGET IE::runtime AND NOT TARGET IE::inference_engine) + add_library(IE::inference_engine INTERFACE IMPORTED) + set_target_properties(IE::inference_engine PROPERTIES + INTERFACE_LINK_LIBRARIES IE::runtime) + endif() + + if(TARGET IE::core AND NOT TARGET ngraph::ngraph) + add_library(IE::ngraph INTERFACE IMPORTED) + set_target_properties(IE::ngraph PROPERTIES + INTERFACE_LINK_LIBRARIES IE::core) + endif() + + if(TARGET IE::runtime::c AND NOT TARGET IE::inference_engine_c) + add_library(IE::inference_engine_c INTERFACE IMPORTED) + set_target_properties(IE::inference_engine_c PROPERTIES + INTERFACE_LINK_LIBRARIES IE::runtime::c) + endif() endif() # mark components as available diff --git a/cmake/templates/OpenVINOConfig-version.cmake.in b/cmake/templates/OpenVINOConfig-version.cmake.in new file mode 100644 index 00000000000000..4e42995a83013f --- /dev/null +++ b/cmake/templates/OpenVINOConfig-version.cmake.in @@ -0,0 +1,21 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +set(PACKAGE_VERSION_MAJOR @IE_VERSION_MAJOR@) +set(PACKAGE_VERSION_MINOR @IE_VERSION_MINOR@) +set(PACKAGE_VERSION_PATCH @IE_VERSION_PATCH@) +set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}") + +set(PACKAGE_VERSION_EXACT False) +set(PACKAGE_VERSION_COMPATIBLE False) + +if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT True) + set(PACKAGE_VERSION_COMPATIBLE True) +endif() + +if(PACKAGE_FIND_VERSION_MAJOR EQUAL PACKAGE_VERSION_MAJOR AND + PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION) + set(PACKAGE_VERSION_COMPATIBLE True) +endif() diff --git a/cmake/templates/ngraphConfig.cmake.in b/cmake/templates/ngraphConfig.cmake.in index 1c17cbeb4cc49a..051fe5c229e123 100644 --- a/cmake/templates/ngraphConfig.cmake.in +++ b/cmake/templates/ngraphConfig.cmake.in @@ -39,6 +39,28 @@ if(NOT TARGET ngraph) include("${CMAKE_CURRENT_LIST_DIR}/ngraphTargets.cmake") + + # create targets with old names for compatibility + set(core ngraph) + set(frontend_manager frontend_manager) + set(frontendXonnx onnx_ngraph_frontend) + set(frontendXpaddlepaddle paddlepaddle_ngraph_frontend) + + #foreach(target core frontend_manager frontendXonnx frontendXpaddlepaddle) + # string(REPLACE "X" "::" patched_target ${target}) + # if(TARGET ngraph::${patched_target}) + # set(new_target ngraph::${target}) + # add_library(${new_target} INTERFACE IMPORTED) + # set_target_properties(${new_target} PROPERTIES + # INTERFACE_LINK_LIBRARIES ngraph::${patched_target}) + # endif() + #endforeach() + + if(TARGET ngraph::core AND NOT TARGET ngraph::ngraph) + add_library(ngraph::ngraph INTERFACE IMPORTED) + set_target_properties(ngraph::ngraph PROPERTIES + INTERFACE_LINK_LIBRARIES ngraph::core) + endif() endif() set(ngraph_ngraph_FOUND ON) @@ -59,6 +81,5 @@ if(ngraph_onnx_importer_FOUND) endif() set(ngraph_paddlepaddle_frontend_FOUND @NGRAPH_PDPD_FRONTEND_ENABLE@) -set(ir_frontend_FOUND @IR_FRONTEND_ENABLE@) check_required_components(ngraph) diff --git a/inference-engine/ie_bridges/c/src/CMakeLists.txt b/inference-engine/ie_bridges/c/src/CMakeLists.txt index 438078833556e1..781e9164e4863e 100644 --- a/inference-engine/ie_bridges/c/src/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/src/CMakeLists.txt @@ -14,7 +14,6 @@ add_library(${TARGET_NAME} SHARED ${HEADERS} ${SOURCES}) target_link_libraries(${TARGET_NAME} PRIVATE inference_engine) target_include_directories(${TARGET_NAME} PUBLIC - $ $) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) @@ -41,7 +40,14 @@ ie_cpack_add_component(core_c_dev DEPENDS core_c) install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core_c ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core_c - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core_c) + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core_c + INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include/ie) + +install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core_c + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core_c + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core_c + INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include/ie) install(DIRECTORY ${InferenceEngine_C_API_SOURCE_DIR}/include/ DESTINATION ${IE_CPACK_IE_DIR}/include/ie diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 5533ffac4f45bd..410f58c28bd4db 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -172,8 +172,6 @@ target_link_libraries(${TARGET_NAME} PRIVATE pugixml::static openvino::itt ${CMA target_include_directories(${TARGET_NAME} INTERFACE $ $ - $ - $ PRIVATE $ $) @@ -221,15 +219,6 @@ set_target_properties(${TARGET_NAME}_s PROPERTIES EXCLUDE_FROM_ALL ON) set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) -# Export for build tree (WA for cmake) - -export(TARGETS ngraph ${TARGET_NAME} NAMESPACE IE:: - APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") - -set_target_properties(ngraph PROPERTIES EXPORT_NAME core) -export(TARGETS ngraph ${TARGET_NAME} NAMESPACE openvino:: - APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") - # Export for developer package openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NAME}_plugin_api) @@ -285,13 +274,15 @@ install(DIRECTORY "${PUBLIC_HEADERS_DIR}" DESTINATION ${IE_CPACK_IE_DIR} install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core + INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include/ie) set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime) install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core + INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include) install(FILES $/plugins.xml DESTINATION ${IE_CPACK_RUNTIME_PATH} diff --git a/ngraph/core/CMakeLists.txt b/ngraph/core/CMakeLists.txt index 70be17b1281eaa..3245adebd95890 100644 --- a/ngraph/core/CMakeLists.txt +++ b/ngraph/core/CMakeLists.txt @@ -71,7 +71,6 @@ set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/pass/convert_precis # Defines macro in C++ to load backend plugin target_include_directories(ngraph PUBLIC $ - $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/include) @@ -81,15 +80,42 @@ add_library(ngraph::ngraph ALIAS ngraph) target_link_libraries(ngraph PRIVATE ${CMAKE_DL_LIBS}) #----------------------------------------------------------------------------------------------- -# Installation logic... +# Export for build tree #----------------------------------------------------------------------------------------------- export(TARGETS ngraph NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") +# WA for cmake +export(TARGETS ngraph NAMESPACE IE:: + APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") + +set_target_properties(ngraph PROPERTIES EXPORT_NAME core) +export(TARGETS ngraph NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") + +#----------------------------------------------------------------------------------------------- +# Installation logic... +#----------------------------------------------------------------------------------------------- + install(TARGETS ngraph EXPORT ngraphTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + INCLUDES DESTINATION ${NGRAPH_INSTALL_INCLUDE}) + +# ngraph needs to be in export list of InferenceEngineTargets +# this is a cmake limitation +install(TARGETS ngraph EXPORT InferenceEngineTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + INCLUDES DESTINATION ${NGRAPH_INSTALL_INCLUDE}) + +install(TARGETS ngraph EXPORT OpenVINOTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + INCLUDES DESTINATION ${NGRAPH_INSTALL_INCLUDE}) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${NGRAPH_INSTALL_INCLUDE} From 68fab8683d4881621888153dbb5e567c0fab81ac Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 14:29:43 +0300 Subject: [PATCH 04/31] Fixes --- cmake/templates/InferenceEngineConfig.cmake.in | 6 +++--- inference-engine/src/inference_engine/CMakeLists.txt | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/templates/InferenceEngineConfig.cmake.in b/cmake/templates/InferenceEngineConfig.cmake.in index c14e4f18ced82f..c5b95bd75efc68 100644 --- a/cmake/templates/InferenceEngineConfig.cmake.in +++ b/cmake/templates/InferenceEngineConfig.cmake.in @@ -125,9 +125,9 @@ if(NOT TARGET inference_engine) INTERFACE_LINK_LIBRARIES IE::core) endif() - if(TARGET IE::runtime::c AND NOT TARGET IE::inference_engine_c) - add_library(IE::inference_engine_c INTERFACE IMPORTED) - set_target_properties(IE::inference_engine_c PROPERTIES + if(TARGET IE::runtime::c AND NOT TARGET IE::inference_engine_c_api) + add_library(IE::inference_engine_c_api INTERFACE IMPORTED) + set_target_properties(IE::inference_engine_c_api PROPERTIES INTERFACE_LINK_LIBRARIES IE::runtime::c) endif() endif() diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 410f58c28bd4db..13c934bee97739 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -219,6 +219,14 @@ set_target_properties(${TARGET_NAME}_s PROPERTIES EXCLUDE_FROM_ALL ON) set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) +# Export for build tree + +export(TARGETS ${TARGET_NAME} NAMESPACE IE:: + APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") + +export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") + # Export for developer package openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NAME}_plugin_api) From ef84fde690f4463c731ae911f0dfd4a073abf6b4 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 14:59:07 +0300 Subject: [PATCH 05/31] Export frontends as well --- cmake/templates/OpenVINOConfig.cmake.in | 16 ++++-------- cmake/templates/ngraphConfig.cmake.in | 26 +++++++------------ .../src/transformations/CMakeLists.txt | 7 +++++ ngraph/core/CMakeLists.txt | 4 +-- .../frontend/frontend_manager/CMakeLists.txt | 17 ++++++++---- ngraph/frontend/onnx/frontend/CMakeLists.txt | 14 +++++++--- ngraph/frontend/paddlepaddle/CMakeLists.txt | 17 +++++++----- 7 files changed, 57 insertions(+), 44 deletions(-) diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in index 3ffe8554f55559..39e6e366def036 100644 --- a/cmake/templates/OpenVINOConfig.cmake.in +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -176,17 +176,11 @@ endif() # Apply common functions # -unset(_openvino_libraries) -foreach(comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) - # check if the component is available - if(${CMAKE_FIND_PACKAGE_NAME}_${comp}_FOUND) - set(pcomp ${comp}) - if(_ov_as_external_package) - set(pcomp openvino::${comp}) - endif() - - list(APPEND _openvino_libraries ${pcomp}) - _ov_target_no_deprecation_error(${_openvino_libraries}) +foreach(target openvino::runtime openvino::runtime::c openvino::core + openvino::frontend::manager openvino::frontend::onnx + openvino::frontend::paddlepaddle) + if(TARGET ${target}) + _ov_target_no_deprecation_error(${target}) endif() endforeach() unset(_ov_as_external_package) diff --git a/cmake/templates/ngraphConfig.cmake.in b/cmake/templates/ngraphConfig.cmake.in index 051fe5c229e123..0f025fb611e535 100644 --- a/cmake/templates/ngraphConfig.cmake.in +++ b/cmake/templates/ngraphConfig.cmake.in @@ -42,25 +42,19 @@ if(NOT TARGET ngraph) # create targets with old names for compatibility set(core ngraph) - set(frontend_manager frontend_manager) + set(frontendXmanager frontend_manager) set(frontendXonnx onnx_ngraph_frontend) set(frontendXpaddlepaddle paddlepaddle_ngraph_frontend) - #foreach(target core frontend_manager frontendXonnx frontendXpaddlepaddle) - # string(REPLACE "X" "::" patched_target ${target}) - # if(TARGET ngraph::${patched_target}) - # set(new_target ngraph::${target}) - # add_library(${new_target} INTERFACE IMPORTED) - # set_target_properties(${new_target} PROPERTIES - # INTERFACE_LINK_LIBRARIES ngraph::${patched_target}) - # endif() - #endforeach() - - if(TARGET ngraph::core AND NOT TARGET ngraph::ngraph) - add_library(ngraph::ngraph INTERFACE IMPORTED) - set_target_properties(ngraph::ngraph PROPERTIES - INTERFACE_LINK_LIBRARIES ngraph::core) - endif() + foreach(target core frontend_manager frontendXonnx frontendXpaddlepaddle) + string(REPLACE "X" "::" patched_target ${target}) + set(new_target ngraph::${target}) + if(TARGET ngraph::${patched_target} AND NOT TARGET ${new_target}) + add_library(${new_target} INTERFACE IMPORTED) + set_target_properties(${new_target} PROPERTIES + INTERFACE_LINK_LIBRARIES ngraph::${patched_target}) + endif() + endforeach() endif() set(ngraph_ngraph_FOUND ON) diff --git a/inference-engine/src/transformations/CMakeLists.txt b/inference-engine/src/transformations/CMakeLists.txt index cf686b54e5bda0..59af88ea36e439 100644 --- a/inference-engine/src/transformations/CMakeLists.txt +++ b/inference-engine/src/transformations/CMakeLists.txt @@ -58,3 +58,10 @@ install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) + +# because inference_engine_transformations is exported in multiple export list +# it needs to be exported in each list it's used +install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) \ No newline at end of file diff --git a/ngraph/core/CMakeLists.txt b/ngraph/core/CMakeLists.txt index 3245adebd95890..d407248b138119 100644 --- a/ngraph/core/CMakeLists.txt +++ b/ngraph/core/CMakeLists.txt @@ -103,8 +103,8 @@ install(TARGETS ngraph EXPORT ngraphTargets LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph INCLUDES DESTINATION ${NGRAPH_INSTALL_INCLUDE}) -# ngraph needs to be in export list of InferenceEngineTargets -# this is a cmake limitation +# because ngraph is exported in multiple export list +# it needs to be exported in each list it's used install(TARGETS ngraph EXPORT InferenceEngineTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph diff --git a/ngraph/frontend/frontend_manager/CMakeLists.txt b/ngraph/frontend/frontend_manager/CMakeLists.txt index 8e028a91df3a32..1375f537721a33 100644 --- a/ngraph/frontend/frontend_manager/CMakeLists.txt +++ b/ngraph/frontend/frontend_manager/CMakeLists.txt @@ -29,7 +29,8 @@ target_compile_definitions(${TARGET_NAME}_static PUBLIC USE_STATIC_FRONTEND_MANA add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) add_library(ngraph::${TARGET_NAME} ALIAS ${TARGET_NAME}) -target_include_directories(${TARGET_NAME} PUBLIC $ +target_include_directories(${TARGET_NAME} PUBLIC + $ $) target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS} PUBLIC ngraph) @@ -48,10 +49,16 @@ endif() # Installation rules for shared version only -# install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets -# RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph -# ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph -# LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) +install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) + +set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::manager) +install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/frontend_manager DESTINATION ${FRONTEND_INSTALL_INCLUDE} diff --git a/ngraph/frontend/onnx/frontend/CMakeLists.txt b/ngraph/frontend/onnx/frontend/CMakeLists.txt index a609d291e70b50..8b3671137b6f0f 100644 --- a/ngraph/frontend/onnx/frontend/CMakeLists.txt +++ b/ngraph/frontend/onnx/frontend/CMakeLists.txt @@ -55,10 +55,16 @@ if(NGRAPH_USE_PROTOBUF_LITE) target_compile_definitions(onnx_ngraph_frontend PRIVATE NGRAPH_USE_PROTOBUF_LITE) endif() -# install(TARGETS onnx_ngraph_frontend EXPORT ngraphTargets -# RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph -# ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph -# LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) +install(TARGETS onnx_ngraph_frontend EXPORT ngraphTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) + +set_target_properties(onnx_ngraph_frontend PROPERTIES EXPORT_NAME frontend::onnx) +install(TARGETS onnx_ngraph_frontend EXPORT OpenVINOTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) install(DIRECTORY ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_frontend ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_import diff --git a/ngraph/frontend/paddlepaddle/CMakeLists.txt b/ngraph/frontend/paddlepaddle/CMakeLists.txt index 6f61d03d9b41e8..f41a148a869a5c 100644 --- a/ngraph/frontend/paddlepaddle/CMakeLists.txt +++ b/ngraph/frontend/paddlepaddle/CMakeLists.txt @@ -81,15 +81,20 @@ target_link_libraries(${TARGET_NAME} PRIVATE ngraph::frontend_manager::static add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) -# install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets -# RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph -# ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph -# LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) +install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) + +set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::paddlepaddle) +install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/paddlepaddle_frontend DESTINATION ${FRONTEND_INSTALL_INCLUDE} COMPONENT ngraph_dev - FILES_MATCHING PATTERN "*.hpp" -) + FILES_MATCHING PATTERN "*.hpp") export(TARGETS ${TARGET_NAME} NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") From 005658e9f5627f1fdae050d79537e74511fed507 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 15:03:13 +0300 Subject: [PATCH 06/31] Fixed condition --- cmake/templates/OpenVINOConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in index 39e6e366def036..f8d2ed6b4651f7 100644 --- a/cmake/templates/OpenVINOConfig.cmake.in +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -179,7 +179,7 @@ endif() foreach(target openvino::runtime openvino::runtime::c openvino::core openvino::frontend::manager openvino::frontend::onnx openvino::frontend::paddlepaddle) - if(TARGET ${target}) + if(TARGET ${target} AND _ov_as_external_package) _ov_target_no_deprecation_error(${target}) endif() endforeach() From 5126bed9d787c04773a378c8d7ece0a0f5c152e0 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 15:34:18 +0300 Subject: [PATCH 07/31] Added OpenVINO cmake package usage: docs, C samples --- cmake/templates/ngraphConfig.cmake.in | 6 +++--- docs/CMakeLists.txt | 16 ++++------------ docs/IE_DG/Extensibility_DG/Custom_ONNX_Ops.md | 4 ++-- ...tegrate_with_customer_application_new_API.md | 5 ++--- docs/onnx_custom_op/CMakeLists.txt | 4 ++-- docs/template_extension/CMakeLists.txt | 16 +++++++--------- docs/template_extension/extension.cpp | 8 ++++---- .../ie_bridges/c/src/CMakeLists.txt | 1 + inference-engine/samples/CMakeLists.txt | 17 +++++++++-------- .../src/inference_engine/CMakeLists.txt | 14 ++++++++------ inference-engine/src/legacy_api/CMakeLists.txt | 4 ++-- ngraph/core/CMakeLists.txt | 3 ++- ngraph/frontend/frontend_manager/CMakeLists.txt | 3 ++- ngraph/frontend/ir/CMakeLists.txt | 4 ++-- ngraph/frontend/onnx/frontend/CMakeLists.txt | 4 ++-- ngraph/frontend/onnx/onnx_common/CMakeLists.txt | 1 - ngraph/frontend/paddlepaddle/CMakeLists.txt | 5 +++-- ngraph/python/CMakeLists.txt | 8 ++++---- scripts/setupvars/setupvars.bat | 1 + scripts/setupvars/setupvars.sh | 1 + 20 files changed, 61 insertions(+), 64 deletions(-) diff --git a/cmake/templates/ngraphConfig.cmake.in b/cmake/templates/ngraphConfig.cmake.in index 0f025fb611e535..4ed4965d04af99 100644 --- a/cmake/templates/ngraphConfig.cmake.in +++ b/cmake/templates/ngraphConfig.cmake.in @@ -62,15 +62,15 @@ set(NGRAPH_LIBRARIES ngraph::ngraph) set(ngraph_onnx_ngraph_frontend_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@) -# ngraph::onnx_importer target and variables are deprecated set(ngraph_onnx_importer_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@) if(ngraph_onnx_importer_FOUND) set(ONNX_IMPORTER_LIBRARIES ngraph::onnx_ngraph_frontend) + # ngraph::onnx_importer target and variables are deprecated + # but need to create a dummy target for BW compatibility if(NOT TARGET ngraph::onnx_importer) add_library(ngraph::onnx_importer INTERFACE IMPORTED) set_target_properties(ngraph::onnx_importer PROPERTIES - INTERFACE_LINK_LIBRARIES ngraph::onnx_ngraph_frontend - ) + INTERFACE_LINK_LIBRARIES ngraph::onnx_ngraph_frontend) endif() endif() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 4d3135903de149..3ccce334c4f549 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -9,20 +9,12 @@ if(NOT ENABLE_DOCKER) add_subdirectory(snippets) - # Detect nGraph - find_package(ngraph QUIET - PATHS "${CMAKE_BINARY_DIR}/ngraph" - NO_DEFAULT_PATH) - if(NOT ngraph_FOUND) - set(ngraph_DIR ${CMAKE_BINARY_DIR}/ngraph) - endif() - - # Detect InferenceEngine - find_package(InferenceEngine QUIET + # Detect OpenVINO + find_package(OpenVINO QUIET PATHS "${CMAKE_BINARY_DIR}" NO_DEFAULT_PATH) - if(NOT InferenceEngine_FOUND) - set(InferenceEngine_DIR ${CMAKE_BINARY_DIR}) + if(NOT OpenVINO_FOUND) + set(OpenVINO_DIR ${CMAKE_BINARY_DIR}) endif() if(NGRAPH_ONNX_FRONTEND_ENABLE) diff --git a/docs/IE_DG/Extensibility_DG/Custom_ONNX_Ops.md b/docs/IE_DG/Extensibility_DG/Custom_ONNX_Ops.md index a9a9841cac457f..eb7183f0dc246b 100644 --- a/docs/IE_DG/Extensibility_DG/Custom_ONNX_Ops.md +++ b/docs/IE_DG/Extensibility_DG/Custom_ONNX_Ops.md @@ -50,8 +50,8 @@ The example below demonstrates how to unregister an operator from the destructor ## Requirements for Building with CMake -A program that uses the `register_operator` functionality requires `ngraph::ngraph` and `ngraph::onnx_ngraph_frontend` libraries in addition to the Inference Engine. -The `onnx_ngraph_frontend` is a component of the `ngraph` package , so `find_package(ngraph REQUIRED COMPONENTS onnx_ngraph_frontend)` can find both. +A program that uses the `register_operator` functionality requires `openvino::core` and `openvino::frontend::onnx` libraries in addition to the OpenVINO Inference Runtime. +The `onnx_ngraph_frontend` is a component of the `OpenVINO` package , so `find_package(OpenVINO REQUIRED COMPONENTS ONNX)` can find both. Those libraries need to be passed to the `target_link_libraries` command in the CMakeLists.txt file. See CMakeLists.txt below for reference: diff --git a/docs/IE_DG/Integrate_with_customer_application_new_API.md b/docs/IE_DG/Integrate_with_customer_application_new_API.md index 9e5ac71189cdd9..044c1c62ad9672 100644 --- a/docs/IE_DG/Integrate_with_customer_application_new_API.md +++ b/docs/IE_DG/Integrate_with_customer_application_new_API.md @@ -193,11 +193,10 @@ build/ - build directory ``` cmake cmake_minimum_required(VERSION 3.0.0) project(project_name) -find_package(ngraph REQUIRED) -find_package(InferenceEngine REQUIRED) +find_package(OpenVINO REQUIRED) find_package(OpenCV REQUIRED) add_executable(${PROJECT_NAME} src/main.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ${InferenceEngine_LIBRARIES} ${OpenCV_LIBS} ${NGRAPH_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PRIVATE openvino::runtime ${OpenCV_LIBS}) ``` 3. **To build your project** using CMake with the default build tools currently available on your machine, execute the following commands: > **NOTE**: Make sure you set environment variables first by running `/bin/setupvars.sh` (or setupvars.bat for Windows)`. Otherwise the `InferenceEngine_DIR` and `OpenCV_DIR` variables won't be configured properly to pass `find_package` calls. diff --git a/docs/onnx_custom_op/CMakeLists.txt b/docs/onnx_custom_op/CMakeLists.txt index 09d6635ee92145..5403489794e958 100644 --- a/docs/onnx_custom_op/CMakeLists.txt +++ b/docs/onnx_custom_op/CMakeLists.txt @@ -7,11 +7,11 @@ set(CMAKE_CXX_STANDARD 11) set(TARGET_NAME "onnx_custom_op") -find_package(ngraph REQUIRED COMPONENTS onnx_ngraph_frontend) +find_package(OpenVINO REQUIRED COMPONENTS ONNX) add_library(${TARGET_NAME} STATIC onnx_custom_op.cpp onnx_custom_op.hpp) -target_link_libraries(${TARGET_NAME} PUBLIC ngraph::ngraph ngraph::onnx_ngraph_frontend) +target_link_libraries(${TARGET_NAME} PUBLIC openvino::core openvino::frontend::onnx) # [cmake:onnx_custom_op] # Enable code style check diff --git a/docs/template_extension/CMakeLists.txt b/docs/template_extension/CMakeLists.txt index 230323768e04d4..eb95a1a9225c5a 100644 --- a/docs/template_extension/CMakeLists.txt +++ b/docs/template_extension/CMakeLists.txt @@ -7,30 +7,28 @@ set(CMAKE_CXX_STANDARD 11) set(TARGET_NAME "template_extension") -find_package(ngraph REQUIRED OPTIONAL_COMPONENTS onnx_ngraph_frontend) -find_package(InferenceEngine REQUIRED) +find_package(OpenVINO REQUIRED OPTIONAL_COMPONENTS Runtime ONNX) find_package(OpenCV QUIET COMPONENTS core) set(SRC cpu_kernel.cpp extension.cpp op.cpp) -if (OpenCV_FOUND) +if(OpenCV_FOUND) set(SRC ${SRC} fft_kernel.cpp fft_op.cpp) endif() add_library(${TARGET_NAME} MODULE ${SRC}) -if (OpenCV_FOUND) +if(OpenCV_FOUND) target_compile_definitions(${TARGET_NAME} PRIVATE OPENCV_IMPORT_ENABLED) target_link_libraries(${TARGET_NAME} PRIVATE opencv_core) endif() target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_EXTENSION_API) -target_link_libraries(${TARGET_NAME} PRIVATE IE::inference_engine - ${NGRAPH_LIBRARIES}) +target_link_libraries(${TARGET_NAME} PRIVATE openvino::core openvino::runtime) -if (ngraph_onnx_ngraph_frontend_FOUND) - target_link_libraries(${TARGET_NAME} PRIVATE ngraph::onnx_ngraph_frontend) - target_compile_definitions(${TARGET_NAME} PRIVATE NGRAPH_ONNX_FRONTEND_ENABLED) +if(OpenVINO_Frontend_ONNX_FOUND) + target_link_libraries(${TARGET_NAME} PRIVATE openvino::frontend::onnx) + target_compile_definitions(${TARGET_NAME} PRIVATE OPENVINO_ONNX_FRONTEND_ENABLED) endif() # [cmake:extension] diff --git a/docs/template_extension/extension.cpp b/docs/template_extension/extension.cpp index d3be82d1120fa9..140d9086ea487e 100644 --- a/docs/template_extension/extension.cpp +++ b/docs/template_extension/extension.cpp @@ -11,7 +11,7 @@ # include "fft_op.hpp" #endif #include -#ifdef NGRAPH_ONNX_FRONTEND_ENABLED +#ifdef OPENVINO_ONNX_FRONTEND_ENABLED # include #endif @@ -24,7 +24,7 @@ using namespace TemplateExtension; //! [extension:ctor] Extension::Extension() { -#ifdef NGRAPH_ONNX_FRONTEND_ENABLED +#ifdef OPENVINO_ONNX_FRONTEND_ENABLED ngraph::onnx_import::register_operator(Operation::type_info.name, 1, "custom_domain", @@ -49,12 +49,12 @@ Extension::Extension() { //! [extension:dtor] Extension::~Extension() { -#ifdef NGRAPH_ONNX_FRONTEND_ENABLED +#ifdef OPENVINO_ONNX_FRONTEND_ENABLED ngraph::onnx_import::unregister_operator(Operation::type_info.name, 1, "custom_domain"); # ifdef OPENCV_IMPORT_ENABLED ngraph::onnx_import::unregister_operator(FFTOp::type_info.name, 1, "custom_domain"); # endif // OPENCV_IMPORT_ENABLED -#endif // NGRAPH_ONNX_FRONTEND_ENABLED +#endif // OPENVINO_ONNX_FRONTEND_ENABLED } //! [extension:dtor] diff --git a/inference-engine/ie_bridges/c/src/CMakeLists.txt b/inference-engine/ie_bridges/c/src/CMakeLists.txt index 781e9164e4863e..5cf46942f50d5f 100644 --- a/inference-engine/ie_bridges/c/src/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/src/CMakeLists.txt @@ -10,6 +10,7 @@ file(GLOB HEADERS ${InferenceEngine_C_API_SOURCE_DIR}/include/*.h) # create library add_library(${TARGET_NAME} SHARED ${HEADERS} ${SOURCES}) +add_library(openvino::runtime::c ALIAS ${TARGET_NAME}) target_link_libraries(${TARGET_NAME} PRIVATE inference_engine) diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt index 3e42fa84f2e429..9e244111433bbc 100644 --- a/inference-engine/samples/CMakeLists.txt +++ b/inference-engine/samples/CMakeLists.txt @@ -33,11 +33,12 @@ endif() if(OpenVINO_SOURCE_DIR) # in case if samples are built from IE repo - set(IE_MAIN_SAMPLES_DIR ${OpenVINO_SOURCE_DIR}) - # hint for find_package(InferenceEngine in the samples folder) + set(IE_MAIN_SAMPLES_DIR "${OpenVINO_SOURCE_DIR}") + # hint for find_package( in the samples folder) set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}") + set(OpenVINO_DIR "${CMAKE_BINARY_DIR}") # hint for find_package(ngraph in the samples folder) - set(ngraph_DIR ${CMAKE_BINARY_DIR}/ngraph) + set(ngraph_DIR "${CMAKE_BINARY_DIR}/ngraph") else() # in case if samples are built out of IE repo set(IE_MAIN_SAMPLES_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -210,13 +211,13 @@ macro(ie_add_sample) endif() if(c_sample) - set(ie_component inference_engine_c_api) + find_package(OpenVINO REQUIRED COMPONENTS Runtime) + set(ov_link_libraries openvino::runtime::c) else() - set(ie_component inference_engine) + find_package(InferenceEngine REQUIRED COMPONENTS inference_engine) + set(ov_link_libraries inference_engine) endif() - find_package(InferenceEngine REQUIRED COMPONENTS ${ie_component}) - set_target_properties(${IE_SAMPLE_NAME} PROPERTIES FOLDER ${folder_name} COMPILE_PDB_NAME ${IE_SAMPLE_NAME}) @@ -225,7 +226,7 @@ macro(ie_add_sample) endif() target_include_directories(${IE_SAMPLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../common") - target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${OpenCV_LIBRARIES} ${InferenceEngine_LIBRARIES} + target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${OpenCV_LIBRARIES} ${ov_link_libraries} ${IE_SAMPLE_DEPENDENCIES}) if(NOT c_sample) target_link_libraries(${IE_SAMPLE_NAME} PRIVATE gflags) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 13c934bee97739..0d6b000a04b974 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -120,12 +120,12 @@ ie_faster_build(${TARGET_NAME}_obj ) target_compile_definitions(${TARGET_NAME}_obj PRIVATE IMPLEMENT_INFERENCE_ENGINE_API - $ - $) + $ + $) -target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE $ +target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE $ $ - $ + $ $) target_include_directories(${TARGET_NAME}_obj PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src" @@ -150,6 +150,8 @@ add_library(${TARGET_NAME} SHARED ${vs_version_file} $) +add_library(openvino::runtime ALIAS ${TARGET_NAME}) + add_clang_format_target(${TARGET_NAME}_clang FOR_SOURCES ${IE_STATIC_DEPENDENT_FILES} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${PUBLIC_HEADERS}) ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} @@ -166,7 +168,7 @@ if (TBBBIND_2_4_FOUND) endif() target_link_libraries(${TARGET_NAME} PRIVATE pugixml::static openvino::itt ${CMAKE_DL_LIBS} Threads::Threads - ngraph::frontend_manager::static inference_engine_transformations + frontend_manager::static inference_engine_transformations PUBLIC ngraph) target_include_directories(${TARGET_NAME} INTERFACE @@ -207,7 +209,7 @@ if(WIN32) set_target_properties(${TARGET_NAME}_s PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_s) endif() -target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ngraph ngraph::frontend_manager::static +target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ngraph frontend_manager::static inference_engine_transformations pugixml::static) target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE) diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/inference-engine/src/legacy_api/CMakeLists.txt index 9de8bf16910835..bfc5c11129a39c 100644 --- a/inference-engine/src/legacy_api/CMakeLists.txt +++ b/inference-engine/src/legacy_api/CMakeLists.txt @@ -42,10 +42,10 @@ target_include_directories(${TARGET_NAME}_obj PRIVATE ${IE_MAIN_SOURCE_DIR}/src/inference_engine/src # For CNNNetworkNGraphImpl $ $ - $ + $ $) -target_compile_definitions(${TARGET_NAME}_obj PRIVATE $) +target_compile_definitions(${TARGET_NAME}_obj PRIVATE $) target_link_libraries(${TARGET_NAME}_obj PRIVATE openvino::itt) diff --git a/ngraph/core/CMakeLists.txt b/ngraph/core/CMakeLists.txt index d407248b138119..076958a3be4906 100644 --- a/ngraph/core/CMakeLists.txt +++ b/ngraph/core/CMakeLists.txt @@ -74,8 +74,9 @@ target_include_directories(ngraph PUBLIC $ diff --git a/ngraph/frontend/ir/CMakeLists.txt b/ngraph/frontend/ir/CMakeLists.txt index d3ece57ce36180..30f045c137f29b 100644 --- a/ngraph/frontend/ir/CMakeLists.txt +++ b/ngraph/frontend/ir/CMakeLists.txt @@ -23,7 +23,7 @@ add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_P ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" ADDITIONAL_INCLUDE_DIRECTORIES - $) + $) target_include_directories(${TARGET_NAME} PUBLIC @@ -40,7 +40,7 @@ if(COMMAND ie_add_vs_version_file) FILEDESCRIPTION "FrontEnd to load and convert IR file format") endif() -target_link_libraries(${TARGET_NAME} PRIVATE ngraph::frontend_manager::static +target_link_libraries(${TARGET_NAME} PRIVATE frontend_manager::static PRIVATE ngraph::builder inference_engine_transformations inference_engine pugixml::static inference_engine_plugin_api) diff --git a/ngraph/frontend/onnx/frontend/CMakeLists.txt b/ngraph/frontend/onnx/frontend/CMakeLists.txt index 8b3671137b6f0f..884b3d87c5f104 100644 --- a/ngraph/frontend/onnx/frontend/CMakeLists.txt +++ b/ngraph/frontend/onnx/frontend/CMakeLists.txt @@ -28,7 +28,7 @@ source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) # Create shared library add_library(onnx_ngraph_frontend SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) -add_library(ngraph::onnx_ngraph_frontend ALIAS onnx_ngraph_frontend) +add_library(openvino::frontend::onnx ALIAS onnx_ngraph_frontend) add_clang_format_target(onnx_ngraph_frontend_clang FOR_TARGETS onnx_ngraph_frontend) @@ -37,7 +37,7 @@ ov_ncc_naming_style(FOR_TARGET onnx_ngraph_frontend DEFINITIONS $ ADDITIONAL_INCLUDE_DIRECTORIES - $) + $) if(COMMAND ie_add_vs_version_file) ie_add_vs_version_file(NAME onnx_ngraph_frontend diff --git a/ngraph/frontend/onnx/onnx_common/CMakeLists.txt b/ngraph/frontend/onnx/onnx_common/CMakeLists.txt index ec31841e12cccc..bc63b28893d89b 100644 --- a/ngraph/frontend/onnx/onnx_common/CMakeLists.txt +++ b/ngraph/frontend/onnx/onnx_common/CMakeLists.txt @@ -16,7 +16,6 @@ source_group("include" FILES ${PUBLIC_HEADERS} ${PUBLIC_HEADERS}) # Create static library add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS}) -add_library(ngraph::onnx_common ALIAS ${TARGET_NAME}) # TODO Add handling ie_faster_build diff --git a/ngraph/frontend/paddlepaddle/CMakeLists.txt b/ngraph/frontend/paddlepaddle/CMakeLists.txt index f41a148a869a5c..659c5ec29cb60e 100644 --- a/ngraph/frontend/paddlepaddle/CMakeLists.txt +++ b/ngraph/frontend/paddlepaddle/CMakeLists.txt @@ -49,13 +49,14 @@ set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIO # Create shared library add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS}) +add_library(openvino::frontend::paddlepaddle ALIAS ${TARGET_NAME}) add_dependencies(${TARGET_NAME} paddlepaddle_ngraph_frontend_proto) ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include" ADDITIONAL_INCLUDE_DIRECTORIES - $) + $) target_include_directories(${TARGET_NAME} PUBLIC @@ -75,7 +76,7 @@ endif() link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES}) -target_link_libraries(${TARGET_NAME} PRIVATE ngraph::frontend_manager::static +target_link_libraries(${TARGET_NAME} PRIVATE frontend_manager::static PRIVATE ngraph::builder inference_engine_transformations) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} diff --git a/ngraph/python/CMakeLists.txt b/ngraph/python/CMakeLists.txt index 7de595a5211edd..c12b99cb293b0a 100644 --- a/ngraph/python/CMakeLists.txt +++ b/ngraph/python/CMakeLists.txt @@ -8,7 +8,7 @@ project (pyngraph) if(NOT DEFINED OpenVINO_SOURCE_DIR) find_package(InferenceEngineDeveloperPackage QUIET) - find_package(ngraph REQUIRED) + find_package(OpenVINO REQUIRED) endif() add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/pybind11 EXCLUDE_FROM_ALL) @@ -59,10 +59,10 @@ pybind11_add_module(_${PROJECT_NAME} MODULE ${SOURCES}) target_include_directories(_${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src") -target_link_libraries(_${PROJECT_NAME} PRIVATE ngraph::ngraph ngraph::frontend_manager) +target_link_libraries(_${PROJECT_NAME} PRIVATE openvino::core openvino::frontend::manager) -if (TARGET ngraph::onnx_ngraph_frontend) - add_dependencies(_${PROJECT_NAME} ngraph::onnx_ngraph_frontend) +if(TARGET onnx_ngraph_frontend) + add_dependencies(_${PROJECT_NAME} onnx_ngraph_frontend) endif() if(NGRAPH_UNIT_TEST_ENABLE) diff --git a/scripts/setupvars/setupvars.bat b/scripts/setupvars/setupvars.bat index c7920d3fa332eb..e0579fde533371 100644 --- a/scripts/setupvars/setupvars.bat +++ b/scripts/setupvars/setupvars.bat @@ -46,6 +46,7 @@ set "PATH=%INTEL_OPENVINO_DIR%\deployment_tools\open_model_zoo\tools\downloader; :: Inference Engine set "InferenceEngine_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\share" +set "OpenVINO_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\share" set "HDDL_INSTALL_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\external\hddl" set "OPENMP_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\external\omp\lib" set "GNA_DIR=%INTEL_OPENVINO_DIR%\deployment_tools\inference_engine\external\gna\lib" diff --git a/scripts/setupvars/setupvars.sh b/scripts/setupvars/setupvars.sh index 199ef0edd9355f..e44d8bbecc0ead 100755 --- a/scripts/setupvars/setupvars.sh +++ b/scripts/setupvars/setupvars.sh @@ -31,6 +31,7 @@ done if [ -e "$INSTALLDIR/deployment_tools/inference_engine" ]; then export InferenceEngine_DIR=$INTEL_OPENVINO_DIR/deployment_tools/inference_engine/share + export OpenVINO_DIR=$INTEL_OPENVINO_DIR/deployment_tools/inference_engine/share system_type=$(ls "$INTEL_OPENVINO_DIR/deployment_tools/inference_engine/lib/") IE_PLUGINS_PATH=$INTEL_OPENVINO_DIR/deployment_tools/inference_engine/lib/$system_type From 8974fc3b9a4b483d85042fa485947a9c7c033b1b Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 16:30:11 +0300 Subject: [PATCH 08/31] Use more OpenVINO config --- ...renceEngineDeveloperPackageConfig.cmake.in | 5 +++ .../ie_bridges/python/CMakeLists.txt | 5 +-- .../openvino/inference_engine/CMakeLists.txt | 4 +-- .../openvino/inference_engine/ie_api_impl.cpp | 1 - .../openvino/inference_engine/ie_api_impl.hpp | 5 ++- .../offline_transformations/CMakeLists.txt | 6 ++-- .../src/openvino/test_utils/CMakeLists.txt | 6 ++-- inference-engine/samples/CMakeLists.txt | 13 +++----- .../samples/common/utils/CMakeLists.txt | 4 +-- .../samples/hello_reshape_ssd/CMakeLists.txt | 3 -- .../CMakeLists.txt | 3 -- .../CMakeLists.txt | 3 -- .../mock_mo_ngraph_frontend/CMakeLists.txt | 2 +- .../mock_mo_python_api/CMakeLists.txt | 2 +- .../frontend/frontend_manager/CMakeLists.txt | 2 ++ ngraph/frontend/onnx/frontend/CMakeLists.txt | 32 +++++++++++-------- ngraph/frontend/paddlepaddle/CMakeLists.txt | 2 ++ .../mock_py_ngraph_frontend/CMakeLists.txt | 2 +- .../mock/pyngraph_fe_mock_api/CMakeLists.txt | 2 +- tests/fuzz/CMakeLists.txt | 2 +- tests/lib/src/CMakeLists.txt | 6 ++-- 21 files changed, 52 insertions(+), 58 deletions(-) diff --git a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 72af5ca89cadac..8d747ae34bcf56 100644 --- a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -44,6 +44,11 @@ find_dependency(InferenceEngine NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH) +find_dependency(OpenVINO + PATHS "${CMAKE_CURRENT_LIST_DIR}" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + # WA for cmake: it exports ngraph as IE::ngraph in the IE export list # while we already have ngraph export in its own export list as ngraph::ngraph set_property(TARGET ngraph::ngraph PROPERTY IMPORTED_GLOBAL TRUE) diff --git a/inference-engine/ie_bridges/python/CMakeLists.txt b/inference-engine/ie_bridges/python/CMakeLists.txt index a88b1017a124f4..b5e535f87405a8 100644 --- a/inference-engine/ie_bridges/python/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/CMakeLists.txt @@ -8,11 +8,8 @@ cmake_minimum_required (VERSION 3.13) # Set the project name project (ie_python_api) -if(DEFINED OpenVINO_SOURCE_DIR) - set(InferenceEngine_LIBRARIES inference_engine) -else() +if(NOT DEFINED OpenVINO_SOURCE_DIR) find_package(InferenceEngineDeveloperPackage REQUIRED) - set(InferenceEngine_LIBRARIES IE::inference_engine) endif() option(ENABLE_CONDA_FOLDER "Create output folder with conda python bindings" OFF) diff --git a/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt index cfab4f2d907f28..5fcdd37c790c77 100644 --- a/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/inference_engine/CMakeLists.txt @@ -31,7 +31,7 @@ foreach(PYX_FILE IN LISTS PYX_SOURCES) ov_python_disable_intel_warnings(${PYX_NAME}) add_dependencies(${TARGET_NAME} ${PYX_NAME}) target_include_directories(${PYX_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") - target_link_libraries(${PYX_NAME} PRIVATE ${InferenceEngine_LIBRARIES}) + target_link_libraries(${PYX_NAME} PRIVATE openvino::runtime) list(APPEND INSTALLED_TARGETS ${PYX_NAME}) ie_python_minimal_api(${PYX_NAME}) endforeach() @@ -53,7 +53,7 @@ python_disable_deprecated_warnings() ie_python_minimal_api(${TARGET_NAME}) target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES}) +target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime) # Compatibility with python 2.7 which has deprecated "register" specifier if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.cpp b/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.cpp index 7aa289377d2e92..948c578e013565 100644 --- a/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.cpp +++ b/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.cpp @@ -4,7 +4,6 @@ #include "ie_api_impl.hpp" -#include "ie_iinfer_request.hpp" #include "ie_plugin_config.hpp" const std::string EXPORTED_NETWORK_NAME = "undefined"; diff --git a/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp b/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp index 4823b52287c5f4..39e10fa92fd9d2 100644 --- a/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp +++ b/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp @@ -4,12 +4,9 @@ #pragma once -#include - #include #include #include -#include #include #include #include @@ -22,6 +19,8 @@ #include #include +#include "ie_core.hpp" + #include "Python.h" typedef std::chrono::high_resolution_clock Time; 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 512b1662be525c..5aeb5224aa14eb 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 @@ -30,14 +30,14 @@ if(COMMAND ie_add_vs_version_file) endif() if(TARGET offline_transformations) - list(APPEND InferenceEngine_LIBRARIES offline_transformations) + list(APPEND link_libraries offline_transformations) else() - list(APPEND InferenceEngine_LIBRARIES IE::offline_transformations) + list(APPEND link_libraries IE::offline_transformations) endif() target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inference_engine") target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES}) +target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime ${link_libraries}) # Compatibility with python 2.7 which has deprecated "register" specifier if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt index 9d3e1e0ffc082d..cb071162e3537a 100644 --- a/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt @@ -30,14 +30,14 @@ if(COMMAND ie_add_vs_version_file) endif() if(TARGET commonTestUtils) - list(APPEND InferenceEngine_LIBRARIES commonTestUtils) + list(APPEND link_libraries commonTestUtils) else() - list(APPEND InferenceEngine_LIBRARIES IE::commonTestUtils) + list(APPEND link_libraries IE::commonTestUtils) endif() target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inference_engine") -target_link_libraries(${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES}) +target_link_libraries(${TARGET_NAME} PRIVATE ${link_libraries}) # Compatibility with python 2.7 which has deprecated "register" specifier if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt index 9e244111433bbc..b78e32b2fa79a3 100644 --- a/inference-engine/samples/CMakeLists.txt +++ b/inference-engine/samples/CMakeLists.txt @@ -34,11 +34,7 @@ endif() if(OpenVINO_SOURCE_DIR) # in case if samples are built from IE repo set(IE_MAIN_SAMPLES_DIR "${OpenVINO_SOURCE_DIR}") - # hint for find_package( in the samples folder) - set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}") set(OpenVINO_DIR "${CMAKE_BINARY_DIR}") - # hint for find_package(ngraph in the samples folder) - set(ngraph_DIR "${CMAKE_BINARY_DIR}/ngraph") else() # in case if samples are built out of IE repo set(IE_MAIN_SAMPLES_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -129,8 +125,8 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils") add_subdirectory(common/utils) endif() -# format reader must be added after find_package(InferenceEngine) to get -# exactly the same OpenCV_DIR path which was used for the InferenceEngine build +# format reader must be added after find_package(OpenVINO) to get +# exactly the same OpenCV_DIR path which was used for the OpenVINO build if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/format_reader") add_subdirectory(common/format_reader) elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/opencv_c_wrapper") @@ -210,12 +206,11 @@ macro(ie_add_sample) set(folder_name c_samples) endif() + find_package(OpenVINO REQUIRED COMPONENTS Runtime) if(c_sample) - find_package(OpenVINO REQUIRED COMPONENTS Runtime) set(ov_link_libraries openvino::runtime::c) else() - find_package(InferenceEngine REQUIRED COMPONENTS inference_engine) - set(ov_link_libraries inference_engine) + set(ov_link_libraries openvino::runtime) endif() set_target_properties(${IE_SAMPLE_NAME} PROPERTIES FOLDER ${folder_name} diff --git a/inference-engine/samples/common/utils/CMakeLists.txt b/inference-engine/samples/common/utils/CMakeLists.txt index 9bdc0516af818f..534ab26160df8c 100644 --- a/inference-engine/samples/common/utils/CMakeLists.txt +++ b/inference-engine/samples/common/utils/CMakeLists.txt @@ -12,9 +12,9 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "src") target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -find_package(InferenceEngine REQUIRED COMPONENTS inference_engine) +find_package(OpenVINO REQUIRED COMPONENTS Runtime) -target_link_libraries(${TARGET_NAME} PUBLIC ${InferenceEngine_LIBRARIES} gflags) +target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime gflags) if(COMMAND add_clang_format_target) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) diff --git a/inference-engine/samples/hello_reshape_ssd/CMakeLists.txt b/inference-engine/samples/hello_reshape_ssd/CMakeLists.txt index 5c47b6e2fe83fd..5be6137ab2a716 100644 --- a/inference-engine/samples/hello_reshape_ssd/CMakeLists.txt +++ b/inference-engine/samples/hello_reshape_ssd/CMakeLists.txt @@ -7,6 +7,3 @@ ie_add_sample(NAME hello_reshape_ssd HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/reshape_ssd_extension.hpp" DEPENDENCIES ie_samples_utils OPENCV_DEPENDENCIES core imgproc imgcodecs) - -find_package(ngraph REQUIRED) -target_link_libraries(hello_reshape_ssd PRIVATE ${NGRAPH_LIBRARIES}) diff --git a/inference-engine/samples/ngraph_function_creation_sample/CMakeLists.txt b/inference-engine/samples/ngraph_function_creation_sample/CMakeLists.txt index 37fd62c2eccdeb..4a9b406d6bb8a0 100644 --- a/inference-engine/samples/ngraph_function_creation_sample/CMakeLists.txt +++ b/inference-engine/samples/ngraph_function_creation_sample/CMakeLists.txt @@ -8,6 +8,3 @@ ie_add_sample(NAME ngraph_function_creation_sample SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/ngraph_function_creation_sample.hpp" DEPENDENCIES format_reader ie_samples_utils) - -find_package(ngraph REQUIRED) -target_link_libraries(${TARGET_NAME} PRIVATE ${NGRAPH_LIBRARIES}) diff --git a/inference-engine/samples/object_detection_sample_ssd/CMakeLists.txt b/inference-engine/samples/object_detection_sample_ssd/CMakeLists.txt index 46dbb6bfe23c7e..af58af8d6b224d 100644 --- a/inference-engine/samples/object_detection_sample_ssd/CMakeLists.txt +++ b/inference-engine/samples/object_detection_sample_ssd/CMakeLists.txt @@ -6,6 +6,3 @@ ie_add_sample(NAME object_detection_sample_ssd SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/object_detection_sample_ssd.h" DEPENDENCIES format_reader ie_samples_utils) - -find_package(ngraph REQUIRED) -target_link_libraries(object_detection_sample_ssd PRIVATE ${NGRAPH_LIBRARIES}) diff --git a/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_ngraph_frontend/CMakeLists.txt b/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_ngraph_frontend/CMakeLists.txt index 232ca18727e69c..0017302b851b7c 100644 --- a/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_ngraph_frontend/CMakeLists.txt +++ b/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_ngraph_frontend/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(${TARGET_FE_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS}) target_include_directories(${TARGET_FE_NAME} PRIVATE ".") -target_link_libraries(${TARGET_FE_NAME} PRIVATE ngraph::frontend_manager::static) +target_link_libraries(${TARGET_FE_NAME} PRIVATE frontend_manager::static) target_link_libraries(${TARGET_FE_NAME} PUBLIC ngraph PRIVATE ngraph::builder) add_clang_format_target(${TARGET_FE_NAME}_clang FOR_TARGETS ${TARGET_FE_NAME}) diff --git a/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_python_api/CMakeLists.txt b/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_python_api/CMakeLists.txt index 750a0fcb4732ae..ca12d2e0c44dfb 100644 --- a/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_python_api/CMakeLists.txt +++ b/model-optimizer/unit_tests/mock_mo_frontend/mock_mo_python_api/CMakeLists.txt @@ -30,7 +30,7 @@ source_group("src" FILES ${PYBIND_FE_SRC}) pybind11_add_module(${PYBIND_FE_NAME} MODULE ${PYBIND_FE_SRC}) -target_link_libraries(${PYBIND_FE_NAME} PRIVATE ngraph::ngraph ngraph::frontend_manager::static) +target_link_libraries(${PYBIND_FE_NAME} PRIVATE ngraph frontend_manager::static) target_link_libraries(${PYBIND_FE_NAME} PRIVATE ${TARGET_FE_NAME}) add_dependencies(${PYBIND_FE_NAME} ${TARGET_FE_NAME}) diff --git a/ngraph/frontend/frontend_manager/CMakeLists.txt b/ngraph/frontend/frontend_manager/CMakeLists.txt index 8f07cc4ae0208c..df6cbe07a09a24 100644 --- a/ngraph/frontend/frontend_manager/CMakeLists.txt +++ b/ngraph/frontend/frontend_manager/CMakeLists.txt @@ -67,3 +67,5 @@ install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/frontend_manager FILES_MATCHING PATTERN "*.hpp") export(TARGETS ${TARGET_NAME} NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") +export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/ngraph/frontend/onnx/frontend/CMakeLists.txt b/ngraph/frontend/onnx/frontend/CMakeLists.txt index 884b3d87c5f104..20a773650d8956 100644 --- a/ngraph/frontend/onnx/frontend/CMakeLists.txt +++ b/ngraph/frontend/onnx/frontend/CMakeLists.txt @@ -2,6 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 # +set(TARGET_NAME onnx_ngraph_frontend) + set(ONNX_OPSET_VERSION 13 CACHE INTERNAL "Supported version of ONNX operator set") set(ONNX_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -27,12 +29,12 @@ source_group("include" FILES ${LIBRARY_HEADERS}) source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) # Create shared library -add_library(onnx_ngraph_frontend SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) -add_library(openvino::frontend::onnx ALIAS onnx_ngraph_frontend) +add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) +add_library(openvino::frontend::onnx ALIAS ${TARGET_NAME}) -add_clang_format_target(onnx_ngraph_frontend_clang FOR_TARGETS onnx_ngraph_frontend) +add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) -ov_ncc_naming_style(FOR_TARGET onnx_ngraph_frontend +ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} INCLUDE_DIRECTORY "${ONNX_FRONTEND_INCLUDE_DIR}" DEFINITIONS $ @@ -40,28 +42,28 @@ ov_ncc_naming_style(FOR_TARGET onnx_ngraph_frontend $) if(COMMAND ie_add_vs_version_file) - ie_add_vs_version_file(NAME onnx_ngraph_frontend + ie_add_vs_version_file(NAME ${TARGET_NAME} FILEDESCRIPTION "nGraph ONNX frontend library") endif() -target_link_libraries(onnx_ngraph_frontend PUBLIC ngraph PRIVATE frontend_manager ngraph::builder onnx_common inference_engine_transformations) +target_link_libraries(${TARGET_NAME} PUBLIC ngraph PRIVATE frontend_manager ngraph::builder onnx_common inference_engine_transformations) -target_include_directories(onnx_ngraph_frontend PUBLIC $ +target_include_directories(${TARGET_NAME} PUBLIC $ $) -target_include_directories(onnx_ngraph_frontend PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) +target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) -target_compile_definitions(onnx_ngraph_frontend PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION}) +target_compile_definitions(${TARGET_NAME} PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION}) if(NGRAPH_USE_PROTOBUF_LITE) - target_compile_definitions(onnx_ngraph_frontend PRIVATE NGRAPH_USE_PROTOBUF_LITE) + target_compile_definitions(${TARGET_NAME} PRIVATE NGRAPH_USE_PROTOBUF_LITE) endif() -install(TARGETS onnx_ngraph_frontend EXPORT ngraphTargets +install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) -set_target_properties(onnx_ngraph_frontend PROPERTIES EXPORT_NAME frontend::onnx) -install(TARGETS onnx_ngraph_frontend EXPORT OpenVINOTargets +set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::onnx) +install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) @@ -72,4 +74,6 @@ install(DIRECTORY ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_frontend COMPONENT ngraph_dev FILES_MATCHING PATTERN "*.hpp") -export(TARGETS onnx_ngraph_frontend NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") +export(TARGETS ${TARGET_NAME} NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") +export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/ngraph/frontend/paddlepaddle/CMakeLists.txt b/ngraph/frontend/paddlepaddle/CMakeLists.txt index 659c5ec29cb60e..e0d43583988ecc 100644 --- a/ngraph/frontend/paddlepaddle/CMakeLists.txt +++ b/ngraph/frontend/paddlepaddle/CMakeLists.txt @@ -99,3 +99,5 @@ install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/paddlepaddle_frontend FILES_MATCHING PATTERN "*.hpp") export(TARGETS ${TARGET_NAME} NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}") +export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/ngraph/python/tests/mock/mock_py_ngraph_frontend/CMakeLists.txt b/ngraph/python/tests/mock/mock_py_ngraph_frontend/CMakeLists.txt index b218da4751fdbb..fac5294a572fdc 100644 --- a/ngraph/python/tests/mock/mock_py_ngraph_frontend/CMakeLists.txt +++ b/ngraph/python/tests/mock/mock_py_ngraph_frontend/CMakeLists.txt @@ -15,7 +15,7 @@ add_library(${TARGET_FE_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS}) target_include_directories(${TARGET_FE_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(${TARGET_FE_NAME} PRIVATE ngraph::frontend_manager::static) +target_link_libraries(${TARGET_FE_NAME} PRIVATE frontend_manager::static) add_clang_format_target(${TARGET_FE_NAME}_clang FOR_TARGETS ${TARGET_FE_NAME}) diff --git a/ngraph/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt b/ngraph/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt index f464e3e316fd50..08755970fb6887 100644 --- a/ngraph/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt +++ b/ngraph/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt @@ -11,7 +11,7 @@ source_group("src" FILES ${PYBIND_FE_SRC}) pybind11_add_module(${PYBIND_FE_NAME} MODULE ${PYBIND_FE_SRC}) -target_link_libraries(${PYBIND_FE_NAME} PRIVATE ${TARGET_FE_NAME} ngraph::frontend_manager::static) +target_link_libraries(${PYBIND_FE_NAME} PRIVATE ${TARGET_FE_NAME} frontend_manager::static) add_clang_format_target(${PYBIND_FE_NAME}_clang FOR_TARGETS ${PYBIND_FE_NAME}) diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index 18cbc60a1368b8..dd7848f590f32d 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -20,7 +20,7 @@ if (NOT TARGET IE::inference_engine) NO_DEFAULT_PATH) endif() -find_package(InferenceEngine REQUIRED) +find_package(OpenVINO REQUIRED) if (NOT ENABLE_FUZZING) message(STATUS diff --git a/tests/lib/src/CMakeLists.txt b/tests/lib/src/CMakeLists.txt index 8a2c8ec7bb054e..bd0f187a46c440 100644 --- a/tests/lib/src/CMakeLists.txt +++ b/tests/lib/src/CMakeLists.txt @@ -9,7 +9,7 @@ add_library(${TARGET_NAME} STATIC ${SRC}) target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -# Search OpenVINO Inference Engine installed -find_package(InferenceEngine REQUIRED) +# Search OpenVINO Runtime installed +find_package(OpenVINO REQUIRED COMPONENTS Runtime) -target_link_libraries(${TARGET_NAME} PUBLIC ${InferenceEngine_LIBRARIES}) +target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime) From 866687354fa058d93a29183ecb29dcadcdba47eb Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 16:49:14 +0300 Subject: [PATCH 09/31] Install OpenVINOConfig.cmake --- .../python/src/openvino/inference_engine/ie_api_impl.hpp | 3 +-- inference-engine/src/inference_engine/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp b/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp index 39e10fa92fd9d2..7f6515d8c0ba49 100644 --- a/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp +++ b/inference-engine/ie_bridges/python/src/openvino/inference_engine/ie_api_impl.hpp @@ -19,9 +19,8 @@ #include #include -#include "ie_core.hpp" - #include "Python.h" +#include "ie_core.hpp" typedef std::chrono::high_resolution_clock Time; typedef std::chrono::nanoseconds ns; diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 0d6b000a04b974..b22d2fa9e82a63 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -360,3 +360,8 @@ install(FILES "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake" "${InferenceEngine_SOURCE_DIR}/cmake/ie_parallel.cmake" DESTINATION ${IE_CPACK_IE_DIR}/share COMPONENT core_dev) + +install(FILES "${CMAKE_BINARY_DIR}/share/OpenVINOConfig.cmake" + "${CMAKE_BINARY_DIR}/OpenVINOConfig-version.cmake" + DESTINATION ${IE_CPACK_IE_DIR}/share + COMPONENT core_dev) From 60d5fef23905f260b800e8630ea171c704d4f229 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 17:38:37 +0300 Subject: [PATCH 10/31] Trying to fix private plugins --- .../InferenceEngineDeveloperPackageConfig.cmake.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 8d747ae34bcf56..4dd18e60c05a0a 100644 --- a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -51,8 +51,13 @@ find_dependency(OpenVINO # WA for cmake: it exports ngraph as IE::ngraph in the IE export list # while we already have ngraph export in its own export list as ngraph::ngraph -set_property(TARGET ngraph::ngraph PROPERTY IMPORTED_GLOBAL TRUE) -add_library(IE::ngraph ALIAS ngraph::ngraph) +if(TARGET ngraph::ngraph) + add_library(IE::ngraph INTERFACE IMPORTED) + set_target_properties(IE::ngraph PROPERTIES INTERFACE_LINK_LIBRARIES ngraph::ngraph) +elseif(TARGET IE::core) + add_library(IE::ngraph INTERFACE IMPORTED) + set_target_properties(IE::ngraph PROPERTIES INTERFACE_LINK_LIBRARIES IE::core) +endif() foreach(component @openvino_export_components@) include("${CMAKE_CURRENT_LIST_DIR}/${component}_dev_targets.cmake") From 28cd2e36a264c6a331927f97f2aa6053e6386a47 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 17:42:17 +0300 Subject: [PATCH 11/31] Trying to fix .tox --- .ci/openvino-onnx/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index 3a190c42769fdf..a629fe5ba50606 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -75,7 +75,7 @@ RUN make -j $(nproc) install # Run tests via tox WORKDIR /openvino/ngraph/python -ENV ngraph_DIR=/openvino/dist/deployment_tools/ngraph +ENV OpenVINO_DIR=/openvino/dist/deployment_tools/inference_engine/share ENV LD_LIBRARY_PATH=/openvino/dist/deployment_tools/ngraph/lib ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH} CMD tox From 65103fb2cc5fa0dd0ec163bd9929bc29ca62ce3b Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 19:05:00 +0300 Subject: [PATCH 12/31] Trying to fix ARM --- .../templates/InferenceEngineDeveloperPackageConfig.cmake.in | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 4dd18e60c05a0a..cdb02f8b8afa5f 100644 --- a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -51,12 +51,9 @@ find_dependency(OpenVINO # WA for cmake: it exports ngraph as IE::ngraph in the IE export list # while we already have ngraph export in its own export list as ngraph::ngraph -if(TARGET ngraph::ngraph) +if(TARGET ngraph::ngraph AND NOT TARGET IE::ngraph) add_library(IE::ngraph INTERFACE IMPORTED) set_target_properties(IE::ngraph PROPERTIES INTERFACE_LINK_LIBRARIES ngraph::ngraph) -elseif(TARGET IE::core) - add_library(IE::ngraph INTERFACE IMPORTED) - set_target_properties(IE::ngraph PROPERTIES INTERFACE_LINK_LIBRARIES IE::core) endif() foreach(component @openvino_export_components@) From 5e3019b23505e12507382ad4f3a6013ce277dbed Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 19:08:59 +0300 Subject: [PATCH 13/31] Fixed samples build --- inference-engine/src/inference_engine/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index b22d2fa9e82a63..3147ef00d52425 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -292,7 +292,9 @@ install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core - INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include) + INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include + # TODO: remove later once samples are updated + ${IE_CPACK_IE_DIR}/include) install(FILES $/plugins.xml DESTINATION ${IE_CPACK_RUNTIME_PATH} From 356540f08820c1d652b58c248732d8edb49b52f2 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 19:22:16 +0300 Subject: [PATCH 14/31] Explicit ngraph duplicated targets --- cmake/templates/ngraphConfig.cmake.in | 35 +++++++++++++++++---------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/cmake/templates/ngraphConfig.cmake.in b/cmake/templates/ngraphConfig.cmake.in index 4ed4965d04af99..52a107da536391 100644 --- a/cmake/templates/ngraphConfig.cmake.in +++ b/cmake/templates/ngraphConfig.cmake.in @@ -41,20 +41,29 @@ if(NOT TARGET ngraph) include("${CMAKE_CURRENT_LIST_DIR}/ngraphTargets.cmake") # create targets with old names for compatibility - set(core ngraph) - set(frontendXmanager frontend_manager) - set(frontendXonnx onnx_ngraph_frontend) - set(frontendXpaddlepaddle paddlepaddle_ngraph_frontend) + if(TARGET ngraph::core AND NOT TARGET ngraph::ngraph) + add_library(ngraph::ngraph INTERFACE IMPORTED) + set_target_properties(ngraph::ngraph PROPERTIES + INTERFACE_LINK_LIBRARIES ngraph::core) + endif() + + if(TARGET ngraph::frontend::manager AND NOT TARGET ngraph::frontend_manager) + add_library(ngraph::frontend_manager INTERFACE IMPORTED) + set_target_properties(ngraph::frontend_manager PROPERTIES + INTERFACE_LINK_LIBRARIES ngraph::frontend::manager) + endif() - foreach(target core frontend_manager frontendXonnx frontendXpaddlepaddle) - string(REPLACE "X" "::" patched_target ${target}) - set(new_target ngraph::${target}) - if(TARGET ngraph::${patched_target} AND NOT TARGET ${new_target}) - add_library(${new_target} INTERFACE IMPORTED) - set_target_properties(${new_target} PROPERTIES - INTERFACE_LINK_LIBRARIES ngraph::${patched_target}) - endif() - endforeach() + if(TARGET ngraph::frontend::onnx AND NOT TARGET ngraph::onnx_ngraph_frontend) + add_library(ngraph::onnx_ngraph_frontend INTERFACE IMPORTED) + set_target_properties(ngraph::onnx_ngraph_frontend PROPERTIES + INTERFACE_LINK_LIBRARIES ngraph::frontend::onnx) + endif() + + if(TARGET ngraph::frontend::paddlepaddle AND NOT TARGET ngraph::paddlepaddle_ngraph_frontend) + add_library(ngraph::paddlepaddle_ngraph_frontend INTERFACE IMPORTED) + set_target_properties(ngraph::paddlepaddle_ngraph_frontend PROPERTIES + INTERFACE_LINK_LIBRARIES ngraph::frontend::paddlepaddle) + endif() endif() set(ngraph_ngraph_FOUND ON) From 42e746df0f40ca33ae919cf29b33304dfd39d1a0 Mon Sep 17 00:00:00 2001 From: y Date: Wed, 8 Sep 2021 20:01:24 +0300 Subject: [PATCH 15/31] Fixed fuzzing tests build --- tests/fuzz/CMakeLists.txt | 10 ++++------ tests/fuzz/src/CMakeLists.txt | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index dd7848f590f32d..a5f46c5a07e2d4 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -13,12 +13,10 @@ endif() set(OpenVINO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../") -if (NOT TARGET IE::inference_engine) - find_package(IEDevScripts REQUIRED - PATHS "${OpenVINO_SOURCE_DIR}/cmake/developer_package" - NO_CMAKE_FIND_ROOT_PATH - NO_DEFAULT_PATH) -endif() +find_package(IEDevScripts REQUIRED + PATHS "${OpenVINO_SOURCE_DIR}/cmake/developer_package" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) find_package(OpenVINO REQUIRED) diff --git a/tests/fuzz/src/CMakeLists.txt b/tests/fuzz/src/CMakeLists.txt index 7ae1097443fd19..59056ea3674ac8 100644 --- a/tests/fuzz/src/CMakeLists.txt +++ b/tests/fuzz/src/CMakeLists.txt @@ -16,8 +16,8 @@ foreach(test_source ${tests}) get_filename_component(test_name ${test_source} NAME_WE) add_fuzzer(${test_name} ${test_source}) - target_link_libraries(${test_name} PRIVATE IE::inference_engine cnpy zlib ${NGRAPH_LIBRARIES} - ngraph::frontend_manager) + target_link_libraries(${test_name} PRIVATE + openvino::runtime openvino::frontend::manager cnpy zlib) add_dependencies(fuzz ${test_name}) From 691fc6472956f87809dac6f8feee0fac57e516fc Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 11:55:00 +0300 Subject: [PATCH 16/31] Added IR frontend installation --- inference-engine/src/inference_engine/CMakeLists.txt | 8 +++++++- ngraph/frontend/ir/CMakeLists.txt | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 3147ef00d52425..382098664cf9e0 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -287,6 +287,12 @@ install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include/ie) +# TODO: remove once inference_engine_ir_reader is removed +install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core + ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) + set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime) install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core @@ -294,7 +300,7 @@ install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include # TODO: remove later once samples are updated - ${IE_CPACK_IE_DIR}/include) + ${IE_CPACK_IE_DIR}/include/ie) install(FILES $/plugins.xml DESTINATION ${IE_CPACK_RUNTIME_PATH} diff --git a/ngraph/frontend/ir/CMakeLists.txt b/ngraph/frontend/ir/CMakeLists.txt index 30f045c137f29b..b7cf9056bf5fd8 100644 --- a/ngraph/frontend/ir/CMakeLists.txt +++ b/ngraph/frontend/ir/CMakeLists.txt @@ -41,8 +41,13 @@ if(COMMAND ie_add_vs_version_file) endif() target_link_libraries(${TARGET_NAME} PRIVATE frontend_manager::static - PRIVATE ngraph::builder inference_engine_transformations + ngraph::builder inference_engine_transformations inference_engine pugixml::static inference_engine_plugin_api) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) + +install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets + RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph + LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) From 22e37574510143885e95197c8af73a60f721f8eb Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 11:58:49 +0300 Subject: [PATCH 17/31] Removed install directory for IE reader --- ngraph/frontend/ir/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/ngraph/frontend/ir/CMakeLists.txt b/ngraph/frontend/ir/CMakeLists.txt index b7cf9056bf5fd8..4d74d6cba1c24f 100644 --- a/ngraph/frontend/ir/CMakeLists.txt +++ b/ngraph/frontend/ir/CMakeLists.txt @@ -28,7 +28,6 @@ ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} target_include_directories(${TARGET_NAME} PUBLIC $ - $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}) From f75286e456465642b9e019714f6aecc574ab5a52 Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 12:10:26 +0300 Subject: [PATCH 18/31] Removed IR frontend from export list --- inference-engine/src/inference_engine/CMakeLists.txt | 6 ------ ngraph/frontend/ir/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 382098664cf9e0..f0cb4a1348e377 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -287,12 +287,6 @@ install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include/ie) -# TODO: remove once inference_engine_ir_reader is removed -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) - set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime) install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core diff --git a/ngraph/frontend/ir/CMakeLists.txt b/ngraph/frontend/ir/CMakeLists.txt index 4d74d6cba1c24f..5ec3a54036127c 100644 --- a/ngraph/frontend/ir/CMakeLists.txt +++ b/ngraph/frontend/ir/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(${TARGET_NAME} PRIVATE frontend_manager::static add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets +install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) From 61efd81ae8924441ce58c9bd2f68dfa00d7d9110 Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 14:16:20 +0300 Subject: [PATCH 19/31] Reverted ngraph_DIR --- .ci/openvino-onnx/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index dae27a71177403..3451a0dfa12b10 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -75,6 +75,7 @@ RUN make -j $(nproc) install # Run tests via tox WORKDIR /openvino/runtime/bindings/python +ENV ngraph_DIR=/openvino/dist/deployment_tools/ngraph ENV OpenVINO_DIR=/openvino/dist/deployment_tools/inference_engine/share ENV LD_LIBRARY_PATH=/openvino/dist/deployment_tools/ngraph/lib ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH} From 3e011a42177adb30d7fb4da4f9f30e85aeb0abff Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 15:03:57 +0300 Subject: [PATCH 20/31] Try to fix .tox --- .ci/openvino-onnx/Dockerfile | 1 - docs/CMakeLists.txt | 2 +- docs/IE_DG/Extensibility_DG/Building.md | 2 +- docs/doxygen/ngraph_cpp_api.config | 3 ++- runtime/CMakeLists.txt | 1 - runtime/bindings/python/CMakeLists.txt | 4 ++++ runtime/bindings/python/src/compatibility/CMakeLists.txt | 1 - .../bindings/python/src/compatibility/pyngraph/CMakeLists.txt | 2 -- runtime/bindings/python/tox.ini | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index 3451a0dfa12b10..4e1a6ad551ac02 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -76,7 +76,6 @@ RUN make -j $(nproc) install # Run tests via tox WORKDIR /openvino/runtime/bindings/python ENV ngraph_DIR=/openvino/dist/deployment_tools/ngraph -ENV OpenVINO_DIR=/openvino/dist/deployment_tools/inference_engine/share ENV LD_LIBRARY_PATH=/openvino/dist/deployment_tools/ngraph/lib ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH} CMD tox diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 3ccce334c4f549..6eac6cc9ecbffa 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -64,7 +64,7 @@ function(build_docs) set(C_API "${IE_SOURCE_DIR}/ie_bridges/c/include") set(PLUGIN_API_DIR "${DOCS_BUILD_DIR}/IE_PLUGIN_DG") set(NGRAPH_DIR "${OpenVINO_SOURCE_DIR}/ngraph") - set(NGRAPH_PY_DIR "${NGRAPH_DIR}/python/src/ngraph/") + set(NGRAPH_PY_DIR "${OpenVINO_SOURCE_DIR}/runtime/bindings/python/src/compatibility/ngraph/") set(NGRAPH_CPP_DIR "${NGRAPH_DIR}/core/include/" "${NGRAPH_DIR}/frontend/onnx_import/include") # Preprocessing scripts diff --git a/docs/IE_DG/Extensibility_DG/Building.md b/docs/IE_DG/Extensibility_DG/Building.md index d1f62cb53a822d..be93c5a06d3bc9 100644 --- a/docs/IE_DG/Extensibility_DG/Building.md +++ b/docs/IE_DG/Extensibility_DG/Building.md @@ -14,6 +14,6 @@ To build an extension library, run the commands below: $ cd template_extension $ mkdir build $ cd build -$ cmake -DInferenceEngine_DIR=[IE_DIR] -Dngraph_DIR=[NGRAPH_DIR] ../ +$ cmake -DOpenVINO_DIR=[OpenVINO_DIR] ../ $ cmake --build . ``` diff --git a/docs/doxygen/ngraph_cpp_api.config b/docs/doxygen/ngraph_cpp_api.config index e289689d3156a1..2b0b50b6d70b59 100644 --- a/docs/doxygen/ngraph_cpp_api.config +++ b/docs/doxygen/ngraph_cpp_api.config @@ -29,7 +29,8 @@ FILE_PATTERNS = *.cpp \ LAYOUT_FILE = "@NGRAPH_CPP_LAYOUT_BUILD@" INPUT = "@NGRAPH_DIR@/core/include/" \ - "@NGRAPH_DIR@/frontend/onnx_import/include" + "@NGRAPH_DIR@/frontend/onnx/frontend/include/" \ + "@NGRAPH_DIR@/frontend/paddlepaddle/frontend/include/" HTML_OUTPUT = "@NGRAPH_CPP_OUTPUT@" diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index d0078e44507f96..88bc70641273a3 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # - if(ENABLE_PYTHON) add_subdirectory(bindings/python) endif() diff --git a/runtime/bindings/python/CMakeLists.txt b/runtime/bindings/python/CMakeLists.txt index 7aaecb7e90cdc3..4e1b972c17a0a2 100644 --- a/runtime/bindings/python/CMakeLists.txt +++ b/runtime/bindings/python/CMakeLists.txt @@ -2,6 +2,10 @@ # SPDX-License-Identifier: Apache-2.0 # +cmake_minimum_required (VERSION 3.13) + +project(OpenVINOPython DESCRIPTION "OpenVINO Runtime Python bindings") + set(LIBRARY_OUTPUT_DIRECTORY_BIN ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) add_subdirectory(thirdparty/pybind11 EXCLUDE_FROM_ALL) diff --git a/runtime/bindings/python/src/compatibility/CMakeLists.txt b/runtime/bindings/python/src/compatibility/CMakeLists.txt index e56cfdb90843fb..d3272c94ca4ac1 100644 --- a/runtime/bindings/python/src/compatibility/CMakeLists.txt +++ b/runtime/bindings/python/src/compatibility/CMakeLists.txt @@ -2,5 +2,4 @@ # SPDX-License-Identifier: Apache-2.0 # - add_subdirectory(pyngraph) diff --git a/runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt b/runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt index f2da5507c9e9e6..dc0644adb86a80 100644 --- a/runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt +++ b/runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt @@ -2,8 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # -cmake_minimum_required (VERSION 3.13) - project (pyngraph) if(NOT DEFINED OpenVINO_SOURCE_DIR) diff --git a/runtime/bindings/python/tox.ini b/runtime/bindings/python/tox.ini index d19da1a3005332..7f0acd7e96ddf8 100644 --- a/runtime/bindings/python/tox.ini +++ b/runtime/bindings/python/tox.ini @@ -10,7 +10,7 @@ deps = setenv = NGRAPH_BACKEND = {env:NGRAPH_BACKEND:"CPU"} PYTHONPATH = {env:PYTHONPATH} - ngraph_DIR = {env:ngraph_DIR} + OpenVINO_DIR = {env:OpenVINO_DIR} passenv = http_proxy https_proxy From 4a1d60bb0219c569dcbb51bb8360835627bfd7b1 Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 16:41:54 +0300 Subject: [PATCH 21/31] Fixed ieFuncTests with ONNX extensions --- cmake/templates/OpenVINOConfig.cmake.in | 6 ++++++ docs/template_extension/CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in index f8d2ed6b4651f7..f105f335e937e0 100644 --- a/cmake/templates/OpenVINOConfig.cmake.in +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -167,6 +167,9 @@ set(${CMAKE_FIND_PACKAGE_NAME}_Runtime_FOUND ON) set(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@) set(${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND @NGRAPH_PDPD_FRONTEND_ENABLE@) +set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_ONNX_FOUND ${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND) +set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_PaddlePaddle_FOUND ${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND) + # if no components specified, only Runtime is provided if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS Runtime) @@ -195,3 +198,6 @@ if(_need_package_name_reset) unset(CMAKE_FIND_PACKAGE_NAME) unset(_need_package_name_reset) endif() + +unset(${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND) +unset(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND) diff --git a/docs/template_extension/CMakeLists.txt b/docs/template_extension/CMakeLists.txt index eb95a1a9225c5a..90a9e886b35e62 100644 --- a/docs/template_extension/CMakeLists.txt +++ b/docs/template_extension/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 11) set(TARGET_NAME "template_extension") -find_package(OpenVINO REQUIRED OPTIONAL_COMPONENTS Runtime ONNX) +find_package(OpenVINO REQUIRED COMPONENTS Runtime OPTIONAL_COMPONENTS ONNX) find_package(OpenCV QUIET COMPONENTS core) set(SRC cpu_kernel.cpp extension.cpp op.cpp) From 587a312a5f263cab538c0bb59b2ee25006204e4e Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 16:50:00 +0300 Subject: [PATCH 22/31] Attempt #2 --- .ci/openvino-onnx/Dockerfile | 1 - runtime/bindings/python/tox.ini | 1 - 2 files changed, 2 deletions(-) diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index 4e1a6ad551ac02..aeceaa02268e96 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -75,7 +75,6 @@ RUN make -j $(nproc) install # Run tests via tox WORKDIR /openvino/runtime/bindings/python -ENV ngraph_DIR=/openvino/dist/deployment_tools/ngraph ENV LD_LIBRARY_PATH=/openvino/dist/deployment_tools/ngraph/lib ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH} CMD tox diff --git a/runtime/bindings/python/tox.ini b/runtime/bindings/python/tox.ini index 7f0acd7e96ddf8..695fb6af787b03 100644 --- a/runtime/bindings/python/tox.ini +++ b/runtime/bindings/python/tox.ini @@ -10,7 +10,6 @@ deps = setenv = NGRAPH_BACKEND = {env:NGRAPH_BACKEND:"CPU"} PYTHONPATH = {env:PYTHONPATH} - OpenVINO_DIR = {env:OpenVINO_DIR} passenv = http_proxy https_proxy From 4e9e02ce41d61c77c4e30597fe10ab5bea88e539 Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 17:09:34 +0300 Subject: [PATCH 23/31] Trying to fix ngraph setup.py --- runtime/bindings/python/setup.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/runtime/bindings/python/setup.py b/runtime/bindings/python/setup.py index d8c620ab4b524b..31f4d91b57a925 100644 --- a/runtime/bindings/python/setup.py +++ b/runtime/bindings/python/setup.py @@ -18,9 +18,8 @@ __version__ = os.environ.get("NGRAPH_VERSION", "0.0.0.dev0") PYNGRAPH_ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) -NGRAPH_ROOT_DIR = os.path.normpath(os.path.join(PYNGRAPH_ROOT_DIR, "..")) -OPENVINO_ROOT_DIR = os.path.normpath(os.path.join(PYNGRAPH_ROOT_DIR, "../..")) -# Change current working dircectory to ngraph/python +OPENVINO_ROOT_DIR = os.path.normpath(os.path.join(PYNGRAPH_ROOT_DIR, "../../..")) +# Change current working directory to runtime/bindings/python os.chdir(PYNGRAPH_ROOT_DIR) NGRAPH_LIBS = ["ngraph", "onnx_ngraph_frontend"] @@ -145,16 +144,17 @@ def build_cmake(self, extension: Extension): os.makedirs(build_dir, exist_ok=True) os.makedirs(extension_path.parent.absolute(), exist_ok=True) - # If ngraph_DIR is not set try to build from OpenVINO root + # If OpenVINO_DIR is set, try to build Python only, + # otherwise build from scratch using OpenVINO root root_dir = OPENVINO_ROOT_DIR bin_dir = os.path.join(OPENVINO_ROOT_DIR, "bin") - if os.environ.get("ngraph_DIR") is not None: + if os.environ.get("OpenVINO_DIR") is not None: root_dir = PYNGRAPH_ROOT_DIR bin_dir = build_dir self.announce("Configuring cmake project", level=3) ext_args = self.cmake_args.split() if self.cmake_args else [] - self.spawn(["cmake", "-H" + root_dir, "-B" + self.build_temp, + self.spawn(["cmake", "-S " + root_dir, "-B " + self.build_temp, "-DCMAKE_BUILD_TYPE={}".format(self.config), "-DENABLE_PYTHON=ON", "-DNGRAPH_ONNX_FRONTEND_ENABLE=ON"] + ext_args) @@ -181,8 +181,9 @@ def run(self): self.announce("Adding library files", level=3) root_dir = os.path.join(OPENVINO_ROOT_DIR, "bin") - if os.environ.get("ngraph_DIR") is not None: - root_dir = pathlib.Path(os.environ["ngraph_DIR"]) / ".." + if os.environ.get("OpenVINO_DIR") is not None: + # TODO: fix it + root_dir = pathlib.Path(os.environ["ngraph_DIR"]) lib_ext = "" if "linux" in sys.platform: From b7ee2f815c87f4bc30f7b59fb3734315ced60d5f Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 19:01:10 +0300 Subject: [PATCH 24/31] Fix --- cmake/templates/OpenVINOConfig.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in index f105f335e937e0..14fc57b36c258d 100644 --- a/cmake/templates/OpenVINOConfig.cmake.in +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -167,8 +167,8 @@ set(${CMAKE_FIND_PACKAGE_NAME}_Runtime_FOUND ON) set(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@) set(${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND @NGRAPH_PDPD_FRONTEND_ENABLE@) -set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_ONNX_FOUND ${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND) -set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_PaddlePaddle_FOUND ${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND) +set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_ONNX_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND}) +set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_PaddlePaddle_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND}) # if no components specified, only Runtime is provided if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS) From 44f523c28d0362edbb73fda2320424075ba3211c Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 19:37:41 +0300 Subject: [PATCH 25/31] Trying to fix ONNX ngraph .tox CI --- .ci/openvino-onnx/Dockerfile | 1 + runtime/bindings/python/tox.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index aeceaa02268e96..dae27a71177403 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -75,6 +75,7 @@ RUN make -j $(nproc) install # Run tests via tox WORKDIR /openvino/runtime/bindings/python +ENV OpenVINO_DIR=/openvino/dist/deployment_tools/inference_engine/share ENV LD_LIBRARY_PATH=/openvino/dist/deployment_tools/ngraph/lib ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/lib/python_api/python3.8:${PYTHONPATH} CMD tox diff --git a/runtime/bindings/python/tox.ini b/runtime/bindings/python/tox.ini index 695fb6af787b03..7f0acd7e96ddf8 100644 --- a/runtime/bindings/python/tox.ini +++ b/runtime/bindings/python/tox.ini @@ -10,6 +10,7 @@ deps = setenv = NGRAPH_BACKEND = {env:NGRAPH_BACKEND:"CPU"} PYTHONPATH = {env:PYTHONPATH} + OpenVINO_DIR = {env:OpenVINO_DIR} passenv = http_proxy https_proxy From 97be889dce780720e60193cc3b609e99a0929bdf Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 20:01:07 +0300 Subject: [PATCH 26/31] Trying to remove spaces --- runtime/bindings/python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/bindings/python/setup.py b/runtime/bindings/python/setup.py index 31f4d91b57a925..762059410977bd 100644 --- a/runtime/bindings/python/setup.py +++ b/runtime/bindings/python/setup.py @@ -154,7 +154,7 @@ def build_cmake(self, extension: Extension): self.announce("Configuring cmake project", level=3) ext_args = self.cmake_args.split() if self.cmake_args else [] - self.spawn(["cmake", "-S " + root_dir, "-B " + self.build_temp, + self.spawn(["cmake", "-S" + root_dir, "-B" + self.build_temp, "-DCMAKE_BUILD_TYPE={}".format(self.config), "-DENABLE_PYTHON=ON", "-DNGRAPH_ONNX_FRONTEND_ENABLE=ON"] + ext_args) From d0e7573b82d707cc1e7225d8db3e0ad2265ec610 Mon Sep 17 00:00:00 2001 From: y Date: Thu, 9 Sep 2021 20:17:13 +0300 Subject: [PATCH 27/31] Fixed ngraph_DIR -> OpenVINO_DIR --- runtime/bindings/python/setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/bindings/python/setup.py b/runtime/bindings/python/setup.py index 762059410977bd..2cb709da133f65 100644 --- a/runtime/bindings/python/setup.py +++ b/runtime/bindings/python/setup.py @@ -182,8 +182,7 @@ def run(self): root_dir = os.path.join(OPENVINO_ROOT_DIR, "bin") if os.environ.get("OpenVINO_DIR") is not None: - # TODO: fix it - root_dir = pathlib.Path(os.environ["ngraph_DIR"]) + root_dir = pathlib.Path(os.environ["OpenVINO_DIR"]) lib_ext = "" if "linux" in sys.platform: From 30e4105ac26251774319bcd5229ea6a0b8e36d26 Mon Sep 17 00:00:00 2001 From: y Date: Fri, 10 Sep 2021 12:05:22 +0300 Subject: [PATCH 28/31] Removed junk files --- inference-engine/ie_bridges/python/wheel/.env | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 inference-engine/ie_bridges/python/wheel/.env diff --git a/inference-engine/ie_bridges/python/wheel/.env b/inference-engine/ie_bridges/python/wheel/.env deleted file mode 100644 index 53b4674c21d8dd..00000000000000 --- a/inference-engine/ie_bridges/python/wheel/.env +++ /dev/null @@ -1,16 +0,0 @@ -WHEEL_PACKAGE_NAME=openvino -WHEEL_VERSION=0.0.0 -WHEEL_LICENCE_TYPE=OSI Approved :: Apache Software License -WHEEL_AUTHOR=Intel Corporation -WHEEL_AUTHOR_EMAIL=openvino_pushbot@intel.com -WHEEL_DESC=Inference Engine Python* API -WHEEL_LICENSE=/home/sandye51/Documents/Programming/git_repo/dldt/LICENSE -WHEEL_REQUIREMENTS=/home/sandye51/Documents/Programming/git_repo/dldt/inference-engine/ie_bridges/python/wheel/meta/openvino.requirements.txt -WHEEL_OVERVIEW=/home/sandye51/Documents/Programming/git_repo/dldt/inference-engine/ie_bridges/python/wheel/meta/pypi_overview.md - -CMAKE_BUILD_DIR=/home/sandye51/Documents/Programming/builds/dldt-release-gcc9 -CORE_LIBS_DIR=deployment_tools/inference_engine/lib/intel64 -PLUGINS_LIBS_DIR=deployment_tools/inference_engine/lib/intel64 -NGRAPH_LIBS_DIR=deployment_tools/ngraph/lib -TBB_LIBS_DIR=deployment_tools/inference_engine/external/tbb/lib -PY_PACKAGES_DIR=python/python3.8 From c7f8f03d4336e6dbce21c3f5114f9a37ccaaf124 Mon Sep 17 00:00:00 2001 From: y Date: Fri, 10 Sep 2021 12:46:39 +0300 Subject: [PATCH 29/31] Try to fix ngraph wheel --- runtime/bindings/python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/bindings/python/setup.py b/runtime/bindings/python/setup.py index 2cb709da133f65..dc255f5bb886fe 100644 --- a/runtime/bindings/python/setup.py +++ b/runtime/bindings/python/setup.py @@ -182,7 +182,7 @@ def run(self): root_dir = os.path.join(OPENVINO_ROOT_DIR, "bin") if os.environ.get("OpenVINO_DIR") is not None: - root_dir = pathlib.Path(os.environ["OpenVINO_DIR"]) + root_dir = pathlib.Path(self.build_temp) lib_ext = "" if "linux" in sys.platform: From 1d619941711158406817e0c87ea952340a76d704 Mon Sep 17 00:00:00 2001 From: y Date: Fri, 10 Sep 2021 12:48:24 +0300 Subject: [PATCH 30/31] Try to fix ie_wheel --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e10fddd5c409f..e5ee874a7ac8d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,13 +84,14 @@ include(cmake/test_model_zoo.cmake) add_subdirectory(thirdparty) add_subdirectory(openvino) add_subdirectory(ngraph) + +add_subdirectory(runtime) add_subdirectory(inference-engine) # for Template plugin openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph_backend interpreter_backend) include(cmake/extra_modules.cmake) -add_subdirectory(runtime) add_subdirectory(model-optimizer) add_subdirectory(docs) add_subdirectory(tools) From 4b24008c38c69e2d032c819ad12f42d4606cd1e8 Mon Sep 17 00:00:00 2001 From: y Date: Fri, 10 Sep 2021 13:13:51 +0300 Subject: [PATCH 31/31] Try to fix ngraph wheel --- runtime/bindings/python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/bindings/python/setup.py b/runtime/bindings/python/setup.py index dc255f5bb886fe..0cd8167f263fc1 100644 --- a/runtime/bindings/python/setup.py +++ b/runtime/bindings/python/setup.py @@ -182,7 +182,7 @@ def run(self): root_dir = os.path.join(OPENVINO_ROOT_DIR, "bin") if os.environ.get("OpenVINO_DIR") is not None: - root_dir = pathlib.Path(self.build_temp) + root_dir = pathlib.Path(PYNGRAPH_ROOT_DIR) lib_ext = "" if "linux" in sys.platform: