diff --git a/src/common/util/src/file_util.cpp b/src/common/util/src/file_util.cpp index a26188ee6f7b3a..9ff7923cfd89b9 100644 --- a/src/common/util/src/file_util.cpp +++ b/src/common/util/src/file_util.cpp @@ -33,7 +33,9 @@ /// @brief Windows-specific 'mkdir' wrapper # define makedir(dir) _mkdir(dir) // Copied from linux libc sys/stat.h: -# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) +# if !defined(__MINGW32__) && !defined(__MINGW64__) +# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) +# endif #else # include # include diff --git a/src/frontends/paddle/src/input_model.cpp b/src/frontends/paddle/src/input_model.cpp index 8518db040eea39..1cba2924d81873 100644 --- a/src/frontends/paddle/src/input_model.cpp +++ b/src/frontends/paddle/src/input_model.cpp @@ -5,6 +5,9 @@ #include "input_model.hpp" #include +#if defined(__MINGW32__) || defined(__MINGW64__) +# include +#endif #include #include "decoder_proto.hpp" @@ -291,7 +294,12 @@ void InputModel::InputModelImpl::load_consts(const std::basic_string& folder_ bool read_succeed = false; if (!folder_with_weights.empty()) { +#if defined(__MINGW32__) || defined(__MINGW64__) + std::ifstream is(std::filesystem::path(get_const_path(folder_with_weights, name)), + std::ios::in | std::ifstream::binary); +#else std::ifstream is(get_const_path(folder_with_weights, name), std::ios::in | std::ifstream::binary); +#endif FRONT_END_GENERAL_CHECK(is && is.is_open(), "Cannot open file for constant value."); const size_t header_size = 16; std::vector header(header_size); diff --git a/src/frontends/tensorflow/src/graph_iterator_proto.hpp b/src/frontends/tensorflow/src/graph_iterator_proto.hpp index 5ef6d0a5954b41..75edb26117b6aa 100644 --- a/src/frontends/tensorflow/src/graph_iterator_proto.hpp +++ b/src/frontends/tensorflow/src/graph_iterator_proto.hpp @@ -5,6 +5,9 @@ #pragma once #include +#if defined(__MINGW32__) || defined(__MINGW64__) +# include +#endif #include #include "checkpoint_v1_reader.hpp" @@ -108,7 +111,11 @@ class GraphIteratorProto : public GraphIterator { : m_graph_def(std::make_shared<::tensorflow::GraphDef>()), m_func_def(nullptr), m_checkpoint_v1_reader(nullptr) { +#if defined(__MINGW32__) || defined(__MINGW64__) + std::ifstream pb_stream(std::filesystem::path(model_path), std::ios::in | std::ifstream::binary); +#else std::ifstream pb_stream(model_path, std::ios::in | std::ifstream::binary); +#endif FRONT_END_GENERAL_CHECK(pb_stream && pb_stream.is_open(), "Model file does not exist"); FRONT_END_GENERAL_CHECK(m_graph_def->ParseFromIstream(&pb_stream), "Model cannot be parsed"); @@ -135,7 +142,11 @@ class GraphIteratorProto : public GraphIterator { template static bool is_supported(const std::basic_string& path) { try { +#if defined(__MINGW32__) || defined(__MINGW64__) + std::ifstream pb_stream(std::filesystem::path(path), std::ios::in | std::ifstream::binary); +#else std::ifstream pb_stream(path, std::ios::in | std::ifstream::binary); +#endif auto graph_def = std::make_shared<::tensorflow::GraphDef>(); return pb_stream && pb_stream.is_open() && graph_def->ParsePartialFromIstream(&pb_stream) && graph_def->node_size() > 0; diff --git a/src/frontends/tensorflow/src/graph_iterator_proto_txt.hpp b/src/frontends/tensorflow/src/graph_iterator_proto_txt.hpp index 6d5b6494f764c5..82a4eee5b5b0ab 100644 --- a/src/frontends/tensorflow/src/graph_iterator_proto_txt.hpp +++ b/src/frontends/tensorflow/src/graph_iterator_proto_txt.hpp @@ -5,6 +5,9 @@ #pragma once #include +#if defined(__MINGW32__) || defined(__MINGW64__) +# include +#endif #include "google/protobuf/io/zero_copy_stream_impl.h" #include "google/protobuf/text_format.h" @@ -20,7 +23,11 @@ class GraphIteratorProtoTxt : public GraphIteratorProto { /// \brief Construct GraphIterator for the frozen model in text format without v1 checkpoints template GraphIteratorProtoTxt(const std::basic_string& path) : GraphIteratorProto() { +#if defined(__MINGW32__) || defined(__MINGW64__) + std::ifstream pbtxt_stream(std::filesystem::path(path), std::ios::in); +#else std::ifstream pbtxt_stream(path, std::ios::in); +#endif FRONT_END_GENERAL_CHECK(pbtxt_stream && pbtxt_stream.is_open(), "Model file does not exist"); auto input_stream = std::make_shared<::google::protobuf::io::IstreamInputStream>(&pbtxt_stream); FRONT_END_GENERAL_CHECK(input_stream, "Model cannot be read"); diff --git a/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp b/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp index b3e0168f28e98f..c054450fad0acf 100644 --- a/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp +++ b/src/frontends/tensorflow_lite/src/graph_iterator_flatbuffer.hpp @@ -5,6 +5,9 @@ #pragma once #include +#if defined(__MINGW32__) || defined(__MINGW64__) +# include +#endif #include "openvino/core/any.hpp" #include "openvino/frontend/exception.hpp" @@ -64,7 +67,11 @@ class GraphIteratorFlatBuffer { if (file_size < offset_size) { return false; } +#if defined(__MINGW32__) || defined(__MINGW64__) + std::ifstream tflite_stream(std::filesystem::path(path), std::ios::in | std::ifstream::binary); +#else std::ifstream tflite_stream(path, std::ios::in | std::ifstream::binary); +#endif char buf[offset_size * 2] = {}; tflite_stream.read(buf, offset_size * 2); // If we have enough readed bytes - try to detect prefixed identifier, else try without size prefix