From a205c675db9d65f21427c73f6b8c38c7a2ec616d Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Thu, 23 Mar 2023 08:32:36 +0400 Subject: [PATCH] Fix leftovers after removing plugins.xml (#16487) * Fixed comments * Rename ie_plugins to ov_plugins * Remove dependency from tests --- .../plugins/create_plugins_hpp.cmake | 34 +++++++++---------- cmake/developer_package/plugins/plugins.cmake | 26 +++++++------- .../developer_package/plugins/plugins.hpp.in | 4 +-- cmake/extra_modules.cmake | 4 +-- scripts/setupvars/setupvars.sh | 12 +++---- src/common/util/CMakeLists.txt | 9 ++--- src/common/util/src/file_util.cpp | 3 +- src/inference/CMakeLists.txt | 2 +- src/inference/src/core.cpp | 1 - src/inference/src/dev/core_impl.cpp | 9 ++--- src/inference/src/dev/core_impl.hpp | 2 -- src/inference/src/ie_core.cpp | 1 - src/inference/tests/unit/CMakeLists.txt | 3 -- 13 files changed, 48 insertions(+), 62 deletions(-) diff --git a/cmake/developer_package/plugins/create_plugins_hpp.cmake b/cmake/developer_package/plugins/create_plugins_hpp.cmake index 10adcac6c28..1fedf858ce5 100644 --- a/cmake/developer_package/plugins/create_plugins_hpp.cmake +++ b/cmake/developer_package/plugins/create_plugins_hpp.cmake @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -foreach(var IE_DEVICE_MAPPING OV_DYNAMIC IE_PLUGINS_HPP_HEADER IE_PLUGINS_HPP_HEADER_IN) +foreach(var OV_DEVICE_MAPPING BUILD_SHARED_LIBS OV_PLUGINS_HPP_HEADER OV_PLUGINS_HPP_HEADER_IN) if(NOT DEFINED ${var}) message(FATAL_ERROR "${var} is required, but not defined") endif() @@ -10,11 +10,11 @@ endforeach() # configure variables -set(IE_PLUGINS_DECLARATIONS "") -set(IE_PLUGINS_MAP_DEFINITION +set(OV_PLUGINS_DECLARATIONS "") +set(OV_PLUGINS_MAP_DEFINITION " static const std::map plugins_hpp = {") -foreach(dev_map IN LISTS IE_DEVICE_MAPPING) +foreach(dev_map IN LISTS OV_DEVICE_MAPPING) string(REPLACE ":" ";" dev_map "${dev_map}") list(GET dev_map 0 mapped_dev_name) list(GET dev_map 1 actual_dev_name) @@ -35,30 +35,30 @@ foreach(dev_map IN LISTS IE_DEVICE_MAPPING) set(dev_config "${dev_config}}") - if(NOT OV_DYNAMIC) + if(NOT BUILD_SHARED_LIBS) # common - set(_IE_CREATE_PLUGIN_FUNC "CreatePluginEngine${actual_dev_name}") - set(_IE_CREATE_EXTENSION_FUNC "CreateExtensionShared${actual_dev_name}") + set(_OV_CREATE_PLUGIN_FUNC "CreatePluginEngine${actual_dev_name}") + set(_OV_CREATE_EXTENSION_FUNC "CreateExtensionShared${actual_dev_name}") # declarations - set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS} - IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_PLUGIN_FUNC});") + set(OV_PLUGINS_DECLARATIONS "${OV_PLUGINS_DECLARATIONS} + IE_DEFINE_PLUGIN_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_PLUGIN_FUNC});") if(${actual_dev_name}_AS_EXTENSION) - set(IE_PLUGINS_DECLARATIONS "${IE_PLUGINS_DECLARATIONS} - IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_IE_CREATE_EXTENSION_FUNC});") + set(OV_PLUGINS_DECLARATIONS "${OV_PLUGINS_DECLARATIONS} + IE_DEFINE_EXTENSION_CREATE_FUNCTION_DECLARATION(${_OV_CREATE_EXTENSION_FUNC});") else() - set(_IE_CREATE_EXTENSION_FUNC "nullptr") + set(_OV_CREATE_EXTENSION_FUNC "nullptr") endif() - set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION} - { \"${mapped_dev_name}\", Value { ${_IE_CREATE_PLUGIN_FUNC}, ${_IE_CREATE_EXTENSION_FUNC}, ${dev_config} } },") + set(OV_PLUGINS_MAP_DEFINITION "${OV_PLUGINS_MAP_DEFINITION} + { \"${mapped_dev_name}\", Value { ${_OV_CREATE_PLUGIN_FUNC}, ${_OV_CREATE_EXTENSION_FUNC}, ${dev_config} } },") else() - set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION} + set(OV_PLUGINS_MAP_DEFINITION "${OV_PLUGINS_MAP_DEFINITION} { \"${mapped_dev_name}\", Value { \"${actual_dev_name}\", ${dev_config} } },") endif() endforeach() -set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION} +set(OV_PLUGINS_MAP_DEFINITION "${OV_PLUGINS_MAP_DEFINITION} };\n") -configure_file("${IE_PLUGINS_HPP_HEADER_IN}" "${IE_PLUGINS_HPP_HEADER}" @ONLY) +configure_file("${OV_PLUGINS_HPP_HEADER_IN}" "${OV_PLUGINS_HPP_HEADER}" @ONLY) diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index 7f00cc70269..0d8db5561e5 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -281,9 +281,9 @@ function(ie_target_link_plugins TARGET_NAME) endfunction() # -# ie_generate_plugins_hpp() +# ov_generate_plugins_hpp() # -function(ie_generate_plugins_hpp) +function(ov_generate_plugins_hpp) set(device_mapping) set(device_configs) set(as_extension) @@ -321,22 +321,22 @@ function(ie_generate_plugins_hpp) endif() endforeach() - # add plugins to libraries including ie_plugins.hpp + # add plugins to libraries including ov_plugins.hpp ie_target_link_plugins(openvino) if(TARGET inference_engine_s) ie_target_link_plugins(inference_engine_s) endif() - set(ie_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/ie_plugins.hpp") + set(ov_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/ov_plugins.hpp") set(plugins_hpp_in "${IEDevScripts_DIR}/plugins/plugins.hpp.in") - add_custom_command(OUTPUT "${ie_plugins_hpp}" + add_custom_command(OUTPUT "${ov_plugins_hpp}" COMMAND "${CMAKE_COMMAND}" - -D "IE_DEVICE_MAPPING=${device_mapping}" - -D "OV_DYNAMIC=${BUILD_SHARED_LIBS}" - -D "IE_PLUGINS_HPP_HEADER_IN=${plugins_hpp_in}" - -D "IE_PLUGINS_HPP_HEADER=${ie_plugins_hpp}" + -D "BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}" + -D "OV_DEVICE_MAPPING=${device_mapping}" + -D "OV_PLUGINS_HPP_HEADER_IN=${plugins_hpp_in}" + -D "OV_PLUGINS_HPP_HEADER=${ov_plugins_hpp}" ${device_configs} ${as_extension} -P "${IEDevScripts_DIR}/plugins/create_plugins_hpp.cmake" @@ -344,13 +344,13 @@ function(ie_generate_plugins_hpp) "${plugins_hpp_in}" "${IEDevScripts_DIR}/plugins/create_plugins_hpp.cmake" COMMENT - "Generate ie_plugins.hpp for build" + "Generate ov_plugins.hpp for build" VERBATIM) # for some reason dependency on source files does not work # so, we have to use explicit target and make it dependency for inference_engine - add_custom_target(_ie_plugins_hpp DEPENDS ${ie_plugins_hpp}) - add_dependencies(inference_engine_obj _ie_plugins_hpp) + add_custom_target(_ov_plugins_hpp DEPENDS ${ov_plugins_hpp}) + add_dependencies(inference_engine_obj _ov_plugins_hpp) # add dependency for object files get_target_property(sources inference_engine_obj SOURCES) @@ -367,5 +367,5 @@ function(ie_generate_plugins_hpp) endforeach() # add dependency on header file generation for all inference_engine source files - set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ie_plugins_hpp}) + set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ov_plugins_hpp}) endfunction() diff --git a/cmake/developer_package/plugins/plugins.hpp.in b/cmake/developer_package/plugins/plugins.hpp.in index d351bcfb76f..224f77c8cb9 100644 --- a/cmake/developer_package/plugins/plugins.hpp.in +++ b/cmake/developer_package/plugins/plugins.hpp.in @@ -11,7 +11,7 @@ #include "cpp_interfaces/interface/ie_iplugin_internal.hpp" -@IE_PLUGINS_DECLARATIONS@ +@OV_PLUGINS_DECLARATIONS@ struct Value { InferenceEngine::CreatePluginEngineFunc * m_create_plugin_func; @@ -33,6 +33,6 @@ using PluginsStaticRegistry = std::map; inline const std::map getCompiledPluginsRegistry() { -@IE_PLUGINS_MAP_DEFINITION@ +@OV_PLUGINS_MAP_DEFINITION@ return plugins_hpp; } diff --git a/cmake/extra_modules.cmake b/cmake/extra_modules.cmake index 7b843341c11..a5b1cd22e82 100644 --- a/cmake/extra_modules.cmake +++ b/cmake/extra_modules.cmake @@ -169,9 +169,9 @@ ov_generate_dev_package_config() # with all imported developer targets register_extra_modules() -# for static libraries case we need to generate final ie_plugins.hpp +# for static libraries case we need to generate final ov_plugins.hpp # with all the information about plugins -ie_generate_plugins_hpp() +ov_generate_plugins_hpp() # used for static build ov_generate_frontends_hpp() diff --git a/scripts/setupvars/setupvars.sh b/scripts/setupvars/setupvars.sh index 41789160e69..3cdf4987d73 100755 --- a/scripts/setupvars/setupvars.sh +++ b/scripts/setupvars/setupvars.sh @@ -36,15 +36,15 @@ if [ -e "$INSTALLDIR/runtime" ]; then export OpenVINO_DIR=$INSTALLDIR/runtime/cmake system_type=$(ls "$INSTALLDIR/runtime/lib/") - IE_PLUGINS_PATH=$INSTALLDIR/runtime/lib/$system_type + OV_PLUGINS_PATH=$INSTALLDIR/runtime/lib/$system_type if [[ "$OSTYPE" == "darwin"* ]]; then - export DYLD_LIBRARY_PATH=${IE_PLUGINS_PATH}/Release:${IE_PLUGINS_PATH}/Debug${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH} - export LD_LIBRARY_PATH=${IE_PLUGINS_PATH}/Release:${IE_PLUGINS_PATH}/Debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} - export PKG_CONFIG_PATH=${IE_PLUGINS_PATH}/Release/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} + export DYLD_LIBRARY_PATH=${OV_PLUGINS_PATH}/Release:${OV_PLUGINS_PATH}/Debug${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH} + export LD_LIBRARY_PATH=${OV_PLUGINS_PATH}/Release:${OV_PLUGINS_PATH}/Debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + export PKG_CONFIG_PATH=${OV_PLUGINS_PATH}/Release/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} else - export LD_LIBRARY_PATH=${IE_PLUGINS_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} - export PKG_CONFIG_PATH=$IE_PLUGINS_PATH/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} + export LD_LIBRARY_PATH=${OV_PLUGINS_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} + export PKG_CONFIG_PATH=$OV_PLUGINS_PATH/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} fi if [ -e "$INSTALLDIR/runtime/3rdparty/tbb" ]; then diff --git a/src/common/util/CMakeLists.txt b/src/common/util/CMakeLists.txt index 160be0259b8..4b538aab7c7 100644 --- a/src/common/util/CMakeLists.txt +++ b/src/common/util/CMakeLists.txt @@ -24,12 +24,9 @@ endif() # Create named folders for the sources within the .vcproj # Empty name lists them directly under the .vcproj -set(MIXED_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/src/file_util.cpp") - -set_property(SOURCE ${MIXED_SRC} - APPEND PROPERTY INCLUDE_DIRECTORIES - $) +set_source_files_properties( + "${CMAKE_CURRENT_SOURCE_DIR}/src/file_util.cpp" + PROPERTIES COMPILE_DEFINITIONS OpenVINO_VERSION="${OpenVINO_VERSION}") source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cpp index f39f2dd3c67..0de2ab70d37 100644 --- a/src/common/util/src/file_util.cpp +++ b/src/common/util/src/file_util.cpp @@ -12,7 +12,6 @@ #include #include -#include "openvino/core/version.hpp" #include "openvino/util/common_util.hpp" #ifdef _WIN32 @@ -512,7 +511,7 @@ ov::util::FilePath ov::util::get_compiled_plugin_path(const std::string& plugin) // 1. in openvino-X.Y.Z folder relative to libopenvino.so std::ostringstream str; - str << "openvino-" << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH; + str << "openvino-" << OpenVINO_VERSION; const auto sub_folder = str.str(); std::string abs_file_path = ov::util::path_join({ov_library_path, sub_folder, plugin}); diff --git a/src/inference/CMakeLists.txt b/src/inference/CMakeLists.txt index ca27952acad..25d4272b3d3 100644 --- a/src/inference/CMakeLists.txt +++ b/src/inference/CMakeLists.txt @@ -152,7 +152,7 @@ target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE target_include_directories(${TARGET_NAME}_obj PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src" - # for static ie_plugins.hpp + # for static ov_plugins.hpp "${CMAKE_CURRENT_BINARY_DIR}" # for ie_ir_version.hpp $<$:$> diff --git a/src/inference/src/core.cpp b/src/inference/src/core.cpp index fef2652b275..45c9e9665ef 100644 --- a/src/inference/src/core.cpp +++ b/src/inference/src/core.cpp @@ -9,7 +9,6 @@ #include "dev/converter_utils.hpp" #include "dev/core_impl.hpp" #include "ie_itt.hpp" -#include "ie_plugins.hpp" #include "openvino/runtime/device_id_parser.hpp" #include "so_extension.hpp" diff --git a/src/inference/src/dev/core_impl.cpp b/src/inference/src/dev/core_impl.cpp index d97a89f8f79..3e696487e9d 100644 --- a/src/inference/src/dev/core_impl.cpp +++ b/src/inference/src/dev/core_impl.cpp @@ -36,6 +36,7 @@ #include "openvino/util/common_util.hpp" #include "openvino/util/file_util.hpp" #include "openvino/util/shared_object.hpp" +#include "ov_plugins.hpp" #include "preprocessing/preprocessing.hpp" #include "xml_parse_utils.h" @@ -316,12 +317,12 @@ void ov::CoreImpl::register_compile_time_plugins() { std::lock_guard lock(get_mutex()); const decltype(::getCompiledPluginsRegistry())& plugins = getCompiledPluginsRegistry(); -#ifdef OPENVINO_STATIC_LIBRARY for (const auto& plugin : plugins) { const auto& deviceName = plugin.first; if (deviceName.find('.') != std::string::npos) { OPENVINO_THROW("Device name must not contain dot '.' symbol"); } +#ifdef OPENVINO_STATIC_LIBRARY if (pluginRegistry.find(deviceName) == pluginRegistry.end()) { const auto& value = plugin.second; ov::AnyMap config = any_copy(value.m_default_config); @@ -329,20 +330,16 @@ void ov::CoreImpl::register_compile_time_plugins() { pluginRegistry[deviceName] = desc; add_mutex(deviceName); } - } #else - for (const auto& plugin : plugins) { - const auto& deviceName = plugin.first; const auto& pluginPath = ov::util::get_compiled_plugin_path(plugin.second.m_plugin_path); - if (pluginRegistry.find(deviceName) == pluginRegistry.end() && ov::util::file_exists(pluginPath)) { ov::AnyMap config = any_copy(plugin.second.m_default_config); PluginDescriptor desc{pluginPath, config}; pluginRegistry[deviceName] = desc; add_mutex(deviceName); } - } #endif + } } void ov::CoreImpl::register_plugins_in_registry(const std::string& xml_config_file, const bool& by_abs_path) { diff --git a/src/inference/src/dev/core_impl.hpp b/src/inference/src/dev/core_impl.hpp index 8fe7768dc6c..c711e416484 100644 --- a/src/inference/src/dev/core_impl.hpp +++ b/src/inference/src/dev/core_impl.hpp @@ -15,7 +15,6 @@ #include "ie_cache_manager.hpp" #include "ie_extension.h" #include "ie_icore.hpp" -#include "ie_plugins.hpp" #include "multi-device/multi_device_config.hpp" #include "openvino/core/any.hpp" #include "openvino/core/extension.hpp" @@ -23,7 +22,6 @@ #include "openvino/runtime/common.hpp" #include "openvino/runtime/icompiled_model.hpp" #include "openvino/runtime/threading/executor_manager.hpp" -#include "openvino/util/file_util.hpp" namespace ov { diff --git a/src/inference/src/ie_core.cpp b/src/inference/src/ie_core.cpp index de604f6fab4..139c12d7631 100644 --- a/src/inference/src/ie_core.cpp +++ b/src/inference/src/ie_core.cpp @@ -30,7 +30,6 @@ #include "ie_network_reader.hpp" #include "ie_ngraph_utils.hpp" #include "ie_plugin_config.hpp" -#include "ie_plugins.hpp" #include "ie_remote_context.hpp" #include "ngraph/graph_util.hpp" #include "ngraph/ngraph.hpp" diff --git a/src/inference/tests/unit/CMakeLists.txt b/src/inference/tests/unit/CMakeLists.txt index 36889d8548e..02fed6cfd77 100644 --- a/src/inference/tests/unit/CMakeLists.txt +++ b/src/inference/tests/unit/CMakeLists.txt @@ -11,9 +11,6 @@ ov_add_test_target( template_extension LINK_LIBRARIES unitTestUtils - INCLUDES - # for static ie_plugins.hpp - "${CMAKE_BINARY_DIR}/src/inference/" ADD_CLANG_FORMAT LABELS OV