From 2a344b66cbdc58753aa85a36c8d26f9508b7f06e Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Tue, 25 Oct 2022 18:11:46 +0400 Subject: [PATCH] Update to the latest cmake for Windows (#13604) * Update to the latest cmake for Windows * Skip new warnings * Added compiler flags for old cmake * Disabled some warnings * Suppress new warnings * Fixed some errors * Disable some warning for lpt * Fix some warnings * Disable new warnings * Fix some warnings * Disabled Was error for arm * Fixed some errors * Fixed some new warnings * Fixed auto plugin * Fixed Windows warning * Fixed Windows * Disable some warnings * Some changes * Small test fixes * Fixed python build * Added skip warnings for legacy python API --- .ci/azure/linux_arm64.yml | 2 +- .ci/azure/windows.yml | 2 +- cmake/developer_package/compile_flags/os_flags.cmake | 8 ++++++++ src/bindings/c/src/CMakeLists.txt | 4 ++++ .../python/src/compatibility/pyngraph/CMakeLists.txt | 1 + src/bindings/python/src/pyopenvino/CMakeLists.txt | 1 + src/common/low_precision_transformations/CMakeLists.txt | 4 ++++ src/common/offline_transformations/CMakeLists.txt | 5 +++++ src/common/transformations/CMakeLists.txt | 7 +++++++ src/core/CMakeLists.txt | 8 ++++++++ src/core/reference/CMakeLists.txt | 4 ++++ .../reference/src/runtime/reference/generate_proposal.cpp | 4 ++-- src/core/reference/src/runtime/reference/irdft.cpp | 2 +- .../reference/src/runtime/reference/multiclass_nms.cpp | 2 +- src/core/shape_inference/CMakeLists.txt | 4 ++++ .../include/convolution_shape_inference.hpp | 4 ++-- .../shape_inference/include/irdft_shape_inference.hpp | 2 +- src/core/shape_inference/include/rdft_shape_inference.hpp | 2 +- .../shape_inference/include/rfft_common_validation.hpp | 4 ++-- .../include/strided_slice_shape_inference.hpp | 4 ++-- src/core/src/dimension.cpp | 4 ++-- src/frontends/onnx/frontend/CMakeLists.txt | 6 ++++++ src/frontends/onnx/tests/CMakeLists.txt | 6 ++++++ src/frontends/paddle/src/CMakeLists.txt | 3 +++ src/frontends/tensorflow/src/CMakeLists.txt | 6 ++++++ src/frontends/tensorflow/src/input_model.cpp | 2 +- src/inference/src/ie_core.cpp | 2 +- src/plugins/auto/CMakeLists.txt | 5 +++++ src/plugins/intel_cpu/CMakeLists.txt | 1 + src/plugins/intel_cpu/tests/unit/CMakeLists.txt | 4 ++++ src/plugins/intel_gna/CMakeLists.txt | 2 ++ src/plugins/intel_gpu/src/graph/layout_optimizer.cpp | 2 +- src/plugins/template/backend/CMakeLists.txt | 6 ++++++ .../ie_test_utils/common_test_utils/graph_comparator.cpp | 2 +- 34 files changed, 105 insertions(+), 20 deletions(-) diff --git a/.ci/azure/linux_arm64.yml b/.ci/azure/linux_arm64.yml index 82610104cb6..992bfa0918b 100644 --- a/.ci/azure/linux_arm64.yml +++ b/.ci/azure/linux_arm64.yml @@ -156,7 +156,7 @@ jobs: cmakeArgs: > -GNinja -DCMAKE_VERBOSE_MAKEFILE=ON - -DCMAKE_COMPILE_WARNING_AS_ERROR=ON + -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF -DOpenCV_DIR=$(INSTALL_OPENCV)/cmake -DPYTHON_INCLUDE_DIRS=$(INSTALL_PYTHON)/include/python3.8 -DPYTHON_LIBRARY=$(INSTALL_PYTHON)/lib/libpython3.8.so diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index 76d0b73d63b..81d4e0c8fa4 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -74,7 +74,7 @@ jobs: IB_DIR: C:\Program Files (x86)\IncrediBuild IB_TESTCONSOLE: $(IB_DIR)\IBTestConsole.exe PYTHON_DIR: C:\hostedtoolcache\windows\Python\3.7.6\x64 - CMAKE_VERSION: 3.21.0 + CMAKE_VERSION: 3.24.0 CMAKE_CMD: $(WORK_DIR)\cmake-$(CMAKE_VERSION)-windows-x86_64\cmake-$(CMAKE_VERSION)-windows-x86_64\bin\cmake.exe OV_CMAKE_TOOLCHAIN_FILE: $(REPO_DIR)\cmake\toolchains\mt.runtime.win32.toolchain.cmake diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake index 30db2b9b27d..a92a8f9c371 100644 --- a/cmake/developer_package/compile_flags/os_flags.cmake +++ b/cmake/developer_package/compile_flags/os_flags.cmake @@ -265,6 +265,9 @@ if(WIN32) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") if (CMAKE_COMPILE_WARNING_AS_ERROR) + if (CMAKE_VERSION VERSION_LESS 3.24) + ie_add_compiler_flags(/WX) + endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") ie_add_compiler_flags(/Qdiag-warning:47,1740,1786) endif() @@ -307,6 +310,11 @@ if(WIN32) string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") else() + if (CMAKE_COMPILE_WARNING_AS_ERROR AND CMAKE_VERSION VERSION_LESS 3.24) + # TODO: enable for C sources as well + # ie_add_compiler_flags(-Werror) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") + endif() ie_add_compiler_flags(-ffunction-sections -fdata-sections) ie_add_compiler_flags(-fdiagnostics-show-option) ie_add_compiler_flags(-Wundef) diff --git a/src/bindings/c/src/CMakeLists.txt b/src/bindings/c/src/CMakeLists.txt index 27683cf05ac..183e7fdac1e 100644 --- a/src/bindings/c/src/CMakeLists.txt +++ b/src/bindings/c/src/CMakeLists.txt @@ -4,6 +4,10 @@ set(TARGET_NAME openvino_c) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4267) +endif() + file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) file(GLOB HEADERS ${OpenVINO_C_API_SOURCE_DIR}/include/*) diff --git a/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt b/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt index aa871b8c635..a47861df7ae 100644 --- a/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt +++ b/src/bindings/python/src/compatibility/pyngraph/CMakeLists.txt @@ -34,6 +34,7 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # disable warning: This operator was deprecated and will be removed with v0 operation. add_compile_options(/wd4996) + add_compile_options(/wd4244) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") add_compile_options(-Wno-deprecated-register -Wno-range-loop-analysis) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") diff --git a/src/bindings/python/src/pyopenvino/CMakeLists.txt b/src/bindings/python/src/pyopenvino/CMakeLists.txt index e3a09545fcd..7fe7a3495aa 100644 --- a/src/bindings/python/src/pyopenvino/CMakeLists.txt +++ b/src/bindings/python/src/pyopenvino/CMakeLists.txt @@ -29,6 +29,7 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # disable warning: This operator was deprecated and will be removed with v0 operation. add_compile_options(/wd4996) + add_compile_options(/wd4244) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") add_compile_options(-Wno-deprecated-register -Wno-range-loop-analysis) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") diff --git a/src/common/low_precision_transformations/CMakeLists.txt b/src/common/low_precision_transformations/CMakeLists.txt index 79390ab6be3..9ca78963d61 100644 --- a/src/common/low_precision_transformations/CMakeLists.txt +++ b/src/common/low_precision_transformations/CMakeLists.txt @@ -4,6 +4,10 @@ set (TARGET_NAME "inference_engine_lp_transformations") +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4267) +endif() + set(PUBLIC_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) diff --git a/src/common/offline_transformations/CMakeLists.txt b/src/common/offline_transformations/CMakeLists.txt index aec7f320d30..9fe1badd469 100644 --- a/src/common/offline_transformations/CMakeLists.txt +++ b/src/common/offline_transformations/CMakeLists.txt @@ -4,6 +4,11 @@ set(TARGET_NAME "offline_transformations") +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4244) + ie_add_compiler_flags(/wd4267) +endif() + file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) diff --git a/src/common/transformations/CMakeLists.txt b/src/common/transformations/CMakeLists.txt index a4ca3e8c271..3043bffade3 100644 --- a/src/common/transformations/CMakeLists.txt +++ b/src/common/transformations/CMakeLists.txt @@ -9,6 +9,13 @@ file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) set(PUBLIC_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4018) + ie_add_compiler_flags(/wd4305) + ie_add_compiler_flags(/wd4267) +endif() + + # Create named folders for the sources within the .vcproj # Empty name lists them directly under the .vcproj diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b888b584d33..22840f49b4d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -30,6 +30,10 @@ set_property(SOURCE ${MIXED_SRC} $/src $) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4244) +endif() # Create named folders for the sources within the .vcproj # Empty name lists them directly under the .vcproj @@ -101,6 +105,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") endif() target_link_options(ngraph_obj ${link_type} "/IGNORE:4217,4286") + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") +ie_add_compiler_flags(/wd4267) +endif() endif() # some sources are located in ngraph, while headers are in inference_engine_transformations diff --git a/src/core/reference/CMakeLists.txt b/src/core/reference/CMakeLists.txt index b2017bdc5c5..e2cd32c624b 100644 --- a/src/core/reference/CMakeLists.txt +++ b/src/core/reference/CMakeLists.txt @@ -4,6 +4,10 @@ set(TARGET_NAME "ngraph_reference") +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4267) +endif() + file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) diff --git a/src/core/reference/src/runtime/reference/generate_proposal.cpp b/src/core/reference/src/runtime/reference/generate_proposal.cpp index e239b85907e..069b2cebc2b 100644 --- a/src/core/reference/src/runtime/reference/generate_proposal.cpp +++ b/src/core/reference/src/runtime/reference/generate_proposal.cpp @@ -97,7 +97,7 @@ static void generate_proposal_refine_anchors(const std::vector& deltas, proposals[p_idx + 2] = x1; proposals[p_idx + 3] = y1; proposals[p_idx + 4] = score; - proposals[p_idx + 5] = (min_box_W <= box_w) * (min_box_H <= box_h) * 1.0; + proposals[p_idx + 5] = (min_box_W <= box_w) * (min_box_H <= box_h) * 1.0f; // update index for next anchor iter a_idx += 4; // anchors shape is [bottom_H, bottom_W, anchors_num, 4], so add 4 for next anchor iter @@ -261,7 +261,7 @@ static void generate_proposals_single_image(const std::vector& im_info, const int64_t pre_nms_topn = std::min(num_proposals, attrs.pre_nms_count); // bbox normalized flag - const float coordinates_offset = attrs.normalized ? 0 : 1.0; + const float coordinates_offset = attrs.normalized ? 0.f : 1.f; std::vector proposals(num_proposals); std::vector unpacked_boxes(5 * pre_nms_topn); diff --git a/src/core/reference/src/runtime/reference/irdft.cpp b/src/core/reference/src/runtime/reference/irdft.cpp index aeab45876b5..10b70d3afa3 100644 --- a/src/core/reference/src/runtime/reference/irdft.cpp +++ b/src/core/reference/src/runtime/reference/irdft.cpp @@ -26,7 +26,7 @@ using complex_type = std::complex; // Remove element (dimension from shape or value from stride) on the given position template std::vector remove_from_position(const std::vector& vec, const int64_t pos) { - assert(vec.size() > pos); + assert(vec.size() > static_cast(pos)); auto result = vec; result.erase(std::begin(result) + pos); return result; diff --git a/src/core/reference/src/runtime/reference/multiclass_nms.cpp b/src/core/reference/src/runtime/reference/multiclass_nms.cpp index e08cffbb00f..4ad7343d030 100644 --- a/src/core/reference/src/runtime/reference/multiclass_nms.cpp +++ b/src/core/reference/src/runtime/reference/multiclass_nms.cpp @@ -211,7 +211,7 @@ std::vector slice_image(const T* data, const Shape& data_shape, const int64_t const auto item_size = (data_shape.size() == 3) ? data_shape[2] : 1; // start and end should within [0, M) - OPENVINO_ASSERT(start >= 0 && (start + item_num) <= data_shape[1], + OPENVINO_ASSERT(start >= 0 && (start + item_num) <= static_cast(data_shape[1]), "Invaid inputs as it is trying to slice data out of range."); const auto row_num = item_num * item_size; diff --git a/src/core/shape_inference/CMakeLists.txt b/src/core/shape_inference/CMakeLists.txt index 009c5116a0b..2cf19f37859 100644 --- a/src/core/shape_inference/CMakeLists.txt +++ b/src/core/shape_inference/CMakeLists.txt @@ -4,6 +4,10 @@ set(TARGET_NAME "ov_shape_inference") +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4018) +endif() + file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) diff --git a/src/core/shape_inference/include/convolution_shape_inference.hpp b/src/core/shape_inference/include/convolution_shape_inference.hpp index 9b7103ab2a6..6b4fe4076b6 100644 --- a/src/core/shape_inference/include/convolution_shape_inference.hpp +++ b/src/core/shape_inference/include/convolution_shape_inference.hpp @@ -207,8 +207,8 @@ void divide_ceil(const DimType& dividend, const typename DimType::value_type& di if (dividend.get_max_length() == -1) { quotient = -1; } else { - auto lb = ceil(1. * dividend.get_min_length() / divisor); - auto ub = ceil(1. * dividend.get_max_length() / divisor); + auto lb = static_cast(ceil(1. * dividend.get_min_length() / divisor)); + auto ub = static_cast(ceil(1. * dividend.get_max_length() / divisor)); quotient = DimType(lb, ub); } } diff --git a/src/core/shape_inference/include/irdft_shape_inference.hpp b/src/core/shape_inference/include/irdft_shape_inference.hpp index e0eea752961..40d50d5323f 100644 --- a/src/core/shape_inference/include/irdft_shape_inference.hpp +++ b/src/core/shape_inference/include/irdft_shape_inference.hpp @@ -42,7 +42,7 @@ void irdft_shape_infer(const ov::op::v9::IRDFT* op, output_shape.resize(input_rank - 1); if (axes_shape.rank().is_dynamic() || !axes_are_known) { - for (int64_t i = 0; i < input_rank - 1; ++i) { + for (size_t i = 0; i < input_rank - 1; ++i) { output_shape[i] = ov::Dimension::dynamic(); } return; diff --git a/src/core/shape_inference/include/rdft_shape_inference.hpp b/src/core/shape_inference/include/rdft_shape_inference.hpp index 0fd3ff3ad7f..174f77fbed0 100644 --- a/src/core/shape_inference/include/rdft_shape_inference.hpp +++ b/src/core/shape_inference/include/rdft_shape_inference.hpp @@ -55,7 +55,7 @@ void rdft_shape_infer(const ov::op::v9::RDFT* op, const auto input_rank = input_shape.size(); if (axes_shape.rank().is_dynamic() || !axes_are_known) { - for (int64_t i = 0; i < input_rank; ++i) { + for (size_t i = 0; i < input_rank; ++i) { output_shape[i] = ov::Dimension::dynamic(); } return; diff --git a/src/core/shape_inference/include/rfft_common_validation.hpp b/src/core/shape_inference/include/rfft_common_validation.hpp index ac3cdcd4499..ea9af1178dc 100644 --- a/src/core/shape_inference/include/rfft_common_validation.hpp +++ b/src/core/shape_inference/include/rfft_common_validation.hpp @@ -39,7 +39,7 @@ void validate_input_rank(const ov::op::util::FFTBase* op, if (rfft_kind == RFFTKind::Forward) { NODE_VALIDATION_CHECK(op, - input_rank >= static_cast(axes_shape[0].get_length()), + input_rank >= static_cast(axes_shape[0].get_length()), "The input rank must be greater than or equal to the number of RDFT op axes. " "Got input rank: ", input_rank, @@ -47,7 +47,7 @@ void validate_input_rank(const ov::op::util::FFTBase* op, axes_shape[0].get_length()); } else { NODE_VALIDATION_CHECK(op, - input_rank >= static_cast(axes_shape[0].get_length() + 1), + input_rank >= static_cast(axes_shape[0].get_length() + 1), "The input rank must be greater than number of IRDFT op axes. Got " "input rank: ", input_rank, diff --git a/src/core/shape_inference/include/strided_slice_shape_inference.hpp b/src/core/shape_inference/include/strided_slice_shape_inference.hpp index 53fa22ae079..9dc8fafe21a 100644 --- a/src/core/shape_inference/include/strided_slice_shape_inference.hpp +++ b/src/core/shape_inference/include/strided_slice_shape_inference.hpp @@ -132,7 +132,7 @@ void shape_infer(const StridedSlice* op, // only one bit in ellipsis mask is allowed int num_new_axis_after_ellipses = 0; int num_input_axis_before_ellipses = 0; - for (size_t i = 0; i < axis; ++i) { + for (int64_t i = 0; i < axis; ++i) { if (!new_axis_mask.count(i)) { num_input_axis_before_ellipses++; } @@ -165,7 +165,7 @@ void shape_infer(const StridedSlice* op, const int64_t ub0 = end[axis]; // set default value for stride or use given value int64_t stride = 1; - if (strides.size() > axis) { + if (strides.size() > static_cast(axis)) { stride = strides[axis]; } NODE_VALIDATION_CHECK(op, stride != 0, "Stride must be non-zero"); diff --git a/src/core/src/dimension.cpp b/src/core/src/dimension.cpp index e729c7f7f58..28e0e852797 100644 --- a/src/core/src/dimension.cpp +++ b/src/core/src/dimension.cpp @@ -86,8 +86,8 @@ Dimension Dimension::operator/(const value_type divisor) const { return *this; if (m_dimension.get_max_val() == Interval::s_max && m_dimension.get_min_val() == 0) return Dimension::dynamic(); - const auto& lower_bound = ceil(static_cast(m_dimension.get_min_val()) / divisor); - const auto& upper_bound = floor(static_cast(m_dimension.get_max_val()) / divisor); + const auto& lower_bound = static_cast(ceil(static_cast(m_dimension.get_min_val()) / divisor)); + const auto& upper_bound = static_cast(floor(static_cast(m_dimension.get_max_val()) / divisor)); return Dimension(lower_bound, upper_bound); } diff --git a/src/frontends/onnx/frontend/CMakeLists.txt b/src/frontends/onnx/frontend/CMakeLists.txt index 38aa903a8d5..7bc1cd769b4 100644 --- a/src/frontends/onnx/frontend/CMakeLists.txt +++ b/src/frontends/onnx/frontend/CMakeLists.txt @@ -2,6 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 # +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4267) + ie_add_compiler_flags(/wd4018) + ie_add_compiler_flags(/wd4244) +endif() + ov_add_frontend(NAME onnx LINKABLE_FRONTEND PROTOBUF_LITE diff --git a/src/frontends/onnx/tests/CMakeLists.txt b/src/frontends/onnx/tests/CMakeLists.txt index 4ee08788447..830475a8248 100644 --- a/src/frontends/onnx/tests/CMakeLists.txt +++ b/src/frontends/onnx/tests/CMakeLists.txt @@ -10,6 +10,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT ENABLE_SANITIZER) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4244) + ie_add_compiler_flags(/wd4267) +endif() + + message(STATUS "ONNX frontend test enabled") add_compile_definitions( diff --git a/src/frontends/paddle/src/CMakeLists.txt b/src/frontends/paddle/src/CMakeLists.txt index 93bdd48e997..ac8eb89cf09 100644 --- a/src/frontends/paddle/src/CMakeLists.txt +++ b/src/frontends/paddle/src/CMakeLists.txt @@ -2,6 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 # +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4305) +endif() ov_add_frontend(NAME paddle LINKABLE_FRONTEND PROTOBUF_LITE diff --git a/src/frontends/tensorflow/src/CMakeLists.txt b/src/frontends/tensorflow/src/CMakeLists.txt index 3ab88fabaf4..dfa37723f51 100644 --- a/src/frontends/tensorflow/src/CMakeLists.txt +++ b/src/frontends/tensorflow/src/CMakeLists.txt @@ -2,6 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 # +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4244) + ie_add_compiler_flags(/wd4018) + ie_add_compiler_flags(/wd4267) +endif() + if(NOT CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW)$") set(linkable_frontend LINKABLE_FRONTEND) endif() diff --git a/src/frontends/tensorflow/src/input_model.cpp b/src/frontends/tensorflow/src/input_model.cpp index 8a491f1cddd..cacddc55fb6 100644 --- a/src/frontends/tensorflow/src/input_model.cpp +++ b/src/frontends/tensorflow/src/input_model.cpp @@ -200,7 +200,7 @@ std::vector> InputModel::InputModelTFImpl::determine_cu size_t producer_output_port_idx; try { current_operation_decoder->get_input_node(input_port_idx, producer_name, producer_output_port_idx); - } catch (const std::exception& e) { + } catch (const std::exception&) { FRONT_END_THROW("[ ERROR ] Exception happened when preparing input " + std::to_string(input_port_idx) + " for op '" + current_operation_decoder->get_op_name() + "', expected input name: '" + diff --git a/src/inference/src/ie_core.cpp b/src/inference/src/ie_core.cpp index 51b3511b152..1a052496264 100644 --- a/src/inference/src/ie_core.cpp +++ b/src/inference/src/ie_core.cpp @@ -227,7 +227,7 @@ class CoreImpl : public ie::ICore, public std::enable_shared_from_this lock(global_mutex); try { return dev_mutexes.at(dev_name); - } catch (const std::out_of_range& ex) { + } catch (const std::out_of_range&) { throw ov::Exception("Cannot get mutex for device: " + dev_name); } } diff --git a/src/plugins/auto/CMakeLists.txt b/src/plugins/auto/CMakeLists.txt index 6cc0244efcd..92ee7be0805 100644 --- a/src/plugins/auto/CMakeLists.txt +++ b/src/plugins/auto/CMakeLists.txt @@ -5,6 +5,11 @@ if(NOT ENABLE_AUTO AND NOT ENABLE_MULTI) return() endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4101) + ie_add_compiler_flags(/wd4267) +endif() + set (TARGET_NAME "openvino_auto_plugin") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/utils/*.cpp) diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index 1ae46735536..f0248610178 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -22,6 +22,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ie_add_compiler_flags(/wd4250) # '<': signed/unsigned mismatch ie_add_compiler_flags(/wd4018) + ie_add_compiler_flags(/wd4309) endif() if (WIN32) diff --git a/src/plugins/intel_cpu/tests/unit/CMakeLists.txt b/src/plugins/intel_cpu/tests/unit/CMakeLists.txt index 4513226d654..6312abde9d1 100644 --- a/src/plugins/intel_cpu/tests/unit/CMakeLists.txt +++ b/src/plugins/intel_cpu/tests/unit/CMakeLists.txt @@ -8,6 +8,10 @@ if(BUILD_SHARED_LIBS) set (OBJ_LIB $) endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd5051) +endif() + addIeTargetTest( NAME ${TARGET_NAME} ROOT ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/plugins/intel_gna/CMakeLists.txt b/src/plugins/intel_gna/CMakeLists.txt index 3a313f75a7d..039699fe3f7 100644 --- a/src/plugins/intel_gna/CMakeLists.txt +++ b/src/plugins/intel_gna/CMakeLists.txt @@ -18,6 +18,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ie_add_compiler_flags(/wd4244) # '<': signed/unsigned mismatch ie_add_compiler_flags(/wd4018) + ie_add_compiler_flags(/wd4099) + ie_add_compiler_flags(/wd4200) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") diff --git a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp index b1545cfe3b3..51ee7f48212 100644 --- a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp +++ b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp @@ -1763,7 +1763,7 @@ void layout_optimizer::select_preferred_formats_for_onednn(program_node& node, d // Conv or deconv gets a preferred format for its data input based on source memory description // But an input format for fused post-ops should be same with an output format of conv/deconv - size_t prim_input; + size_t prim_input(0); if (node.is_type()) prim_input = node.get_dependency_index(node.as().input()); if (node.is_type()) diff --git a/src/plugins/template/backend/CMakeLists.txt b/src/plugins/template/backend/CMakeLists.txt index dc9bdad0482..479ae8a9516 100644 --- a/src/plugins/template/backend/CMakeLists.txt +++ b/src/plugins/template/backend/CMakeLists.txt @@ -17,6 +17,12 @@ set (SRC int_backend.cpp int_executable.cpp evaluates_map.cpp ) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + ie_add_compiler_flags(/wd4244) + ie_add_compiler_flags(/wd4018) +endif() + + add_library(interpreter_backend STATIC EXCLUDE_FROM_ALL ${SRC}) add_library(openvino::interpreter_backend ALIAS interpreter_backend) diff --git a/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp b/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp index 472cb24dbf6..38bcf192d9c 100644 --- a/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp +++ b/src/tests/ie_test_utils/common_test_utils/graph_comparator.cpp @@ -68,7 +68,7 @@ bool compare_rt_keys(const T& node1, const T& node2, std::ostream& err_log) { err_log << "Values for " << key << " key are not equal.\n"; return false; } - } catch (ov::Exception& e) { + } catch (const ov::Exception&) { // Handle cases wen equality operator is not defined for some rt attribute } }