Added OpenVINO runtime macro (#7586)

* Fixed typo

* Moved ie::Parameter to new API

* New OpenVINO API macro

* Used OpenVINO Plugin API for some plugins

* Used OPENVINO_RUNTIME_API

* Revert "Moved ie::Parameter to new API"

This reverts commit fef5e3b487.

* Fixed code style and docs

* Fixed compilation
This commit is contained in:
Ilya Lavrenov 2021-09-23 10:39:20 +03:00 committed by GitHub
parent fb11560b82
commit ab34701590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 250 additions and 181 deletions

View File

@ -2046,14 +2046,21 @@ INCLUDE_FILE_PATTERNS =
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = INFERENCE_PLUGIN_API \
OPENVINO_PLUGIN_API \
INFERENCE_ENGINE_API \
INFERENCE_ENGINE_API_CPP \
INFERENCE_ENGINE_API_CLASS \
OPENVINO_RUNTIME_API_C \
OPENVINO_RUNTIME_API \
OPENVINO_EXTERN_C \
OPENVINO_CORE_IMPORTS \
OPENVINO_CORE_EXPORTS \
OPENVINO_CDECL \
OPENVINO_STDCALL \
INFERENCE_ENGINE_DEPRECATED \
OPENVINO_DEPRECATED \
IE_SUPPRESS_DEPRECATED_START \
IE_SUPPRESS_DEPRECATED_END \
_IE_SUPPRESS_DEPRECATED_START_MSVC \
_IE_SUPPRESS_DEPRECATED_END_MSVC \
_IE_SUPPRESS_DEPRECATED_START_GCC \
_IE_SUPPRESS_DEPRECATED_END_GCC \
IE_THREAD=IE_THREAD_TBB \

View File

@ -924,21 +924,27 @@ EXCLUDE_SYMBOLS = InferenceEngine::details \
__PRETTY_FUNCTION__ \
PRINT_COLOR_FORMAT \
PRINT_LAYOUT \
INFERENCE_ENGINE_CDECL \
INFERENCE_PLUGIN_API \
OPENVINO_PLUGIN_API \
INFERENCE_EXTENSION_API \
INFERENCE_ENGINE_API \
INFERENCE_ENGINE_API_CPP \
INFERENCE_ENGINE_API_CLASS \
OPENVINO_RUNTIME_API_C \
OPENVINO_RUNTIME_API \
OPENVINO_EXTERN_C \
OPENVINO_CORE_IMPORTS \
OPENVINO_CORE_EXPORTS \
INFERENCE_ENGINE_DEPRECATED \
OPENVINO_DEPRECATED \
OPENVINO_CDECL \
OPENVINO_STDCALL \
IE_SUPPRESS_DEPRECATED_START \
IE_SUPPRESS_DEPRECATED_END \
_IE_SUPPRESS_DEPRECATED_START_MSVC \
_IE_SUPPRESS_DEPRECATED_END_MSVC \
_IE_SUPPRESS_DEPRECATED_START_GCC \
_IE_SUPPRESS_DEPRECATED_END_GCC \
INFERENCE_ENGINE_INTERNAL \
IE_DO_PRAGMA \
OPENVINO_DO_PRAGMA \
parallel_* \
for_* \
splitter \
@ -2216,18 +2222,20 @@ INCLUDE_FILE_PATTERNS =
PREDEFINED = "INFERENCE_ENGINE_API_CLASS=" \
"INFERENCE_ENGINE_API_CPP=" \
"INFERENCE_ENGINE_API=" \
"INFERENCE_ENGINE_CDECL=" \
"INFERENCE_ENGINE_DEPRECATED(x)=" \
"OPENVINO_DEPRECATED(x)=" \
"IE_SUPPRESS_DEPRECATED_START=" \
"OPENVINO_CDECL=" \
"OPENVINO_STDCALL=" \
"OPENVINO_EXTERN_C=" \
"OPENVINO_CORE_IMPORTS=" \
"OPENVINO_CORE_EXPORTS=" \
"OPENVINO_RUNTIME_API_C=" \
"OPENVINO_RUNTIME_API=" \
"OPENVINO_PLUGIN_API=" \
"IE_SUPPRESS_DEPRECATED_END=" \
"_IE_SUPPRESS_DEPRECATED_START_MSVC=" \
"_IE_SUPPRESS_DEPRECATED_END_MSVC=" \
"_IE_SUPPRESS_DEPRECATED_START_GCC=" \
"_IE_SUPPRESS_DEPRECATED_END_GCC=" \
"INFERENCE_ENGINE_NN_BUILDER_API_CLASS=" \
"INFERENCE_ENGINE_NN_BUILDER_DEPRECATED(x)=" \
"INFERENCE_ENGINE_INTERNAL(x)=" \
"INFERENCE_ENGINE_INTERNAL_CNNLAYER_CLASS(x)="
"_IE_SUPPRESS_DEPRECATED_END_GCC="
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

View File

@ -62,15 +62,21 @@ EXPAND_ONLY_PREDEF = YES
PREDEFINED = "INFERENCE_ENGINE_API=" \
"INFERENCE_ENGINE_API_CPP=" \
"INFERENCE_ENGINE_API_CLASS=" \
"OPENVINO_RUNTIME_API_C=" \
"OPENVINO_RUNTIME_API=" \
"OPENVINO_EXTERN_C=" \
"OPENVINO_CORE_IMPORTS=" \
"OPENVINO_CORE_EXPORTS=" \
"INFERENCE_ENGINE_DEPRECATED=" \
"OPENVINO_DEPRECATED=" \
"inference_engine_transformations_EXPORTS" \
"TRANSFORMATIONS_API=" \
"NGRAPH_HELPER_DLL_EXPORT=" \
"NGRAPH_HELPER_DLL_IMPORT=" \
"OPENVINO_CDECL=" \
"OPENVINO_STDCALL=" \
"IE_SUPPRESS_DEPRECATED_START=" \
"IE_SUPPRESS_DEPRECATED_END=" \
"_IE_SUPPRESS_DEPRECATED_START_MSVC=" \
"_IE_SUPPRESS_DEPRECATED_END_MSVC=" \
"_IE_SUPPRESS_DEPRECATED_START_GCC=" \
"_IE_SUPPRESS_DEPRECATED_END_GCC=" \
"IE_THREAD=IE_THREAD_TBB" \

View File

@ -15,11 +15,11 @@
#ifdef _WIN32
# include <direct.h>
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# define mkdir(dir, mode) _wmkdir(dir)
#else
# define mkdir(dir, mode) _mkdir(dir)
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#endif // _WIN32
using namespace InferenceEngine;
@ -27,7 +27,7 @@ using namespace InferenceEngine;
namespace CLDNNPlugin {
static void createDirectory(std::string _path) {
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring widepath = ov::util::string_to_wstring(_path.c_str());
const wchar_t* path = widepath.c_str();
#else

View File

@ -13,21 +13,18 @@
# define INFERENCE_ENGINE_API(...) extern "C" __VA_ARGS__
# define INFERENCE_ENGINE_API_CPP(...) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __VA_ARGS__
# define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
#else
# if defined(_WIN32)
# define INFERENCE_ENGINE_CDECL
# ifdef IMPLEMENT_INFERENCE_ENGINE_API
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllexport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllexport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllexport) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllexport) __VA_ARGS__
# else
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllimport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllimport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllimport) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllimport) __VA_ARGS__
# endif
# else
# define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
# define INFERENCE_ENGINE_API(...) extern "C" __attribute__((visibility("default"))) __VA_ARGS__
# define INFERENCE_ENGINE_API_CPP(...) __attribute__((visibility("default"))) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __attribute__((visibility("default"))) __VA_ARGS__
@ -44,12 +41,6 @@
# define INFERENCE_ENGINE_DEPRECATED(msg)
#endif
#if defined IMPLEMENT_INFERENCE_ENGINE_API || defined IMPLEMENT_INFERENCE_ENGINE_PLUGIN
# define INFERENCE_ENGINE_INTERNAL(msg)
#else
# define INFERENCE_ENGINE_INTERNAL(msg) INFERENCE_ENGINE_DEPRECATED(msg)
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
# define IE_DO_PRAGMA(x) __pragma(x)
@ -80,14 +71,6 @@ IE_DO_PRAGMA(warning(disable : 1786))
# define IE_SUPPRESS_DEPRECATED_END
#endif
#ifdef _WIN32
# define _IE_SUPPRESS_DEPRECATED_START_MSVC IE_SUPPRESS_DEPRECATED_START
# define _IE_SUPPRESS_DEPRECATED_END_MSVC IE_SUPPRESS_DEPRECATED_END
#else
# define _IE_SUPPRESS_DEPRECATED_START_MSVC
# define _IE_SUPPRESS_DEPRECATED_END_MSVC
#endif
#if defined __GNUC__ && (__GNUC__ <= 4 || (__GNUC__ == 5 && __GNUC_MINOR__ <= 5) || \
(defined __i386__ || defined __arm__ || defined __aarch64__))
# define _IE_SUPPRESS_DEPRECATED_START_GCC IE_SUPPRESS_DEPRECATED_START
@ -107,6 +90,10 @@ IE_DO_PRAGMA(warning(disable : 1786))
# endif
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#endif
/**
* @def INFERENCE_PLUGIN_API(type)
* @brief Defines Inference Engine Plugin API method

View File

@ -13,6 +13,33 @@
#include <map>
#include <string>
#include "openvino/core/visibility.hpp"
#ifdef USE_STATIC_IE // defined if we are building or calling OpenVINO Runtime as a static library
# define OPENVINO_RUNTIME_API_C(...) OPENVINO_EXTERN_C __VA_ARGS__
# define OPENVINO_RUNTIME_API
#else
# ifdef IMPLEMENT_INFERENCE_ENGINE_API // defined if we are building the OpenVINO runtime DLL (instead of using it)
# define OPENVINO_RUNTIME_API_C(...) OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS __VA_ARGS__ OPENVINO_CDECL
# define OPENVINO_RUNTIME_API OPENVINO_CORE_EXPORTS
# else
# define OPENVINO_RUNTIME_API_C(...) OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS __VA_ARGS__ OPENVINO_CDECL
# define OPENVINO_RUNTIME_API OPENVINO_CORE_IMPORTS
# endif // IMPLEMENT_INFERENCE_ENGINE_API
#endif // USE_STATIC_IE
/**
* @def OPENVINO_PLUGIN_API(type)
* @brief Defines OpenVINO Runtime Plugin API method
* @param type A plugin type
*/
#ifdef IMPLEMENT_INFERENCE_ENGINE_PLUGIN
# define OPENVINO_PLUGIN_API(type) OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS type
#else
# define OPENVINO_PLUGIN_API(type) OPENVINO_EXTERN_C type
#endif
namespace InferenceEngine {}
namespace ov {

View File

@ -38,7 +38,7 @@ namespace runtime {
*
* It can throw exceptions safely for the application, where it is properly handled.
*/
class INFERENCE_ENGINE_API_CLASS(Core) {
class OPENVINO_RUNTIME_API Core {
class Impl;
std::shared_ptr<Impl> _impl;
@ -61,7 +61,7 @@ public:
*/
std::map<std::string, ie::Version> get_versions(const std::string& deviceName) const;
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Reads models from IR and ONNX formats
* @param modelPath path to model

View File

@ -33,7 +33,7 @@ class Core;
/**
* @brief This is an interface of an executable network
*/
class INFERENCE_ENGINE_API_CLASS(ExecutableNetwork) {
class OPENVINO_RUNTIME_API ExecutableNetwork {
std::shared_ptr<void> _so;
std::shared_ptr<InferenceEngine::IExecutableNetworkInternal> _impl;

View File

@ -32,7 +32,7 @@ class ExecutableNetwork;
*
* It can throw exceptions safely for the application, where it is properly handled.
*/
class INFERENCE_ENGINE_API_CLASS(InferRequest) {
class OPENVINO_RUNTIME_API InferRequest {
std::shared_ptr<void> _so;
std::shared_ptr<ie::IInferRequestInternal> _impl;

View File

@ -32,7 +32,7 @@ class Core;
* Such context represents a scope on the device within which executable
* networks and remote memory blobs can exist, function and exchange data.
*/
class INFERENCE_ENGINE_API_CLASS(RemoteContext) {
class OPENVINO_RUNTIME_API RemoteContext {
std::shared_ptr<void> _so;
std::shared_ptr<ie::RemoteContext> _impl;

View File

@ -10,9 +10,6 @@
#pragma once
#include <ie_api.h>
#include <ie_blob.h>
#include <memory>
#include <string>
@ -31,7 +28,7 @@ class InferRequest;
/**
* @brief VariableState class
*/
class INFERENCE_ENGINE_API_CLASS(VariableState) {
class OPENVINO_RUNTIME_API VariableState {
std::shared_ptr<void> _so;
std::shared_ptr<ie::IVariableStateInternal> _impl;

View File

@ -20,7 +20,7 @@
# include <dlfcn.h>
# include <limits.h>
# include <unistd.h>
# ifdef ENABLE_UNICODE_PATH_SUPPORT
# ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# include <codecvt>
# include <locale>
# endif
@ -67,7 +67,7 @@
#endif
long long FileUtils::fileSize(const char* charfilepath) {
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring widefilename = ov::util::string_to_wstring(charfilepath);
const wchar_t* fileName = widefilename.c_str();
#elif defined(__ANDROID__) || defined(ANDROID)
@ -169,7 +169,7 @@ static std::string getIELibraryPathA() {
#endif // _WIN32
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::wstring getIELibraryPathW() {
# ifdef _WIN32
@ -189,10 +189,10 @@ std::wstring getIELibraryPathW() {
# endif
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::string getIELibraryPath() {
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
return ov::util::wstring_to_string(getIELibraryPathW());
#else
return getIELibraryPathA();

View File

@ -981,7 +981,7 @@ std::map<std::string, Version> Core::GetVersions(const std::string& deviceName)
return _impl->GetVersions(deviceName);
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
CNNNetwork Core::ReadNetwork(const std::wstring& modelPath, const std::wstring& binPath) const {
return ReadNetwork(ov::util::wstring_to_string(modelPath), ov::util::wstring_to_string(binPath));
@ -1245,7 +1245,7 @@ std::map<std::string, ie::Version> Core::get_versions(const std::string& deviceN
OV_CORE_CALL_STATEMENT(return _impl->GetVersions(deviceName))
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::shared_ptr<ngraph::Function> Core::read_model(const std::wstring& modelPath, const std::wstring& binPath) const {
OV_CORE_CALL_STATEMENT(
return _impl->ReadNetwork(ov::util::wstring_to_string(modelPath), ov::util::wstring_to_string(binPath))

View File

@ -171,7 +171,7 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
registerReaders();
// Fix unicode name
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring model_path = ov::util::string_to_wstring(modelPath.c_str());
#else
std::string model_path = modelPath;
@ -207,7 +207,7 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
}
if (!bPath.empty()) {
// Open weights file
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring weights_path = ov::util::string_to_wstring(bPath.c_str());
#else
std::string weights_path = bPath;
@ -251,7 +251,7 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
}
if (!binPath.empty()) {
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
const std::wstring& weights_path = ov::util::string_to_wstring(binPath.c_str());
#else
const std::string& weights_path = binPath;

View File

@ -27,11 +27,11 @@ std::shared_ptr<void> load_shared_object(const char* path) {
return shared_object;
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::shared_ptr<void> load_shared_object(const wchar_t* path) {
return load_shared_object(ov::util::wstring_to_string(path).c_str());
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
void* get_symbol(const std::shared_ptr<void>& shared_object, const char* symbol_name) {
if (!shared_object) {
@ -57,9 +57,9 @@ struct SharedObjectLoader::Impl {
explicit Impl(const char* pluginName) : shared_object{ov::runtime::load_shared_object(pluginName)} {}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
explicit Impl(const wchar_t* pluginName) : Impl(ov::util::wstring_to_string(pluginName).c_str()) {}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
void* get_symbol(const char* symbolName) const {
return ov::runtime::get_symbol(shared_object, symbolName);
@ -70,7 +70,7 @@ SharedObjectLoader::SharedObjectLoader(const std::shared_ptr<void>& shared_objec
_impl.reset(new Impl(shared_object));
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
SharedObjectLoader::SharedObjectLoader(const wchar_t* pluginName) {
_impl.reset(new Impl(pluginName));
}

View File

@ -122,7 +122,7 @@ std::shared_ptr<void> load_shared_object(const char* path) {
}};
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::shared_ptr<void> load_shared_object(const wchar_t* path) {
void* shared_object = nullptr;
using GetDllDirectoryW_Fnc = DWORD(*)(DWORD, LPWSTR);
@ -193,9 +193,9 @@ struct SharedObjectLoader::Impl {
explicit Impl(const char* pluginName) : shared_object{ov::runtime::load_shared_object(pluginName)} {}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
explicit Impl(const wchar_t* pluginName) : shared_object{ov::runtime::load_shared_object(pluginName)} {}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
void* get_symbol(const char* symbolName) const {
return ov::runtime::get_symbol(shared_object, symbolName);
@ -211,7 +211,7 @@ SharedObjectLoader::~SharedObjectLoader() {}
SharedObjectLoader::SharedObjectLoader(const char * pluginName) {
_impl = std::make_shared<Impl>(pluginName);
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
SharedObjectLoader::SharedObjectLoader(const wchar_t* pluginName) {
_impl = std::make_shared<Impl>(pluginName);
}

View File

@ -24,6 +24,20 @@
#include <legacy/ie_layers_property.hpp>
#include <ngraph/node.hpp>
#if defined IMPLEMENT_INFERENCE_ENGINE_API || defined IMPLEMENT_INFERENCE_ENGINE_PLUGIN
# define INFERENCE_ENGINE_INTERNAL(msg)
#else
# define INFERENCE_ENGINE_INTERNAL(msg) INFERENCE_ENGINE_DEPRECATED(msg)
#endif
#ifdef _WIN32
# define _IE_SUPPRESS_DEPRECATED_START_MSVC IE_SUPPRESS_DEPRECATED_START
# define _IE_SUPPRESS_DEPRECATED_END_MSVC IE_SUPPRESS_DEPRECATED_END
#else
# define _IE_SUPPRESS_DEPRECATED_START_MSVC
# define _IE_SUPPRESS_DEPRECATED_END_MSVC
#endif
#if defined IMPLEMENT_INFERENCE_ENGINE_API || defined IMPLEMENT_INFERENCE_ENGINE_PLUGIN
# define INFERENCE_ENGINE_INTERNAL_CNNLAYER_CLASS(...) INFERENCE_ENGINE_API_CLASS(__VA_ARGS__)
#else

View File

@ -52,7 +52,7 @@ INFERENCE_ENGINE_API_CPP(bool) directoryExists(const std::string& path);
*/
INFERENCE_ENGINE_API(long long) fileSize(const char *fileName);
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Returns file size for file with UNICODE path name
@ -66,7 +66,7 @@ inline long long fileSize(const wchar_t* fileName) {
return fileSize(::ov::util::wstring_to_string(fileName).c_str());
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Function to get the size of a file. The function supports UNICODE path
@ -150,7 +150,7 @@ namespace InferenceEngine {
*/
INFERENCE_ENGINE_API_CPP(std::string) getIELibraryPath();
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Returns a unicode path to Inference Engine library
@ -169,6 +169,6 @@ inline ::ov::util::FilePath getInferenceEngineLibraryPath() {
return getIELibraryPath();
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
} // namespace InferenceEngine

View File

@ -20,14 +20,14 @@ namespace runtime {
*/
INFERENCE_ENGINE_API_CPP(std::shared_ptr<void>) load_shared_object(const char* path);
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Loads a library with the wide char name specified.
* @param path Full or relative path to the plugin library
* @return Reference to shared object
*/
INFERENCE_ENGINE_API_CPP(std::shared_ptr<void>) load_shared_object(const wchar_t* path);
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Searches for a function symbol in the loaded module
* @param shared_object shared object reference

View File

@ -254,7 +254,7 @@ struct parse_result {
* @return The parse_result.
*/
inline parse_result ParseXml(const char* file_path) {
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::wstring wFilePath = ov::util::string_to_wstring(file_path);
const wchar_t* resolvedFilepath = wFilePath.c_str();
#else

View File

@ -71,7 +71,7 @@ namespace {
void readAllFile(const std::string& string_file_name, void* buffer, size_t maxSize) {
std::ifstream inputFile;
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring file_name = ov::util::string_to_wstring(string_file_name.c_str());
#else
std::string file_name = string_file_name;

View File

@ -4,6 +4,7 @@
#include <xml_parse_utils.h>
#include "openvino/runtime/common.hpp"
#include <ie_ir_version.hpp>
#include <ie_ir_reader.hpp>
#include <memory>
@ -41,6 +42,6 @@ CNNNetwork IRReader::read(std::istream& model, const Blob::CPtr& weights, const
return CNNNetwork(parser.parse(root, weights));
}
INFERENCE_PLUGIN_API(void) InferenceEngine::CreateReader(std::shared_ptr<IReader>& reader) {
OPENVINO_PLUGIN_API(void) InferenceEngine::CreateReader(std::shared_ptr<IReader>& reader) {
reader = std::make_shared<IRReader>();
}

View File

@ -4,6 +4,7 @@
#pragma once
#include "openvino/runtime/common.hpp"
#include <cpp/ie_cnn_network.h>
#include <ie_iextension.h>
#include <istream>
@ -57,6 +58,6 @@ protected:
* @brief Creates the default instance of the reader
* @return Reader interface
*/
INFERENCE_PLUGIN_API(void) CreateReader(std::shared_ptr<IReader>& reader);
OPENVINO_PLUGIN_API(void) CreateReader(std::shared_ptr<IReader>& reader);
} // namespace InferenceEngine

View File

@ -16,7 +16,7 @@
#include "network_utils.hpp"
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# define GTEST_COUT std::cerr << "[ ] [ INFO ] "
# include <codecvt>
#endif
@ -71,7 +71,7 @@ TEST_P(NetReaderTest, ReadNetworkTwiceSeparately) {
IE_SUPPRESS_DEPRECATED_END
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
TEST_P(NetReaderTest, ReadCorrectModelWithWeightsUnicodePath) {
GTEST_COUT << "params.modelPath: '" << _modelPath << "'" << std::endl;

View File

@ -76,7 +76,7 @@ TEST(ONNX_Reader_Tests, ImportModelWithExternalDataFromStringException) {
}
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
TEST(ONNX_Reader_Tests, ImportModelWithExternalDataFromWstringNamedFile) {
InferenceEngine::Core ie;
std::string win_dir_path = CommonTestUtils::getModelFromTestModelZoo(

View File

@ -4,6 +4,8 @@
#include <gtest/gtest.h>
#include "ie_blob.h"
#include <openvino/core/except.hpp>
#include <openvino/runtime/variable_state.hpp>

View File

@ -47,7 +47,7 @@ TEST(PDPD_Reader_Tests, ImportBasicModelToCore) {
ASSERT_TRUE(res.valid) << res.message;
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
TEST(PDPD_Reader_Tests, ImportBasicModelToCoreWstring) {
std::string win_dir_path{ PADDLE_TEST_MODELS "relu.pdmodel" };
std::wstring wmodel = CommonTestUtils::addUnicodePostfixToPath(win_dir_path,

View File

@ -49,7 +49,7 @@ TEST_F(CompiledKernelsCacheTest, CanCreateCacheDirAndDumpBinaries) {
}
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
TEST_F(CompiledKernelsCacheTest, CanCreateCacheDirAndDumpBinariesUnicodePath) {
std::shared_ptr<InferenceEngine::Core> ie = PluginCache::get().ie();
@ -83,4 +83,4 @@ TEST_F(CompiledKernelsCacheTest, CanCreateCacheDirAndDumpBinariesUnicodePath) {
}
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT

View File

@ -21,7 +21,7 @@
#include <common_test_utils/common_utils.hpp>
#include <common_test_utils/test_assertions.hpp>
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#include <iostream>
#define GTEST_COUT std::cerr << "[ ] [ INFO ] "
#include <codecvt>
@ -263,7 +263,7 @@ TEST(IEClassBasicTest, smoke_createMockEngineConfigThrows) {
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
TEST_P(IEClassBasicTestP, smoke_registerPluginsXMLUnicodePath) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
@ -310,7 +310,7 @@ TEST_P(IEClassBasicTestP, smoke_registerPluginsXMLUnicodePath) {
CommonTestUtils::removeFile(pluginXML);
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
//
// GetVersions()

View File

@ -21,7 +21,7 @@
#include "common_test_utils/unicode_utils.hpp"
#include "ngraph_functions/subgraph_builders.hpp"
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# include <iostream>
# define GTEST_COUT std::cerr << "[ ] [ INFO ] "
# include <codecvt>
@ -258,7 +258,7 @@ TEST(OVClassBasicTest, smoke_createMockEngineConfigThrows) {
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
TEST_P(OVClassBasicTestP, smoke_registerPluginsXMLUnicodePath) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
@ -305,7 +305,7 @@ TEST_P(OVClassBasicTestP, smoke_registerPluginsXMLUnicodePath) {
CommonTestUtils::removeFile(pluginXML);
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
//
// GetVersions()

View File

@ -5,7 +5,7 @@
#include <gtest/gtest.h>
#include "unicode_utils.hpp"
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
namespace CommonTestUtils {
@ -22,4 +22,4 @@ const std::vector<std::wstring> test_unicode_postfix_vector = {
} // namespace CommonTestUtils
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT

View File

@ -13,7 +13,7 @@
#include "common_utils.hpp"
#include "w_dirent.h"
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
namespace CommonTestUtils {
@ -161,4 +161,4 @@ inline bool directoryExists(const std::wstring &path) {
extern const std::vector<std::wstring> test_unicode_postfix_vector;
} // namespace CommonTestUtils
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT

View File

@ -7,6 +7,7 @@
#include <map>
#include <string>
#include "openvino/runtime/common.hpp"
#include "mock_plugin.hpp"
#include "description_buffer.hpp"
@ -132,17 +133,17 @@ std::string MockPlugin::GetName() const noexcept {
InferenceEngine::IInferencePlugin *__target = nullptr;
INFERENCE_PLUGIN_API(void) CreatePluginEngine(std::shared_ptr<InferenceEngine::IInferencePlugin>& plugin) {
OPENVINO_PLUGIN_API(void) CreatePluginEngine(std::shared_ptr<InferenceEngine::IInferencePlugin>& plugin) {
IInferencePlugin *p = nullptr;
std::swap(__target, p);
plugin = std::make_shared<MockPlugin>(p);
}
INFERENCE_PLUGIN_API(InferenceEngine::IInferencePlugin*)
OPENVINO_PLUGIN_API(InferenceEngine::IInferencePlugin*)
CreatePluginEngineProxy(InferenceEngine::IInferencePlugin *target) {
return new MockPlugin(target);
}
INFERENCE_PLUGIN_API(void) InjectProxyEngine(InferenceEngine::IInferencePlugin *target) {
OPENVINO_PLUGIN_API(void) InjectProxyEngine(InferenceEngine::IInferencePlugin *target) {
__target = target;
}

View File

@ -30,18 +30,18 @@
#include <malloc.h>
#endif
#ifndef ENABLE_UNICODE_PATH_SUPPORT
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
#ifndef _WIN32
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#include <locale>
#include <codecvt>
#endif
@ -55,7 +55,7 @@
namespace {
std::mutex cacheAccessMutex;
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring multiByteCharToWString(const char* str) {
#ifdef _WIN32
int strSize = static_cast<int>(std::strlen(str));
@ -69,12 +69,12 @@ std::wstring multiByteCharToWString(const char* str) {
return result;
#endif // _WIN32
}
#endif // defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#endif // defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
static std::vector<unsigned char> loadBinaryFromFile(std::string path) {
std::lock_guard<std::mutex> lock(cacheAccessMutex);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring widefilename = multiByteCharToWString(path.c_str());
const wchar_t* filename = widefilename.c_str();
FILE *fp = _wfopen(filename, L"rb");
@ -101,7 +101,7 @@ static std::vector<unsigned char> loadBinaryFromFile(std::string path) {
}
static void saveBinaryToFile(std::string path, const std::vector<unsigned char> buffer) {
std::lock_guard<std::mutex> lock(cacheAccessMutex);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring widefilename = multiByteCharToWString(path.c_str());
const wchar_t* filename = widefilename.c_str();
#else

View File

@ -6,3 +6,7 @@
#include "openvino/core/core_visibility.hpp"
#define NGRAPH_API OPENVINO_API
#ifdef ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#endif

View File

@ -4,6 +4,5 @@
#include <openvino/core/visibility.hpp>
#define NGRAPH_HELPER_DLL_IMPORT CORE_HELPER_DLL_IMPORT
#define NGRAPH_HELPER_DLL_EXPORT CORE_HELPER_DLL_EXPORT
#define NGRAPH_HELPER_DLL_LOCAL CORE_HELPER_DLL_LOCAL
#define NGRAPH_HELPER_DLL_IMPORT OPENVINO_CORE_IMPORTS
#define NGRAPH_HELPER_DLL_EXPORT OPENVINO_CORE_EXPORTS

View File

@ -16,20 +16,11 @@
#ifdef NGRAPH_STATIC_LIBRARY // defined if we are building or calling NGRAPH as a static library
# define OPENVINO_API
# define OPENVINO_API
#else
# ifdef ngraph_EXPORTS // defined if we are building the NGRAPH DLL (instead of using it)
# define OPENVINO_API CORE_HELPER_DLL_EXPORT
# define OPENVINO_API OPENVINO_CORE_EXPORTS
# else
# define OPENVINO_API CORE_HELPER_DLL_IMPORT
# define OPENVINO_API OPENVINO_CORE_IMPORTS
# endif // ngraph_EXPORTS
#endif // NGRAPH_STATIC_LIBRARY
#ifndef ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif

View File

@ -85,7 +85,7 @@ inline std::shared_ptr<Variant> make_variant(const char (&s)[N]) {
return std::dynamic_pointer_cast<VariantImpl<std::string>>(std::make_shared<VariantWrapper<std::string>>(s));
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
template <size_t N>
inline std::shared_ptr<Variant> make_variant(const wchar_t (&s)[N]) {
return std::dynamic_pointer_cast<VariantImpl<std::wstring>>(std::make_shared<VariantWrapper<std::wstring>>(s));

View File

@ -4,16 +4,40 @@
// https://gcc.gnu.org/wiki/Visibility
// Generic helper definitions for shared library support
#if defined _WIN32 || defined __CYGWIN__
# define CORE_HELPER_DLL_IMPORT __declspec(dllimport)
# define CORE_HELPER_DLL_EXPORT __declspec(dllexport)
# define CORE_HELPER_DLL_LOCAL
#elif defined(__GNUC__) && __GNUC__ >= 4
# define CORE_HELPER_DLL_IMPORT __attribute__((visibility("default")))
# define CORE_HELPER_DLL_EXPORT __attribute__((visibility("default")))
# define CORE_HELPER_DLL_LOCAL __attribute__((visibility("hidden")))
#else
# define CORE_HELPER_DLL_IMPORT
# define CORE_HELPER_DLL_EXPORT
# define CORE_HELPER_DLL_LOCAL
#ifndef OPENVINO_EXTERN_C
# ifdef __cplusplus
# define OPENVINO_EXTERN_C extern "C"
# else
# define OPENVINO_EXTERN_C
# endif
#endif
#if defined _WIN32
# define OPENVINO_CDECL __cdecl
# define OPENVINO_STDCALL __stdcall
#else
# define OPENVINO_CDECL
# define OPENVINO_STDCALL
#endif
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
#if defined _WIN32 || defined __CYGWIN__
# define OPENVINO_CORE_IMPORTS __declspec(dllimport)
# define OPENVINO_CORE_EXPORTS __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define OPENVINO_CORE_IMPORTS __attribute__((visibility("default")))
# define OPENVINO_CORE_EXPORTS __attribute__((visibility("default")))
#else
# define OPENVINO_CORE_IMPORTS
# define OPENVINO_CORE_EXPORTS
#endif

View File

@ -50,7 +50,7 @@ void file_util::convert_path_win_style(std::string& path) {
ov::util::convert_path_win_style(path);
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::string file_util::wstring_to_string(const std::wstring& wstr) {
return ov::util::wstring_to_string(wstr);
@ -59,4 +59,4 @@ std::string file_util::wstring_to_string(const std::wstring& wstr) {
std::wstring file_util::multi_byte_char_to_wstring(const char* str) {
return ov::util::string_to_wstring(str);
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT

View File

@ -35,7 +35,7 @@ public:
VariantWrapper(const value_type& value) : VariantImpl<value_type>(value) {}
};
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
template <>
class FRONTEND_API VariantWrapper<std::wstring> : public VariantImpl<std::wstring> {
public:

View File

@ -11,7 +11,7 @@
# include <dlfcn.h>
# include <limits.h>
# include <unistd.h>
# ifdef ENABLE_UNICODE_PATH_SUPPORT
# ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# include <codecvt>
# include <locale>
# endif

View File

@ -64,7 +64,7 @@ bool FrontEndIR::supported_impl(const std::vector<std::shared_ptr<Variant>>& var
if (ov::is_type<ov::VariantWrapper<std::string>>(model_variant)) {
const auto& path = ov::as_type_ptr<ov::VariantWrapper<std::string>>(model_variant)->get();
local_model_stream.open(path, std::ios::in | std::ifstream::binary);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
} else if (ov::is_type<ov::VariantWrapper<std::wstring>>(model_variant)) {
const auto& path = ov::as_type_ptr<ov::VariantWrapper<std::wstring>>(model_variant)->get();
local_model_stream.open(path, std::ios::in | std::ifstream::binary);
@ -109,7 +109,7 @@ InputModel::Ptr FrontEndIR::load_impl(const std::vector<std::shared_ptr<Variant>
return nullptr;
};
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring weights_path, model_path;
#else
std::string weights_path, model_path;
@ -119,13 +119,13 @@ InputModel::Ptr FrontEndIR::load_impl(const std::vector<std::shared_ptr<Variant>
const auto& model_variant = variants.at(0);
if (ov::is_type<ov::VariantWrapper<std::string>>(model_variant)) {
const auto& tmp_path = ov::as_type_ptr<ov::VariantWrapper<std::string>>(model_variant)->get();
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
model_path = ov::util::string_to_wstring(tmp_path.c_str());
#else
model_path = tmp_path;
#endif
local_model_stream.open(model_path, std::ios::in | std::ifstream::binary);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
} else if (ov::is_type<ov::VariantWrapper<std::wstring>>(model_variant)) {
model_path = ov::as_type_ptr<ov::VariantWrapper<std::wstring>>(model_variant)->get();
local_model_stream.open(model_path, std::ios::in | std::ifstream::binary);
@ -141,12 +141,12 @@ InputModel::Ptr FrontEndIR::load_impl(const std::vector<std::shared_ptr<Variant>
const auto& variant = variants.at(variant_id);
if (ov::is_type<ov::VariantWrapper<std::string>>(variant)) {
const auto& tmp_path = ov::as_type_ptr<ov::VariantWrapper<std::string>>(variant)->get();
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
weights_path = ov::util::string_to_wstring(tmp_path.c_str());
#else
weights_path = tmp_path;
#endif
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
} else if (ov::is_type<ov::VariantWrapper<std::wstring>>(variant)) {
weights_path = ov::as_type_ptr<ov::VariantWrapper<std::wstring>>(variant)->get();
#endif
@ -163,7 +163,7 @@ InputModel::Ptr FrontEndIR::load_impl(const std::vector<std::shared_ptr<Variant>
if (pos != model_path.npos)
weights_path = model_path.substr(0, pos);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
weights_path += L".bin";
#else
weights_path += ".bin";
@ -177,7 +177,7 @@ InputModel::Ptr FrontEndIR::load_impl(const std::vector<std::shared_ptr<Variant>
std::ifstream bin_stream;
bin_stream.open(weights_path, std::ios::binary);
if (!bin_stream.is_open())
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
IR_THROW("Weights file " + ov::util::wstring_to_string(weights_path) + " cannot be opened!");
#else
IR_THROW("Weights file " + weights_path + " cannot be opened!");

View File

@ -107,7 +107,7 @@ void ngraph::onnx_import::transform::update_external_data_paths(ONNX_NAMESPACE::
const auto santized_external_data_relative_path = file_util::sanitize_path(external_data_relative_path);
auto external_data_full_path = file_util::path_join(model_dir_path, santized_external_data_relative_path);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
file_util::convert_path_win_style(external_data_full_path);
#endif

View File

@ -198,7 +198,7 @@ struct onnx_editor::ONNXModelEditor::Impl {
Impl(std::istream& model_stream)
: m_model_proto{std::make_shared<ONNX_NAMESPACE::ModelProto>(onnx_common::parse_from_istream(model_stream))} {}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
Impl(const std::wstring& model_path)
: m_model_proto{std::make_shared<ONNX_NAMESPACE::ModelProto>(onnx_common::parse_from_file(model_path))} {}
#endif
@ -210,7 +210,7 @@ onnx_editor::ONNXModelEditor::ONNXModelEditor(const std::string& model_path)
delete impl;
}} {}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
onnx_editor::ONNXModelEditor::ONNXModelEditor(const std::wstring& model_path)
: m_model_path{file_util::wstring_to_string(model_path)},
m_pimpl{new ONNXModelEditor::Impl{model_path}, [](Impl* impl) {

View File

@ -31,7 +31,7 @@ public:
///
/// \param model_path Path to the file containing the model.
ONNXModelEditor(const std::string& model_path);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
ONNXModelEditor(const std::wstring& model_path);
#endif

View File

@ -41,7 +41,7 @@ InputModel::Ptr FrontEndONNX::load_impl(const std::vector<std::shared_ptr<Varian
const auto path = ov::as_type_ptr<VariantString>(variants[0])->get();
return std::make_shared<InputModelONNX>(path);
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
if (ov::is_type<VariantWString>(variants[0])) {
const auto path = ov::as_type_ptr<VariantWString>(variants[0])->get();
return std::make_shared<InputModelONNX>(path);
@ -53,7 +53,7 @@ InputModel::Ptr FrontEndONNX::load_impl(const std::vector<std::shared_ptr<Varian
const auto path = ov::as_type_ptr<VariantString>(variants[1])->get();
return std::make_shared<InputModelONNX>(*stream, path);
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
if (variants.size() > 1 && ov::is_type<VariantWString>(variants[1])) {
const auto path = ov::as_type_ptr<VariantWString>(variants[1])->get();
return std::make_shared<InputModelONNX>(*stream, path);
@ -115,7 +115,7 @@ bool FrontEndONNX::supported_impl(const std::vector<std::shared_ptr<Variant>>& v
const auto path = ov::as_type_ptr<VariantString>(variants[0])->get();
model_stream.open(path, std::ios::in | std::ifstream::binary);
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
else if (ov::is_type<VariantWString>(variants[0])) {
const auto path = ov::as_type_ptr<VariantWString>(variants[0])->get();
model_stream.open(path, std::ios::in | std::ifstream::binary);

View File

@ -17,7 +17,7 @@ NGRAPH_SUPPRESS_DEPRECATED_START
InputModelONNX::InputModelONNX(const std::string& path)
: m_editor{std::make_shared<onnx_editor::ONNXModelEditor>(path)} {}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
InputModelONNX::InputModelONNX(const std::wstring& path)
: m_editor{std::make_shared<onnx_editor::ONNXModelEditor>(path)} {}
#endif

View File

@ -13,7 +13,7 @@ namespace frontend {
class InputModelONNX : public InputModel {
public:
InputModelONNX(const std::string& path);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
InputModelONNX(const std::wstring& path);
#endif
InputModelONNX(std::istream& model_stream);

View File

@ -30,7 +30,7 @@ TensorExternalData::TensorExternalData(const ONNX_NAMESPACE::TensorProto& tensor
std::string TensorExternalData::load_external_data() const {
NGRAPH_SUPPRESS_DEPRECATED_START
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring path = ov::util::string_to_wstring(m_data_location);
#else
std::string path = m_data_location;

View File

@ -18,7 +18,7 @@ namespace onnx_common {
///
/// \return The parsed in-memory representation of the ONNX model
ONNX_NAMESPACE::ModelProto parse_from_file(const std::string& file_path);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
ONNX_NAMESPACE::ModelProto parse_from_file(const std::wstring& file_path);
#endif

View File

@ -26,7 +26,7 @@ ONNX_NAMESPACE::ModelProto parse_from_file(const std::string& file_path) {
return model_proto;
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
ONNX_NAMESPACE::ModelProto parse_from_file(const std::wstring& file_path) {
std::ifstream file_stream{file_path, std::ios::in | std::ios::binary};

View File

@ -22,7 +22,7 @@ class PDPD_API InputModelPDPD : public InputModel {
public:
explicit InputModelPDPD(const std::string& path);
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
explicit InputModelPDPD(const std::wstring& path);
#endif
explicit InputModelPDPD(const std::vector<std::istream*>& streams);

View File

@ -122,7 +122,7 @@ std::istream* variant_to_stream_ptr(const std::shared_ptr<Variant>& variant, std
const auto& model_path = ov::as_type_ptr<VariantWrapper<std::string>>(variant)->get();
ext_stream.open(model_path, std::ios::in | std::ifstream::binary);
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
else if (ov::is_type<VariantWrapper<std::wstring>>(variant)) {
const auto& model_path = ov::as_type_ptr<VariantWrapper<std::wstring>>(variant)->get();
ext_stream.open(model_path, std::ios::in | std::ifstream::binary);
@ -219,7 +219,7 @@ bool FrontEndPDPD::supported_impl(const std::vector<std::shared_ptr<Variant>>& v
// but it will complicate the check, while it should be as quick as possible
return model_str && model_str.is_open();
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
else if (ov::is_type<VariantWrapper<std::wstring>>(variants[0])) {
std::wstring suffix = L".pdmodel";
std::wstring model_path = ov::as_type_ptr<VariantWrapper<std::wstring>>(variants[0])->get();
@ -248,7 +248,7 @@ InputModel::Ptr FrontEndPDPD::load_impl(const std::vector<std::shared_ptr<Varian
std::string m_path = ov::as_type_ptr<VariantWrapper<std::string>>(variants[0])->get();
return std::make_shared<InputModelPDPD>(m_path);
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
else if (ov::is_type<VariantWrapper<std::wstring>>(variants[0])) {
std::wstring m_path = ov::as_type_ptr<VariantWrapper<std::wstring>>(variants[0])->get();
return std::make_shared<InputModelPDPD>(m_path);

View File

@ -14,7 +14,7 @@
#include "node_context.hpp"
#include "pdpd_utils.hpp"
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
# include <codecvt>
# include <locale>
#endif
@ -148,7 +148,7 @@ std::basic_string<T> get_const_path(const std::basic_string<T>& folder_with_weig
return folder_with_weights + pdpd::get_path_sep<T>() + name;
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
template <>
std::basic_string<wchar_t> get_const_path(const std::basic_string<wchar_t>& folder, const std::string& name) {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
@ -174,7 +174,7 @@ std::basic_string<T> get_model_path(const std::basic_string<T>& path, std::ifstr
return model_file;
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
template <>
std::basic_string<wchar_t> get_model_path(const std::basic_string<wchar_t>& path, std::ifstream* weights_stream) {
std::wstring model_file{path};
@ -403,7 +403,7 @@ void InputModelPDPD::InputModelPDPDImpl::setTensorValue(Place::Ptr place, const
InputModelPDPD::InputModelPDPD(const std::string& path) : _impl{std::make_shared<InputModelPDPDImpl>(path, *this)} {}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
InputModelPDPD::InputModelPDPD(const std::wstring& path) : _impl{std::make_shared<InputModelPDPDImpl>(path, *this)} {}
#endif

View File

@ -11,7 +11,7 @@ namespace frontend {
namespace pdpd {
#ifdef _WIN32
const char PATH_SEPARATOR = '\\';
# if defined(ENABLE_UNICODE_PATH_SUPPORT)
# if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT)
const wchar_t WPATH_SEPARATOR = L'\\';
# endif
#else
@ -23,7 +23,7 @@ inline std::basic_string<T> get_path_sep() {
return std::basic_string<T>{PATH_SEPARATOR};
}
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
template <>
inline std::basic_string<wchar_t> get_path_sep() {
return std::basic_string<wchar_t>{WPATH_SEPARATOR};

View File

@ -9,13 +9,13 @@
#include <string>
#include <vector>
#ifndef ENABLE_UNICODE_PATH_SUPPORT
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
@ -76,7 +76,7 @@ struct FileTraits<wchar_t> {
}
};
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Conversion from wide character string to a single-byte chain.
* @param wstr A wide-char string
@ -128,7 +128,7 @@ bool directory_exists(const std::string& path);
* @return file size
*/
inline uint64_t file_size(const char* path) {
#if defined(ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
std::wstring widefilename = ov::util::string_to_wstring(path);
const wchar_t* file_name = widefilename.c_str();
#elif defined(__ANDROID__) || defined(ANDROID)
@ -144,7 +144,7 @@ inline uint64_t file_size(const char* path) {
return in.tellg();
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Returns file size for file
@ -155,7 +155,7 @@ inline uint64_t file_size(const std::wstring& path) {
return file_size(wstring_to_string(path).c_str());
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Returns file size for file
@ -190,7 +190,7 @@ void convert_path_win_style(std::string& path);
std::string get_ov_lib_path();
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
using FilePath = std::wstring;
@ -214,9 +214,9 @@ inline FilePath to_file_path(const std::string& path) {
return path;
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Returns a unicode path to openvino libraries
@ -234,7 +234,7 @@ inline std::string get_ov_library_path() {
return get_ov_lib_path();
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
template <typename C,
typename = typename std::enable_if<(std::is_same<C, char>::value || std::is_same<C, wchar_t>::value)>::type>

View File

@ -37,7 +37,7 @@
# include <sys/time.h>
# include <unistd.h>
# ifdef ENABLE_UNICODE_PATH_SUPPORT
# ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# include <codecvt>
# include <locale>
# endif
@ -229,7 +229,7 @@ void ov::util::convert_path_win_style(std::string& path) {
std::replace(path.begin(), path.end(), '/', '\\');
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::string ov::util::wstring_to_string(const std::wstring& wstr) {
# ifdef _WIN32
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
@ -340,14 +340,14 @@ static std::string get_ov_library_path_a() {
} // namespace
std::string ov::util::get_ov_lib_path() {
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
return ov::util::wstring_to_string(ov::util::get_ov_lib_path_w());
#else
return get_ov_library_path_a();
#endif
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::wstring ov::util::get_ov_lib_path_w() {
# ifdef _WIN32
@ -369,4 +369,4 @@ std::wstring ov::util::get_ov_lib_path_w() {
# endif
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT