diff --git a/src/bindings/python/src/pyopenvino/frontend/frontend.cpp b/src/bindings/python/src/pyopenvino/frontend/frontend.cpp index afc9e0af361c52..888246d5e8fa8b 100644 --- a/src/bindings/python/src/pyopenvino/frontend/frontend.cpp +++ b/src/bindings/python/src/pyopenvino/frontend/frontend.cpp @@ -47,7 +47,7 @@ void regclass_frontend_FrontEnd(py::module m) { py::isinstance(py_obj)) { // Fix unicode path -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) return self.load(ov::util::string_to_wstring(model_path.c_str())); #else return self.load(model_path.c_str()); @@ -89,7 +89,7 @@ void regclass_frontend_FrontEnd(py::module m) { py::isinstance(model)) { // Fix unicode path -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) return self.supported(ov::util::string_to_wstring(model_path.c_str())); #else return self.supported(model_path.c_str()); diff --git a/src/bindings/python/src/pyopenvino/frontend/manager.cpp b/src/bindings/python/src/pyopenvino/frontend/manager.cpp index 408bb224f7679b..7186ce75fd9540 100644 --- a/src/bindings/python/src/pyopenvino/frontend/manager.cpp +++ b/src/bindings/python/src/pyopenvino/frontend/manager.cpp @@ -83,7 +83,7 @@ void regclass_frontend_FrontEndManager(py::module m) { std::string model_path = Common::utils::convert_path_to_string(model); // Fix unicode path -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) return fem->load_by_model(ov::util::string_to_wstring(model_path.c_str())); #else std::string model_path_str = model_path; diff --git a/src/bindings/python/src/pyopenvino/pyopenvino.cpp b/src/bindings/python/src/pyopenvino/pyopenvino.cpp index 969599e2144553..f14f5a0e9e9e8d 100644 --- a/src/bindings/python/src/pyopenvino/pyopenvino.cpp +++ b/src/bindings/python/src/pyopenvino/pyopenvino.cpp @@ -179,7 +179,7 @@ PYBIND11_MODULE(_pyopenvino, m) { throw py::attribute_error("'model' argument is required and cannot be None."); } // Fix unicode path -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) ov::save_model(model, ov::util::string_to_wstring(Common::utils::convert_path_to_string(xml_path)), compress_to_fp16); diff --git a/src/core/include/openvino/core/graph_util.hpp b/src/core/include/openvino/core/graph_util.hpp index d5cbd3ac7610a0..66c640a62314df 100644 --- a/src/core/include/openvino/core/graph_util.hpp +++ b/src/core/include/openvino/core/graph_util.hpp @@ -305,7 +305,7 @@ void save_model(const std::shared_ptr& model, const std::string& output_model, bool compress_to_fp16 = true); -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) OPENVINO_API void save_model(const std::shared_ptr& model, const std::wstring& output_model, diff --git a/src/core/include/openvino/pass/serialize.hpp b/src/core/include/openvino/pass/serialize.hpp index dc18ac81659950..dd75e52f88b322 100644 --- a/src/core/include/openvino/pass/serialize.hpp +++ b/src/core/include/openvino/pass/serialize.hpp @@ -35,7 +35,7 @@ class OPENVINO_API Serialize : public ov::pass::ModelPass { Serialize(const std::string& xmlPath, const std::string& binPath, Version version = Version::UNSPECIFIED); -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) Serialize(const std::wstring& xmlPath, const std::wstring& binPath, Version version = Version::UNSPECIFIED); #endif @@ -46,7 +46,7 @@ class OPENVINO_API Serialize : public ov::pass::ModelPass { const std::string m_binPath; const Version m_version; const std::map m_custom_opsets; -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) const std::wstring m_xmlPath_wchar; const std::wstring m_binPath_wchar; #endif diff --git a/src/core/src/graph_util.cpp b/src/core/src/graph_util.cpp index 2b9283cdf55b2b..92661969e5dba1 100644 --- a/src/core/src/graph_util.cpp +++ b/src/core/src/graph_util.cpp @@ -344,7 +344,7 @@ void save_model(const std::shared_ptr& m, const std::string& ou manager.run_passes(std::move(cloned)); } -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) void save_model(const std::shared_ptr& m, const std::wstring& output_model, bool compress_to_fp16) { auto cloned = m->clone(); if (compress_to_fp16) { diff --git a/src/core/src/pass/serialize.cpp b/src/core/src/pass/serialize.cpp index 27abbc161dfc43..705ff2967f090f 100644 --- a/src/core/src/pass/serialize.cpp +++ b/src/core/src/pass/serialize.cpp @@ -1144,7 +1144,7 @@ std::string valid_xml_path(const std::string& path) { return path; } -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) std::wstring valid_xml_path(const std::wstring& path) { OPENVINO_ASSERT(path.size() > 4, "Path for xml file is too short."); @@ -1234,7 +1234,7 @@ bool pass::Serialize::run_on_model(const std::shared_ptr& model) { if (xmlDir != m_xmlPath) ov::util::create_directory_recursive(xmlDir); } -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) else { auto xmlDir = ov::util::get_directory(m_xmlPath_wchar); if (xmlDir != m_xmlPath_wchar) @@ -1252,7 +1252,7 @@ bool pass::Serialize::run_on_model(const std::shared_ptr& model) { xml_file.open(m_xmlPath, std::ios::out); OPENVINO_ASSERT(xml_file, "Can't open xml file: \"" + m_xmlPath + "\""); } -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) else { bin_file.open(m_binPath_wchar.c_str(), std::ios::out | std::ios::binary); OPENVINO_ASSERT(bin_file, "Can't open bin file."); @@ -1273,7 +1273,7 @@ bool pass::Serialize::run_on_model(const std::shared_ptr& model) { bin_file.close(); std::remove(m_xmlPath.c_str()); std::remove(m_binPath.c_str()); -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) _wremove(m_xmlPath_wchar.c_str()); _wremove(m_binPath_wchar.c_str()); #endif @@ -1290,7 +1290,7 @@ pass::Serialize::Serialize(std::ostream& xmlFile, std::ostream& binFile, pass::S m_binFile{&binFile}, m_xmlPath{}, m_binPath{}, -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) m_xmlPath_wchar{}, m_binPath_wchar{}, #endif @@ -1302,14 +1302,14 @@ pass::Serialize::Serialize(const std::string& xmlPath, const std::string& binPat m_binFile{nullptr}, m_xmlPath{valid_xml_path(xmlPath)}, m_binPath{provide_bin_path(xmlPath, binPath)}, -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) m_xmlPath_wchar{}, m_binPath_wchar{}, #endif m_version{version} { } -#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32) +#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) pass::Serialize::Serialize(const std::wstring& xmlPath, const std::wstring& binPath, pass::Serialize::Version version) : m_xmlFile{nullptr}, m_binFile{nullptr},