Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated samples compile options #6818

Merged
merged 7 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/developer_package/IEDevScriptsConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Enable CMAKE_<LANG>_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

Expand Down
26 changes: 7 additions & 19 deletions inference-engine/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
ilyachur marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand All @@ -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()
####################################

Expand Down
4 changes: 2 additions & 2 deletions ngraph/core/include/ngraph/op/constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ namespace ngraph
{
const uint8_t i4data =
(get_data_ptr<uint8_t>()[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;
}
Expand Down Expand Up @@ -465,7 +465,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);
}
Expand Down
23 changes: 10 additions & 13 deletions thirdparty/cnpy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
set_target_properties(cnpy PROPERTIES FOLDER thirdparty)
11 changes: 6 additions & 5 deletions thirdparty/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)