From ab99a15ab51293e85aa9af98dda2afe1935b55db Mon Sep 17 00:00:00 2001 From: y Date: Tue, 27 Jul 2021 10:18:01 +0300 Subject: [PATCH 1/4] Don't warn about obsolete cmake usage --- cmake/developer_package/IEDevScriptsConfig.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/developer_package/IEDevScriptsConfig.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake index 46423aa61c72e7..4f3a4b3037ee58 100644 --- a/cmake/developer_package/IEDevScriptsConfig.cmake +++ b/cmake/developer_package/IEDevScriptsConfig.cmake @@ -187,8 +187,8 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Enable CMAKE__COMPILER_ID AppleClang set(CMAKE_POLICY_DEFAULT_CMP0025 NEW) -set(CMAKE_WARN_DEPRECATED OFF) -set(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ON) +set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "Don't warn about obsolete cmake versions in 3rdparty") +set(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION ON CACHE BOOL "Warn about absolute paths in destination") # LTO From 1421afe3276e63c7537c412b211dae17acab9f38 Mon Sep 17 00:00:00 2001 From: y Date: Tue, 27 Jul 2021 13:24:32 +0300 Subject: [PATCH 2/4] Removed build flags for samples --- inference-engine/samples/CMakeLists.txt | 26 +++++++------------------ 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt index c06336ec8f4e47..7036e778fcf8f3 100644 --- a/inference-engine/samples/CMakeLists.txt +++ b/inference-engine/samples/CMakeLists.txt @@ -56,40 +56,31 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER}) if (WIN32) set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS -DNOMINMAX") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") #no asynchronous structured exception handling + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") # no asynchronous structured exception handling set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") if (TREAT_WARNING_AS_ERROR) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") #treating warnings as errors + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") # treating warnings as errors endif () if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qdiag-disable:177") endif() + # disable some noisy warnings if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4275 /wd4267 /wd4819") #disable some warnings + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4275 /wd4267 /wd4819") endif() else() + # treating warnings as errors if(TREAT_WARNING_AS_ERROR) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") #treating warnings as errors + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable:177") endif() - - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - if (APPLE) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-command-line-argument") - elseif(UNIX) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self") - if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmaybe-uninitialized") - endif() - endif() endif() if(APPLE) @@ -108,9 +99,6 @@ if(NOT DEFINED CMAKE_CXX_STANDARD) set (CMAKE_CXX_STANDARD 11) set (CMAKE_CXX_EXTENSIONS OFF) set (CMAKE_CXX_STANDARD_REQUIRED ON) - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") - endif() endif() #################################### From ff04c5dd859996f48218f6074428d5204396bd3d Mon Sep 17 00:00:00 2001 From: y Date: Tue, 27 Jul 2021 13:30:13 +0300 Subject: [PATCH 3/4] Fixed ngraph with -Wpedantic --- ngraph/core/include/ngraph/op/constant.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ngraph/core/include/ngraph/op/constant.hpp b/ngraph/core/include/ngraph/op/constant.hpp index ce75a6744526dc..8b6c50908293cc 100644 --- a/ngraph/core/include/ngraph/op/constant.hpp +++ b/ngraph/core/include/ngraph/op/constant.hpp @@ -377,7 +377,7 @@ namespace ngraph { const uint8_t i4data = (get_data_ptr()[index / 2] >> (index % 2 ? 0 : 4)) & 0x0F; - const bool is_negative_number = (i4data >> 3) & 0b1; + const bool is_negative_number = (i4data >> 3) & 0x01; const int8_t data = is_negative_number ? i4data | 0xF0 : i4data; return data; } @@ -463,7 +463,7 @@ namespace ngraph for (const auto i : {4, 0}) { const uint8_t i4data = (c >> i) & 0x0F; - const bool is_negative_number = (i4data >> 3) & 0b1; + const bool is_negative_number = (i4data >> 3) & 0x01; const int8_t data = is_negative_number ? i4data | 0xF0 : i4data; output.push_back(data); } From bdabbfe18f9c76a2092a7ed0dca16616ec146e70 Mon Sep 17 00:00:00 2001 From: y Date: Tue, 27 Jul 2021 13:49:37 +0300 Subject: [PATCH 4/4] cmake for 3rdparty --- thirdparty/cnpy/CMakeLists.txt | 23 ++++++++++------------- thirdparty/zlib/CMakeLists.txt | 11 ++++++----- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/thirdparty/cnpy/CMakeLists.txt b/thirdparty/cnpy/CMakeLists.txt index 5571cd5f7857c7..28c4caee429ef0 100644 --- a/thirdparty/cnpy/CMakeLists.txt +++ b/thirdparty/cnpy/CMakeLists.txt @@ -1,21 +1,18 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR) -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# -project(CNPY) +project(cnpy) set(TARGET_NAME "cnpy") -add_library(cnpy STATIC "cnpy.cpp") +add_library(cnpy STATIC cnpy.cpp) -if(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-all") - target_compile_options(${TARGET_NAME} PUBLIC -Wno-unused-variable) +if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(${TARGET_NAME} PUBLIC -Wno-unused-variable + PRIVATE -Wno-all) endif() target_link_libraries(${TARGET_NAME} PUBLIC zlib) -target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/..") +target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -set_target_properties(cnpy PROPERTIES FOLDER thirdparty) \ No newline at end of file +set_target_properties(cnpy PROPERTIES FOLDER thirdparty) diff --git a/thirdparty/zlib/CMakeLists.txt b/thirdparty/zlib/CMakeLists.txt index 20576c3cc2f4ef..d887e2756119a2 100644 --- a/thirdparty/zlib/CMakeLists.txt +++ b/thirdparty/zlib/CMakeLists.txt @@ -2,14 +2,16 @@ # SPDX-License-Identifier: Apache-2.0 # -if(NOT WIN32) +project(zlib) + +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /W3") +else() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-all") if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") #266: function "XXX" declared implicitly set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -diag-disable=266") endif() -elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /W3") endif() set(TARGET_NAME "zlib") @@ -47,7 +49,6 @@ set(lib_hdrs set(lib_ext_hdrs "zlib/zlib.h" "zlib/zconf.h") add_library(${TARGET_NAME} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs}) -target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/zlib" - "${CMAKE_CURRENT_SOURCE_DIR}/zlib/..") +target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/zlib") set_target_properties(zlib PROPERTIES FOLDER thirdparty)