|
|
|
|
@@ -12,13 +12,14 @@
|
|
|
|
|
#include "openvino/core/so_extension.hpp"
|
|
|
|
|
#include "openvino/runtime/device_id_parser.hpp"
|
|
|
|
|
#include "openvino/runtime/iremote_context.hpp"
|
|
|
|
|
#include "openvino/util/file_util.hpp"
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
std::string resolve_extension_path(const std::string& path) {
|
|
|
|
|
std::string retvalue;
|
|
|
|
|
try {
|
|
|
|
|
const std::string absolute_path = ov::util::get_absolute_file_path(path);
|
|
|
|
|
retvalue = FileUtils::fileExist(absolute_path) ? absolute_path : path;
|
|
|
|
|
retvalue = ov::util::file_exists(absolute_path) ? absolute_path : path;
|
|
|
|
|
} catch (const std::runtime_error&) {
|
|
|
|
|
retvalue = path;
|
|
|
|
|
}
|
|
|
|
|
@@ -29,30 +30,28 @@ std::string resolve_extension_path(const std::string& path) {
|
|
|
|
|
|
|
|
|
|
namespace ov {
|
|
|
|
|
|
|
|
|
|
std::string findPluginXML(const std::string& xmlFile) {
|
|
|
|
|
std::string xmlConfigFile_ = xmlFile;
|
|
|
|
|
if (xmlConfigFile_.empty()) {
|
|
|
|
|
const auto ielibraryDir = ie::getInferenceEngineLibraryPath();
|
|
|
|
|
std::string find_plugins_xml(const std::string& xml_file) {
|
|
|
|
|
if (xml_file.empty()) {
|
|
|
|
|
const auto ov_library_path = ov::util::get_ov_lib_path();
|
|
|
|
|
|
|
|
|
|
// plugins.xml can be found in either:
|
|
|
|
|
|
|
|
|
|
// 1. openvino-X.Y.Z relative to libopenvino.so folder
|
|
|
|
|
std::ostringstream str;
|
|
|
|
|
str << "openvino-" << OPENVINO_VERSION_MAJOR << "." << OPENVINO_VERSION_MINOR << "." << OPENVINO_VERSION_PATCH;
|
|
|
|
|
const auto subFolder = ov::util::to_file_path(str.str());
|
|
|
|
|
const auto sub_folder = str.str();
|
|
|
|
|
|
|
|
|
|
// register plugins from default openvino-<openvino version>/plugins.xml config
|
|
|
|
|
ov::util::FilePath xmlConfigFileDefault =
|
|
|
|
|
FileUtils::makePath(FileUtils::makePath(ielibraryDir, subFolder), ov::util::to_file_path("plugins.xml"));
|
|
|
|
|
if (FileUtils::fileExist(xmlConfigFileDefault))
|
|
|
|
|
return xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault);
|
|
|
|
|
auto xmlConfigFileDefault = ov::util::path_join({ov_library_path, sub_folder, "plugins.xml"});
|
|
|
|
|
if (ov::util::file_exists(xmlConfigFileDefault))
|
|
|
|
|
return xmlConfigFileDefault;
|
|
|
|
|
|
|
|
|
|
// 2. in folder with libopenvino.so
|
|
|
|
|
xmlConfigFileDefault = FileUtils::makePath(ielibraryDir, ov::util::to_file_path("plugins.xml"));
|
|
|
|
|
if (FileUtils::fileExist(xmlConfigFileDefault))
|
|
|
|
|
return xmlConfigFile_ = ov::util::from_file_path(xmlConfigFileDefault);
|
|
|
|
|
xmlConfigFileDefault = ov::util::path_join({ov_library_path, "plugins.xml"});
|
|
|
|
|
if (ov::util::file_exists(xmlConfigFileDefault))
|
|
|
|
|
return xmlConfigFileDefault;
|
|
|
|
|
}
|
|
|
|
|
return xmlConfigFile_;
|
|
|
|
|
return xml_file;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define OV_CORE_CALL_STATEMENT(...) \
|
|
|
|
|
@@ -72,7 +71,7 @@ public:
|
|
|
|
|
Core::Core(const std::string& xml_config_file) {
|
|
|
|
|
_impl = std::make_shared<Impl>();
|
|
|
|
|
|
|
|
|
|
std::string xmlConfigFile = ov::findPluginXML(xml_config_file);
|
|
|
|
|
std::string xmlConfigFile = ov::find_plugins_xml(xml_config_file);
|
|
|
|
|
if (!xmlConfigFile.empty())
|
|
|
|
|
OV_CORE_CALL_STATEMENT(
|
|
|
|
|
// If XML is default, load default plugins by absolute paths
|
|
|
|
|
|