diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index 4e1a6ad551ac02..dae27a71177403 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/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/CMakeLists.txt b/CMakeLists.txt index 40a888800dac98..e5ee874a7ac8d9 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) @@ -83,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) diff --git a/cmake/templates/InferenceEngineConfig.cmake.in b/cmake/templates/InferenceEngineConfig.cmake.in index 43408483f9af6e..c5b95bd75efc68 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_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() # mark components as available diff --git a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 72af5ca89cadac..cdb02f8b8afa5f 100644 --- a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -44,10 +44,17 @@ 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) -add_library(IE::ngraph ALIAS 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) +endif() foreach(component @openvino_export_components@) include("${CMAKE_CURRENT_LIST_DIR}/${component}_dev_targets.cmake") 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/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in new file mode 100644 index 00000000000000..14fc57b36c258d --- /dev/null +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -0,0 +1,203 @@ +# 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 Core & Inference Runtime, frontend manager +# * `ONNX`: OpenVINO ONNX frontend +# * `PaddlePaddle`: OpenVINO PaddlePaddle frontend +# +# If no components are specified, `Runtime` component is provided: +# +# find_package(OpenVINO REQUIRED) # only Runtime component +# +# If specific components are required: +# +# find_package(OpenVINO REQUIRED COMPONENTS Runtime ONNX) +# +# Imported Targets: +# ------ +# +# Runtime targets: +# +# `openvino::runtime` +# The OpenVINO C++ Core & Inference Runtime +# +# `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::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_Runtime_FOUND` +# OpenVINO C++ Core & Inference Runtime is available +# +# `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() + +if(NOT TARGET inference_engine) + set(_ov_as_external_package ON) + include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake") +endif() + +# +# 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@) + +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) +endif() + +# +# Apply common functions +# + +foreach(target openvino::runtime openvino::runtime::c openvino::core + openvino::frontend::manager openvino::frontend::onnx + openvino::frontend::paddlepaddle) + if(TARGET ${target} AND _ov_as_external_package) + _ov_target_no_deprecation_error(${target}) + endif() +endforeach() +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() + +unset(${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND) +unset(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND) diff --git a/cmake/templates/ngraphConfig.cmake.in b/cmake/templates/ngraphConfig.cmake.in index 1c17cbeb4cc49a..52a107da536391 100644 --- a/cmake/templates/ngraphConfig.cmake.in +++ b/cmake/templates/ngraphConfig.cmake.in @@ -39,6 +39,31 @@ if(NOT TARGET ngraph) include("${CMAKE_CURRENT_LIST_DIR}/ngraphTargets.cmake") + + # create targets with old names for compatibility + 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() + + 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) @@ -46,19 +71,18 @@ 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() set(ngraph_paddlepaddle_frontend_FOUND @NGRAPH_PDPD_FRONTEND_ENABLE@) -set(ir_frontend_FOUND @IR_FRONTEND_ENABLE@) check_required_components(ngraph) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 4d3135903de149..6eac6cc9ecbffa 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) @@ -72,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/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/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/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..90a9e886b35e62 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 COMPONENTS Runtime OPTIONAL_COMPONENTS 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 a0e1b3469c937a..5cf46942f50d5f 100644 --- a/inference-engine/ie_bridges/c/src/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/src/CMakeLists.txt @@ -10,11 +10,11 @@ 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) target_include_directories(${TARGET_NAME} PUBLIC - $ $) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) @@ -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) @@ -37,7 +41,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/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 21ba2b7dbe5d81..d72465341b235a 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,10 +4,8 @@ #include "ie_api_impl.hpp" -#include - -#include "ie_iinfer_request.hpp" #include "ie_plugin_config.hpp" +#include "ngraph/partial_shape.hpp" const std::string EXPORTED_NETWORK_NAME = "undefined"; std::map precision_map = {{"FP32", InferenceEngine::Precision::FP32}, 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 028bbd3ad740d3..6d479784d1454d 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 @@ -23,6 +20,7 @@ #include #include "Python.h" +#include "ie_core.hpp" typedef std::chrono::high_resolution_clock Time; typedef std::chrono::nanoseconds ns; 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 3e42fa84f2e429..b78e32b2fa79a3 100644 --- a/inference-engine/samples/CMakeLists.txt +++ b/inference-engine/samples/CMakeLists.txt @@ -33,11 +33,8 @@ 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(InferenceEngine_DIR "${CMAKE_BINARY_DIR}") - # hint for find_package(ngraph in the samples folder) - set(ngraph_DIR ${CMAKE_BINARY_DIR}/ngraph) + set(IE_MAIN_SAMPLES_DIR "${OpenVINO_SOURCE_DIR}") + set(OpenVINO_DIR "${CMAKE_BINARY_DIR}") else() # in case if samples are built out of IE repo set(IE_MAIN_SAMPLES_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -128,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") @@ -209,14 +206,13 @@ macro(ie_add_sample) set(folder_name c_samples) endif() + find_package(OpenVINO REQUIRED COMPONENTS Runtime) if(c_sample) - set(ie_component inference_engine_c_api) + set(ov_link_libraries openvino::runtime::c) else() - set(ie_component inference_engine) + set(ov_link_libraries openvino::runtime) 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 +221,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/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/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index e79a57093669c8..f0cb4a1348e377 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,14 +168,12 @@ 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 $ $ - $ - $ PRIVATE $ $) @@ -209,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) @@ -223,8 +223,11 @@ set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s # Export for build tree -export(TARGETS ngraph ${TARGET_NAME} NAMESPACE IE:: - APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") +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 @@ -281,7 +284,17 @@ 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 + INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include + # TODO: remove later once samples are updated + ${IE_CPACK_IE_DIR}/include/ie) install(FILES $/plugins.xml DESTINATION ${IE_CPACK_RUNTIME_PATH} @@ -304,6 +317,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 +332,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,12 +347,23 @@ 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" "${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) 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/inference-engine/src/transformations/CMakeLists.txt b/inference-engine/src/transformations/CMakeLists.txt index bf4a4f31d6ae69..59af88ea36e439 100644 --- a/inference-engine/src/transformations/CMakeLists.txt +++ b/inference-engine/src/transformations/CMakeLists.txt @@ -53,3 +53,15 @@ 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) + +# 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/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/core/CMakeLists.txt b/ngraph/core/CMakeLists.txt index 70be17b1281eaa..076958a3be4906 100644 --- a/ngraph/core/CMakeLists.txt +++ b/ngraph/core/CMakeLists.txt @@ -71,25 +71,52 @@ 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) -#Add an alias so that library can be used inside the build tree, e.g. when testing +# Add an alias so that library can be used inside the build tree, e.g. when testing add_library(ngraph::ngraph ALIAS ngraph) +add_library(openvino::core 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}) + +# 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 + 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} diff --git a/ngraph/frontend/frontend_manager/CMakeLists.txt b/ngraph/frontend/frontend_manager/CMakeLists.txt index cdb93d5fc0f342..df6cbe07a09a24 100644 --- a/ngraph/frontend/frontend_manager/CMakeLists.txt +++ b/ngraph/frontend/frontend_manager/CMakeLists.txt @@ -17,7 +17,7 @@ source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) # Static library add_library(${TARGET_NAME}_static STATIC ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) -add_library(ngraph::${TARGET_NAME}::static ALIAS ${TARGET_NAME}_static) +add_library(${TARGET_NAME}::static ALIAS ${TARGET_NAME}_static) target_link_libraries(${TARGET_NAME}_static PRIVATE ${CMAKE_DL_LIBS} PUBLIC ngraph) target_include_directories(${TARGET_NAME}_static PUBLIC ${FRONTEND_INCLUDE_DIR}) target_include_directories(${TARGET_NAME}_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) @@ -28,8 +28,10 @@ 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}) +add_library(openvino::frontend::manager 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) @@ -53,9 +55,17 @@ install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets 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} - 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}") +export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") diff --git a/ngraph/frontend/ir/CMakeLists.txt b/ngraph/frontend/ir/CMakeLists.txt index 181bfda9d62e07..5ec3a54036127c 100644 --- a/ngraph/frontend/ir/CMakeLists.txt +++ b/ngraph/frontend/ir/CMakeLists.txt @@ -23,12 +23,11 @@ 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 $ - $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}) @@ -40,22 +39,14 @@ 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 - PRIVATE ngraph::builder inference_engine_transformations +target_link_libraries(${TARGET_NAME} PRIVATE frontend_manager::static + 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 +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) - -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..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,35 +29,41 @@ 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(ngraph::onnx_ngraph_frontend 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 $ ADDITIONAL_INCLUDE_DIRECTORIES - $) + $) 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(${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) @@ -66,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/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 75a99e1e3855de..e0d43583988ecc 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} @@ -86,10 +87,17 @@ install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets 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}") +export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: + APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") 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/setup.py b/runtime/bindings/python/setup.py index d8c620ab4b524b..0cd8167f263fc1 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,8 @@ 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: + root_dir = pathlib.Path(PYNGRAPH_ROOT_DIR) lib_ext = "" if "linux" in sys.platform: 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 e3cacab6729682..dc0644adb86a80 100644 --- a/runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt +++ b/runtime/bindings/python/src/compatibility/pyngraph/CMakeLists.txt @@ -2,13 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 # -cmake_minimum_required (VERSION 3.13) - project (pyngraph) if(NOT DEFINED OpenVINO_SOURCE_DIR) find_package(InferenceEngineDeveloperPackage QUIET) - find_package(ngraph REQUIRED) + find_package(OpenVINO REQUIRED) endif() # PYTHON_VERSION_MAJOR and PYTHON_VERSION_MINOR are defined inside pybind11 @@ -56,10 +54,10 @@ pybind11_add_module(_${PROJECT_NAME} MODULE ${SOURCES}) target_include_directories(_${PROJECT_NAME} PRIVATE "../") -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() diff --git a/runtime/bindings/python/tests/mock/mock_py_ngraph_frontend/CMakeLists.txt b/runtime/bindings/python/tests/mock/mock_py_ngraph_frontend/CMakeLists.txt index b218da4751fdbb..fac5294a572fdc 100644 --- a/runtime/bindings/python/tests/mock/mock_py_ngraph_frontend/CMakeLists.txt +++ b/runtime/bindings/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/runtime/bindings/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt b/runtime/bindings/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt index f464e3e316fd50..08755970fb6887 100644 --- a/runtime/bindings/python/tests/mock/pyngraph_fe_mock_api/CMakeLists.txt +++ b/runtime/bindings/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/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 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 diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index 18cbc60a1368b8..a5f46c5a07e2d4 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -13,14 +13,12 @@ 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(InferenceEngine REQUIRED) +find_package(OpenVINO REQUIRED) if (NOT ENABLE_FUZZING) message(STATUS 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}) 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)