Put mingw on gcc code path (#16101)

* Supported mingw-w64

* Supported mingw-w64

* Supported mingw-w64
This commit is contained in:
Ilya Lavrenov 2023-05-17 00:47:55 +04:00 committed by GitHub
parent 87a39fb007
commit 04171416f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
112 changed files with 684 additions and 553 deletions

View File

@ -40,8 +40,6 @@ endif()
# resolving dependencies for the project
message (STATUS "CMAKE_VERSION ......................... " ${CMAKE_VERSION})
message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
message (STATUS "CMAKE_SOURCE_DIR ...................... " ${CMAKE_SOURCE_DIR})
message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR})
message (STATUS "OpenVINO_BINARY_DIR ................... " ${OpenVINO_BINARY_DIR})
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
@ -66,7 +64,7 @@ endif()
if(CMAKE_TOOLCHAIN_FILE)
message (STATUS "CMAKE_TOOLCHAIN_FILE .................. " ${CMAKE_TOOLCHAIN_FILE})
endif()
if(OV_GLIBC_VERSION)
if(NOT OV_GLIBC_VERSION VERSION_EQUAL 0.0)
message (STATUS "GLIBC_VERSION ......................... " ${OV_GLIBC_VERSION})
endif()

View File

@ -4,23 +4,28 @@
if(WIN32)
set(PROGRAMFILES_ENV "ProgramFiles(X86)")
file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)
set(WDK_PATHS "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64"
"${PROGRAMFILES}/Windows Kits/10/bin/x64")
# check that PROGRAMFILES_ENV is defined, because in case of cross-compilation for Windows
# we don't have such variable
if(DEFINED ENV{PROGRAMFILES_ENV})
file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)
message(STATUS "Trying to find apivalidator in: ")
foreach(wdk_path IN LISTS WDK_PATHS)
message(" * ${wdk_path}")
endforeach()
set(WDK_PATHS "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64"
"${PROGRAMFILES}/Windows Kits/10/bin/x64")
find_host_program(ONECORE_API_VALIDATOR
NAMES apivalidator
PATHS ${WDK_PATHS}
DOC "ApiValidator for OneCore compliance")
message(STATUS "Trying to find apivalidator in: ")
foreach(wdk_path IN LISTS WDK_PATHS)
message(" * ${wdk_path}")
endforeach()
if(ONECORE_API_VALIDATOR)
message(STATUS "Found apivalidator: ${ONECORE_API_VALIDATOR}")
find_host_program(ONECORE_API_VALIDATOR
NAMES apivalidator
PATHS ${WDK_PATHS}
DOC "ApiValidator for OneCore compliance")
if(ONECORE_API_VALIDATOR)
message(STATUS "Found apivalidator: ${ONECORE_API_VALIDATOR}")
endif()
endif()
endif()

View File

@ -4,8 +4,13 @@
macro(enable_fuzzing)
# Enable (libFuzzer)[https://llvm.org/docs/LibFuzzer.html] if supported.
set(FUZZING_COMPILER_FLAGS "-fsanitize=fuzzer-no-link -fprofile-instr-generate -fcoverage-mapping")
set(FUZZING_LINKER_FLAGS "-fsanitize-coverage=trace-pc-guard -fprofile-instr-generate")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# see https://learn.microsoft.com/en-us/cpp/build/reference/fsanitize?view=msvc-160#remarks
set(FUZZING_COMPILER_FLAGS "/fsanitize=fuzzer")
elseif(OV_COMPILER_IS_CLANG)
set(FUZZING_COMPILER_FLAGS "-fsanitize=fuzzer-no-link -fprofile-instr-generate -fcoverage-mapping")
set(FUZZING_LINKER_FLAGS "-fsanitize-coverage=trace-pc-guard -fprofile-instr-generate")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FUZZING_COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FUZZING_COMPILER_FLAGS}")
@ -20,6 +25,10 @@ function(add_fuzzer FUZZER_EXE_NAME FUZZER_SOURCES)
add_executable(${FUZZER_EXE_NAME} ${FUZZER_SOURCES})
target_link_libraries(${FUZZER_EXE_NAME} PRIVATE fuzz-testhelper)
if(ENABLE_FUZZING)
set_target_properties(${FUZZER_EXE_NAME} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# no extra flags are required
elseif(OV_COMPILER_IS_CLANG)
set_target_properties(${FUZZER_EXE_NAME} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
endif()
endif()
endfunction(add_fuzzer)

View File

@ -12,23 +12,17 @@ include(CheckCXXCompilerFlag)
# Defines ie_c_cxx_deprecated varaible which contains C / C++ compiler flags
#
macro(ov_disable_deprecated_warnings)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(ie_c_cxx_deprecated "/wd4996")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(ie_c_cxx_deprecated "/Qdiag-disable:1478,1786")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(ie_c_cxx_deprecated "/wd4996")
elseif(OV_COMPILER_IS_CLANG)
set(ie_c_cxx_deprecated "-Wno-deprecated-declarations")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
else()
set(ie_c_cxx_deprecated "-diag-disable=1478,1786")
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated "-Wno-deprecated-declarations")
endif()
endif()
if(NOT ie_c_cxx_deprecated)
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated "-Wno-deprecated-declarations")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
@ -49,24 +43,18 @@ endmacro()
# Defines ie_c_cxx_deprecated_no_errors varaible which contains C / C++ compiler flags
#
macro(ov_deprecated_no_errors)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# show 4996 only for /w4
set(ie_c_cxx_deprecated_no_errors "/wd4996")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(ie_c_cxx_deprecated_no_errors "/Qdiag-warning:1478,1786")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# show 4996 only for /w4
set(ie_c_cxx_deprecated_no_errors "/wd4996")
elseif(OV_COMPILER_IS_CLANG)
set(ie_c_cxx_deprecated_no_errors "-Wno-error=deprecated-declarations")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
else()
set(ie_c_cxx_deprecated_no_errors "-diag-warning=1478,1786")
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated_no_errors "-Wno-error=deprecated-declarations")
endif()
endif()
if(NOT ie_c_cxx_deprecated_no_errors)
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated_no_errors "-Wno-error=deprecated-declarations")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
@ -101,23 +89,21 @@ endmacro()
# Provides SSE4.2 compilation flags depending on an OS and a compiler
#
macro(ie_sse42_optimization_flags flags)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# No such option for MSVC 2019
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# No such option for MSVC 2019
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(${flags} /QxSSE4.2)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
set(${flags} -xSSE4.2)
endif()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(${flags} -msse4.2)
if(EMSCRIPTEN)
list(APPEND ${flags} -msimd128)
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(${flags} -xSSE4.2)
else()
set(${flags} -msse4.2)
if(EMSCRIPTEN)
list(APPEND ${flags} -msimd128)
endif()
endif()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endmacro()
@ -127,20 +113,18 @@ endmacro()
# Provides AVX2 compilation flags depending on an OS and a compiler
#
macro(ie_avx2_optimization_flags flags)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX2)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(${flags} /QxCORE-AVX2)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX2)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(${flags} -xCORE-AVX2)
else()
set(${flags} -mavx2 -mfma)
endif()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(${flags} -mavx2 -mfma)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endmacro()
@ -151,24 +135,18 @@ endmacro()
# depending on an OS and a compiler
#
macro(ie_avx512_optimization_flags flags)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX512)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(${flags} /QxCOMMON-AVX512)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX512)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(${flags} -xCOMMON-AVX512)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(${flags} -mavx512f -mfma)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$")
set(${flags} -mavx512f -mfma)
endif()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(${flags} -mavx512f -mfma)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endmacro()
@ -265,8 +243,10 @@ endfunction()
function(ov_force_include target scope header_file)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${target} ${scope} /FI"${header_file}")
else()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${target} ${scope} -include "${header_file}")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endfunction()
@ -279,7 +259,7 @@ function(ov_abi_free_target target)
# To guarantee OpenVINO can be used with gcc versions 7 through 12.2
# - https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html
# - https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW64)
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wabi=11>)
endif()
endfunction()
@ -332,11 +312,11 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
if(CMAKE_CL_64)
# Default char Type Is unsigned
# ie_add_compiler_flags(/J)
else()
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
ie_add_compiler_flags(-fsigned-char)
endif()
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
#
# Common options / warnings enabled
#
@ -349,16 +329,14 @@ if(WIN32)
# This option helps ensure the fewest possible hard-to-find code defects. Similar to -Wall on GNU / Clang
ie_add_compiler_flags(/W3)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Increase Number of Sections in .Obj file
ie_add_compiler_flags(/bigobj)
# Build with multiple processes
ie_add_compiler_flags(/MP)
# Increase Number of Sections in .Obj file
ie_add_compiler_flags(/bigobj)
# Build with multiple processes
ie_add_compiler_flags(/MP)
if(AARCH64 AND NOT MSVC_VERSION LESS 1930)
# otherwise, _ARM64_EXTENDED_INTRINSICS is defined, which defines 'mvn' macro
ie_add_compiler_flags(/D_ARM64_DISTINCT_NEON_TYPES)
endif()
if(AARCH64 AND NOT MSVC_VERSION LESS 1930)
# otherwise, _ARM64_EXTENDED_INTRINSICS is defined, which defines 'mvn' macro
ie_add_compiler_flags(/D_ARM64_DISTINCT_NEON_TYPES)
endif()
# Handle Large Addresses
@ -375,42 +353,62 @@ if(WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /WX")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /WX")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /WX")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
ie_add_compiler_flags(/Qdiag-warning:47,1740,1786)
endif()
endif()
#
# Disable noisy warnings
#
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# C4251 needs to have dll-interface to be used by clients of class
ie_add_compiler_flags(/wd4251)
# C4275 non dll-interface class used as base for dll-interface class
ie_add_compiler_flags(/wd4275)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# 161: unrecognized pragma
# 177: variable was declared but never referenced
# 556: not matched type of assigned function pointer
# 1744: field of class type without a DLL interface used in a class with a DLL interface
# 1879: unimplemented pragma ignored
# 2586: decorated name length exceeded, name was truncated
# 2651: attribute does not apply to any entity
# 3180: unrecognized OpenMP pragma
# 11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
# 15335: was not vectorized: vectorization possible but seems inefficient. Use vector always directive or /Qvec-threshold0 to override
ie_add_compiler_flags(/Qdiag-disable:161,177,556,1744,1879,2586,2651,3180,11075,15335)
endif()
# C4251 needs to have dll-interface to be used by clients of class
ie_add_compiler_flags(/wd4251)
# C4275 non dll-interface class used as base for dll-interface class
ie_add_compiler_flags(/wd4275)
#
# Debug information flags, by default CMake adds /Zi option
# but provides no way to specify CMAKE_COMPILE_PDB_NAME on root level
# In order to avoid issues with ninja we are replacing default flag instead of having two of them
# and observing warning D9025 about flag override
#
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND WIN32)
#
# Warnings as errors
#
if(CMAKE_COMPILE_WARNING_AS_ERROR AND CMAKE_VERSION VERSION_LESS 3.24)
ie_add_compiler_flags(/Qdiag-warning:47,1740,1786)
endif()
#
# Disable noisy warnings
#
# 161: unrecognized pragma
ie_add_compiler_flags(/Qdiag-disable:161)
# 177: variable was declared but never referenced
ie_add_compiler_flags(/Qdiag-disable:177)
# 556: not matched type of assigned function pointer
ie_add_compiler_flags(/Qdiag-disable:556)
# 1744: field of class type without a DLL interface used in a class with a DLL interface
ie_add_compiler_flags(/Qdiag-disable:1744)
# 1879: unimplemented pragma ignored
ie_add_compiler_flags(/Qdiag-disable:1879)
# 2586: decorated name length exceeded, name was truncated
ie_add_compiler_flags(/Qdiag-disable:2586)
# 2651: attribute does not apply to any entity
ie_add_compiler_flags(/Qdiag-disable:2651)
# 3180: unrecognized OpenMP pragma
ie_add_compiler_flags(/Qdiag-disable:3180)
# 11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
ie_add_compiler_flags(/Qdiag-disable:11075)
# 15335: was not vectorized: vectorization possible but seems inefficient.
# Use vector always directive or /Qvec-threshold0 to override
ie_add_compiler_flags(/Qdiag-disable:15335)
else()
#
# Common enabled warnings

View File

@ -5,7 +5,9 @@
include(CheckCXXCompilerFlag)
if (ENABLE_SANITIZER)
if (WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# the flag is available since MSVC 2019 16.9
# see https://learn.microsoft.com/en-us/cpp/build/reference/fsanitize?view=msvc-160
check_cxx_compiler_flag("/fsanitize=address" SANITIZE_ADDRESS_SUPPORTED)
if (SANITIZE_ADDRESS_SUPPORTED)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /fsanitize=address")
@ -14,21 +16,23 @@ if (ENABLE_SANITIZER)
"Please, check requirements:\n"
"https://github.com/openvinotoolkit/openvino/wiki/AddressSanitizer-and-LeakSanitizer")
endif()
else()
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=address")
check_cxx_compiler_flag("-fsanitize-recover=address" SANITIZE_RECOVER_ADDRESS_SUPPORTED)
if (SANITIZE_RECOVER_ADDRESS_SUPPORTED)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=address")
endif()
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=address")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
if (ENABLE_UB_SANITIZER)
if (WIN32)
message(FATAL_ERROR "UndefinedBehavior sanitizer is not supported in Windows")
if(ENABLE_UB_SANITIZER)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(FATAL_ERROR "UndefinedBehavior sanitizer is not supported in Windows with MSVC compiler. Please, use clang-cl or mingw")
endif()
# TODO: Remove -fno-sanitize=null as thirdparty/ocl/clhpp_headers UBSAN compatibility resolved:
# https://github.com/KhronosGroup/OpenCL-CLHPP/issues/17
# Mute -fsanitize=function Indirect call of a function through a function pointer of the wrong type.
@ -48,43 +52,50 @@ if (ENABLE_UB_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fno-sanitize=function")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# TODO: Remove -Wno-maybe-uninitialized after CVS-61143 fix
if(CMAKE_COMPILER_IS_GNUCXX)
# TODO: Remove -Wno-maybe-uninitialized after CVS-61143 is fixed
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -Wno-maybe-uninitialized")
endif()
check_cxx_compiler_flag("-fsanitize-recover=undefined" SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
if (SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
if(SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=undefined")
endif()
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=undefined")
endif()
if (ENABLE_THREAD_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=thread")
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=thread")
if(ENABLE_THREAD_SANITIZER)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(FATAL_ERROR "Thread sanitizer is not supported in Windows with MSVC compiler. Please, use clang-cl or mingw")
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=thread")
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=thread")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
# common sanitizer options
if (DEFINED SANITIZER_COMPILER_FLAGS)
if(DEFINED SANITIZER_COMPILER_FLAGS)
# ensure symbols are present
if (NOT WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /Oy-")
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -g -fno-omit-frame-pointer")
if(NOT OV_COMPILER_IS_CLANG)
if(CMAKE_COMPILER_IS_GNUCXX)
# GPU plugin tests compilation is slow with -fvar-tracking-assignments on GCC.
# Clang has no var-tracking-assignments.
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fno-var-tracking-assignments")
endif()
# prevent unloading libraries at runtime, so sanitizer can resolve their symbols
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(NOT OV_COMPILER_IS_APPLECLANG)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -Wl,-z,nodelete")
if(OV_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
endif()
endif()
else()
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /Oy-")
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_COMPILER_FLAGS}")

View File

@ -2,61 +2,68 @@
# SPDX-License-Identifier: Apache-2.0
#
if(UNIX)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wformat -Wformat-security")
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR
(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel"))
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -Wformat -Wformat-security")
if (NOT ENABLE_SANITIZER)
if(EMSCRIPTEN)
# emcc does not support fortification, see:
# https://stackoverflow.com/questions/58854858/undefined-symbol-stack-chk-guard-in-libopenh264-so-when-building-ffmpeg-wit
else()
# ASan does not support fortification https://github.com/google/sanitizers/issues/247
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
endif()
endif()
if(NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv")
if(CMAKE_COMPILER_IS_GNUCXX)
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-all")
else()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-strong")
endif()
if (NOT ENABLE_SANITIZER)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -s")
# Remove all symbol table and relocation information from the executable
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -s")
endif()
if(NOT MINGW)
set(OV_LINKER_FLAGS "${OV_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
elseif(OV_COMPILER_IS_CLANG)
if(EMSCRIPTEN)
# emcc does not support fortification
# https://stackoverflow.com/questions/58854858/undefined-symbol-stack-chk-guard-in-libopenh264-so-when-building-ffmpeg-wit
else()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-all")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if (NOT ENABLE_SANITIZER)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wl,--strip-all")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -Wl,--strip-all")
endif()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong")
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl")
endif()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /guard:cf")
if(ENABLE_INTEGRITYCHECK)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK")
endif()
if(ENABLE_QSPECTRE)
ie_add_compiler_flags(/Qspectre)
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-strong")
set(OV_LINKER_FLAGS "${OV_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} /sdl /guard:cf")
endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
if(ENABLE_QSPECTRE)
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} /Qspectre")
endif()
if(ENABLE_INTEGRITYCHECK)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK")
endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${OV_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OV_C_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${OV_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${OV_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OV_LINKER_FLAGS}")
unset(OV_C_CXX_FLAGS)
unset(OV_LINKER_FLAGS)

View File

@ -74,7 +74,12 @@ ie_option (VERBOSE_BUILD "shows extra information about build" OFF)
ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF)
ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG;NOT WIN32" OFF)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1930)
# Visual Studio 2022: 1930-1939 = VS 17.0 (v143 toolset)
set(_msvc_version_2022 ON)
endif()
ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG OR _msvc_version_2022" OFF)
#
# Check features

View File

@ -171,7 +171,7 @@ macro(ov_add_frontend)
endforeach()
# Disable all warnings for generated code
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w GENERATED TRUE)
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w GENERATED ON)
# Create library
add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}
@ -204,8 +204,7 @@ macro(ov_add_frontend)
ov_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION ${OV_FRONTEND_FILEDESCRIPTION})
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime)
target_link_libraries(${TARGET_NAME} PRIVATE ${OV_FRONTEND_LINK_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${OV_FRONTEND_LINK_LIBRARIES} PUBLIC openvino::runtime)
ov_add_library_version(${TARGET_NAME})
# WA for TF frontends which always require protobuf (not protobuf-lite)
@ -229,7 +228,7 @@ macro(ov_add_frontend)
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LIBRARIES})
endif()
# prptobuf generated code emits -Wsuggest-override error
# protobuf generated code emits -Wsuggest-override error
if(SUGGEST_OVERRIDE_SUPPORTED)
target_compile_options(${TARGET_NAME} PRIVATE -Wno-suggest-override)
endif()

View File

@ -2,41 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
#
include(target_flags)
# TODO: remove this function: we must not have conditions for particular OS names or versions
# cmake needs to look at /etc files only when we build for Linux on Linux
if(CMAKE_HOST_LINUX AND LINUX)
function(get_linux_name res_var)
if(EXISTS "/etc/lsb-release")
# linux version detection using cat /etc/lsb-release
file(READ "/etc/lsb-release" release_data)
set(name_regex "DISTRIB_ID=([^ \n]*)\n")
set(version_regex "DISTRIB_RELEASE=([0-9]+(\\.[0-9]+)?)")
else()
execute_process(COMMAND find -L /etc/ -maxdepth 1 -type f -name *-release -exec cat {} \;
OUTPUT_VARIABLE release_data
RESULT_VARIABLE result)
string(REPLACE "Red Hat" "CentOS" release_data "${release_data}")
set(name_regex "NAME=\"([^ \"\n]*).*\"\n")
set(version_regex "VERSION=\"([0-9]+(\\.[0-9]+)?)[^\n]*\"")
endif()
string(REGEX MATCH ${name_regex} name ${release_data})
set(os_name ${CMAKE_MATCH_1})
string(REGEX MATCH ${version_regex} version ${release_data})
set(os_name "${os_name} ${CMAKE_MATCH_1}")
if(os_name)
set(${res_var} ${os_name} PARENT_SCOPE)
else ()
set(${res_var} NOTFOUND PARENT_SCOPE)
endif ()
endfunction()
else()
function(get_linux_name res_var)
set(${res_var} NOTFOUND PARENT_SCOPE)
endfunction()
endif ()
function(get_linux_name res_var)
set(${res_var} NOTFOUND PARENT_SCOPE)
endfunction()

View File

@ -17,20 +17,44 @@ if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(arch_flag X86_64)
set(host_arch_flag X86_64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
set(arch_flag X86)
set(host_arch_flag X86)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*)")
set(arch_flag AARCH64)
set(host_arch_flag AARCH64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(arch_flag ARM)
set(host_arch_flag ARM)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^riscv64$")
set(arch_flag RISCV64)
set(host_arch_flag RISCV64)
endif()
set(HOST_${arch_flag} ON)
set(HOST_${host_arch_flag} ON)
macro(_ie_process_msvc_generator_platform arch_flag)
macro(_ov_detect_arch_by_processor_type)
if(CMAKE_OSX_ARCHITECTURES AND APPLE)
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(AARCH64 ON)
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
set(X86_64 ON)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES ".*x86_64.*" AND CMAKE_OSX_ARCHITECTURES MATCHES ".*arm64.*")
set(UNIVERSAL2 ON)
else()
message(FATAL_ERROR "Unsupported value: CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
set(X86 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*)")
set(AARCH64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(ARM ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv64$")
set(RISCV64 ON)
endif()
endmacro()
macro(_ov_process_msvc_generator_platform)
# if cmake -A <ARM|ARM64|x64|Win32> is passed
if(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
set(AARCH64 ON)
@ -41,45 +65,30 @@ macro(_ie_process_msvc_generator_platform arch_flag)
elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
set(X86 ON)
else()
set(${arch_flag} ON)
_ov_detect_arch_by_processor_type()
endif()
endmacro()
# TODO: why OpenCV is found by cmake
if(MSVC64 OR MINGW64)
_ie_process_msvc_generator_platform(${arch_flag})
_ov_process_msvc_generator_platform()
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING))
_ie_process_msvc_generator_platform(${arch_flag})
elseif(CMAKE_OSX_ARCHITECTURES AND APPLE)
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(AARCH64 ON)
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
set(X86_64 ON)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES ".*x86_64.*" AND CMAKE_OSX_ARCHITECTURES MATCHES ".*arm64.*")
set(UNIVERSAL2 ON)
else()
message(FATAL_ERROR "Unsupported value: CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
set(X86 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*)")
set(AARCH64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(ARM ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv64$")
set(RISCV64 ON)
_ov_process_msvc_generator_platform()
else()
_ov_detect_arch_by_processor_type()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(EMSCRIPTEN ON)
endif()
if(UNIX AND NOT (APPLE OR ANDROID OR EMSCRIPTEN))
if(UNIX AND NOT (APPLE OR ANDROID OR EMSCRIPTEN OR CYGWIN))
set(LINUX ON)
endif()
if(NOT DEFINED CMAKE_HOST_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_VERSION VERSION_LESS 3.25 AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
# the variable is available since 3.25
# https://cmake.org/cmake/help/latest/variable/CMAKE_HOST_LINUX.html
set(CMAKE_HOST_LINUX ON)
endif()

View File

@ -40,6 +40,7 @@ function(ieTargetLinkWholeArchive targetName)
"-Wl,-noall_load"
)
else()
# non-Apple Clang and GCC / MinGW
list(APPEND libs
"-Wl,--whole-archive"
${staticLib}

View File

@ -22,7 +22,7 @@ else()
set(ENABLE_INTEL_GPU_DEFAULT OFF)
endif()
ie_dependent_option (ENABLE_INTEL_GPU "GPU OpenCL-based plugin for OpenVINO Runtime" ${ENABLE_INTEL_GPU_DEFAULT} "X86_64 OR AARCH64;NOT APPLE;NOT MINGW;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF)
ie_dependent_option (ENABLE_INTEL_GPU "GPU OpenCL-based plugin for OpenVINO Runtime" ${ENABLE_INTEL_GPU_DEFAULT} "X86_64 OR AARCH64;NOT APPLE;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF)
if (ANDROID OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0))
# oneDNN doesn't support old compilers and android builds for now, so we'll
@ -85,7 +85,7 @@ ie_option (ENABLE_INTEL_GNA_DEBUG "GNA debug build" OFF)
ie_dependent_option (ENABLE_IR_V7_READER "Enables IR v7 reader" ${BUILD_SHARED_LIBS} "ENABLE_TESTS;ENABLE_INTEL_GNA" OFF)
ie_option (ENABLE_GAPI_PREPROCESSING "Enables G-API preprocessing" ON)
ie_dependent_option (ENABLE_GAPI_PREPROCESSING "Enables G-API preprocessing" ON "NOT MINGW64" OFF)
ie_option (ENABLE_MULTI "Enables MULTI Device Plugin" ON)
ie_option (ENABLE_AUTO "Enables AUTO Device Plugin" ON)

View File

@ -0,0 +1,95 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Prerequisites:
#
# Build platform: Ubuntu
# apt-get install mingw-w64 mingw-w64-tools g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64
#
# Build platform: macOS
# brew install mingw-w64
#
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix)
set(PKG_CONFIG_EXECUTABLE x86_64-w64-mingw32-pkg-config CACHE PATH "Path to Windows x86_64 pkg-config")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
macro(__cmake_find_root_save_and_reset)
foreach(v
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
)
set(__save_${v} ${${v}})
set(${v} NEVER)
endforeach()
endmacro()
macro(__cmake_find_root_restore)
foreach(v
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
)
set(${v} ${__save_${v}})
unset(__save_${v})
endforeach()
endmacro()
# macro to find programs on the host OS
macro(find_host_program)
__cmake_find_root_save_and_reset()
if(CMAKE_HOST_WIN32)
SET(WIN32 1)
SET(UNIX)
SET(APPLE)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(UNIX)
SET(WIN32)
elseif(CMAKE_HOST_UNIX)
SET(UNIX 1)
SET(WIN32)
SET(APPLE)
endif()
find_program(${ARGN})
SET(WIN32 1)
SET(APPLE)
SET(UNIX)
__cmake_find_root_restore()
endmacro()
# macro to find packages on the host OS
macro(find_host_package)
__cmake_find_root_save_and_reset()
if(CMAKE_HOST_WIN32)
SET(WIN32 1)
SET(UNIX)
SET(APPLE)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(WIN32)
SET(UNIX)
elseif(CMAKE_HOST_UNIX)
SET(UNIX 1)
SET(WIN32)
SET(APPLE)
endif()
find_package(${ARGN})
SET(WIN32 1)
SET(APPLE)
SET(UNIX)
__cmake_find_root_restore()
endmacro()

View File

@ -24,7 +24,7 @@ set(CMAKE_LINKER ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-ld)
set(CMAKE_OBJCOPY ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-objcopy)
set(CMAKE_OBJDUMP ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-objdump)
set(CMAKE_READELF ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-readelf)
set(PKG_CONFIG_EXECUTABLE "NOT-FOUND" CACHE PATH "Path to ARM64 pkg-config")
set(PKG_CONFIG_EXECUTABLE "NOT-FOUND" CACHE PATH "Path to RISC-V pkg-config")
# Don't run the linker on compiler check
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

View File

@ -43,6 +43,8 @@ parent_output = node->input_value(0);
// Getting all consumers for output port
auto consumers = output.get_target_inputs();
// ! [ngraph:ports_example]
(void)el_type;
(void)pshape;
}
{

View File

@ -54,23 +54,18 @@ set (CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
set (CMAKE_PDB_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
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")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS -D_CRT_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 (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")
endif()
else()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable:177")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4275 /wd4267 /wd4819")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qdiag-disable:177")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable:177")
endif()
endif()

View File

@ -36,7 +36,7 @@
#include <string.h>
#include <windef.h>
#include <fileapi.h>
#include <Winbase.h>
#include <winbase.h>
#include <sys/stat.h>
// clang-format on
@ -131,7 +131,7 @@ public:
* @param string directory path
* @return pointer to directory data struct element
*/
static DIR* opendir(const char* dirPath) {
inline DIR* opendir(const char* dirPath) {
auto dp = new DIR(dirPath);
if (!dp->isValid()) {
delete dp;
@ -145,7 +145,7 @@ static DIR* opendir(const char* dirPath) {
* @param pointer to directory data struct
* @return pointer to directory data struct next element
*/
static struct dirent* readdir(DIR* dp) {
inline struct dirent* readdir(DIR* dp) {
return dp->nextEnt();
}
@ -154,7 +154,7 @@ static struct dirent* readdir(DIR* dp) {
* @param pointer to struct directory data
* @return void
*/
static void closedir(DIR* dp) {
inline void closedir(DIR* dp) {
delete dp;
}

View File

@ -37,7 +37,7 @@
# define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __VA_ARGS__
# define IE_NODISCARD
#else
# if defined(_WIN32)
# if defined(_WIN32) || defined(__CYGWIN__)
# define INFERENCE_ENGINE_C_API_CALLBACK __cdecl
# ifdef openvino_c_EXPORTS
# define INFERENCE_ENGINE_C_API(...) INFERENCE_ENGINE_C_API_EXTERN __declspec(dllexport) __VA_ARGS__ __cdecl

View File

@ -38,7 +38,14 @@
// so any use of `frobnicate` will produce a compiler warning.
//
#if defined(_WIN32)
#if defined(__GNUC__)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ >= 6 || defined(__clang__)
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
# else
# define OPENVINO_ENUM_DEPRECATED(msg)
# endif
#elif defined(_MSC_VER)
# define OPENVINO_DEPRECATED(msg) __declspec(deprecated(msg))
# if __cplusplus >= 201402L
# define OPENVINO_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
@ -48,43 +55,36 @@
#elif defined(__INTEL_COMPILER)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
#elif defined(__GNUC__)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ < 6 && !defined(__clang__)
# define OPENVINO_ENUM_DEPRECATED(msg)
# else
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
# endif
#else
# define OPENVINO_DEPRECATED(msg)
# define OPENVINO_ENUM_DEPRECATED(msg)
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
# define OPENVINO_DO_PRAGMA(x) __pragma(x)
#elif defined(__GNUC__)
#if defined(__GNUC__)
# define OPENVINO_DO_PRAGMA(x) _Pragma(# x)
#elif defined(_MSC_VER)
# define OPENVINO_DO_PRAGMA(x) __pragma(x)
#else
# define OPENVINO_DO_PRAGMA(x)
#endif
#if defined(_MSC_VER) && !defined(__clang__)
#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405)) || defined(__clang__)
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(GCC diagnostic push) \
OPENVINO_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(GCC diagnostic pop)
#elif defined(_MSC_VER)
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 4996))
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
#elif defined(__INTEL_COMPILER)
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 1478))
OPENVINO_DO_PRAGMA(warning(disable : 1786))
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 1478)) \
OPENVINO_DO_PRAGMA(warning(disable : 1786))
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(GCC diagnostic push) \
OPENVINO_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(GCC diagnostic pop)
#else
# define OPENVINO_SUPPRESS_DEPRECATED_START
# define OPENVINO_SUPPRESS_DEPRECATED_END

View File

@ -14,18 +14,19 @@
#include <stdint.h>
#include <stdio.h>
#ifndef ENABLE_UNICODE_PATH_SUPPORT
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define ENABLE_UNICODE_PATH_SUPPORT
# if defined(__INTEL_COMPILER) || defined(_MSC_VER) || defined(__GNUC__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__clang__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2))
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# include <wchar.h>
#endif
@ -40,7 +41,7 @@
# define OPENVINO_C_VAR(...) OPENVINO_C_API_EXTERN __VA_ARGS__
# define OV_NODISCARD
#else
# if defined(_WIN32)
# if defined(_WIN32) || defined(__CYGWIN__)
# define OPENVINO_C_API_CALLBACK __cdecl
# ifdef openvino_c_EXPORTS
# define OPENVINO_C_API(...) OPENVINO_C_API_EXTERN __declspec(dllexport) __VA_ARGS__ __cdecl

View File

@ -18,18 +18,7 @@
#define OV_EXPECT_NOT_OK(...) EXPECT_NE(ov_status_e::OK, __VA_ARGS__)
#define OV_EXPECT_ARREQ(arr1, arr2) EXPECT_TRUE(std::equal(std::begin(arr1), std::end(arr1), std::begin(arr2)))
#ifndef ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# include <wchar.h>
#endif
@ -88,14 +77,14 @@ inline void fix_slashes(std::wstring& str) {
}
inline bool copy_file(std::string source_path, std::wstring dest_path) {
# ifndef _WIN32
std::ifstream source(source_path, std::ios::binary);
std::ofstream dest(ov::util::wstring_to_string(dest_path), std::ios::binary);
# else
# ifdef _WIN32
fix_slashes(source_path);
fix_slashes(dest_path);
std::ifstream source(source_path, std::ios::binary);
std::ofstream dest(dest_path, std::ios::binary);
# else
std::ifstream source(source_path, std::ios::binary);
std::ofstream dest(ov::util::wstring_to_string(dest_path), std::ios::binary);
# endif
bool result = source && dest;
std::istreambuf_iterator<char> begin_source(source);

View File

@ -73,6 +73,8 @@ macro(_ov_platform_arch)
else()
set(_arch "aarch64")
endif()
elseif(UNIVERSAL2)
set(_arch "universal2")
elseif(ARM)
set(_arch "armvl7")
elseif(X86_64)

View File

@ -12,23 +12,21 @@ file(GLOB LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
# instructions support depending on an OS and a compiler
#
macro(ie_avx512_core_optimization_flags flags)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX512)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(${flags} /QxCORE-AVX512)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX512)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
set(${flags} -xCORE-AVX512)
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(${flags} -mavx512f -mavx512bw -mavx512dq -mfma)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
list(APPEND ${flags} -Wno-error=maybe-uninitialized -Wno-maybe-uninitialized)
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(${flags} -xCORE-AVX512)
else()
set(${flags} -mavx512f -mavx512bw -mavx512dq -mfma)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
list(APPEND ${flags} -Wno-error=maybe-uninitialized -Wno-maybe-uninitialized)
endif()
endif()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endmacro()

View File

@ -4,6 +4,7 @@
#pragma once
#include <cstdint>
#include <string>
namespace ov {

View File

@ -37,7 +37,11 @@ struct FileTraits<char> {
}
static std::string library_prefix() {
#ifdef _WIN32
# if defined(__MINGW32__) || defined(__MINGW64__)
return {"lib"};
# else
return {""};
# endif
#else
return {"lib"};
#endif
@ -62,7 +66,11 @@ struct FileTraits<wchar_t> {
}
static std::wstring library_prefix() {
#ifdef _WIN32
# if defined(__MINGW32__) || defined(__MINGW64__)
return {L"lib"};
# else
return {L""};
# endif
#else
return {L"lib"};
#endif

View File

@ -6,19 +6,21 @@
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# if defined(__INTEL_COMPILER) || defined(_MSC_VER) || defined(__GNUC__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# elif defined(__clang__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2))
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
// Disabled MSVC warning
#if defined(_MSC_VER)
# define DISABLE_WARNING_MSVC_BEGIN(id) __pragma(warning(push)) __pragma(warning(disable : id))
# define DISABLE_WARNING_MSVC_END(id) __pragma(warning(pop))
# define OPENVINO_DISABLE_WARNING_MSVC_BEGIN(id) __pragma(warning(push)) __pragma(warning(disable : id))
# define OPENVINO_DISABLE_WARNING_MSVC_END(id) __pragma(warning(pop))
#else
# define DISABLE_WARNING_MSVC_BEGIN(id)
# define DISABLE_WARNING_MSVC_END(id)
# define OPENVINO_DISABLE_WARNING_MSVC_BEGIN(id)
# define OPENVINO_DISABLE_WARNING_MSVC_END(id)
#endif

View File

@ -10,5 +10,7 @@
#define NGRAPH_EXTERN_C OPENVINO_EXTERN_C
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# define ENABLE_UNICODE_PATH_SUPPORT
# ifndef ENABLE_UNICODE_PATH_SUPPORT
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif

View File

@ -43,7 +43,7 @@
*/
namespace ov {} // namespace ov
#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(disable : 4251)
# pragma warning(disable : 4275)
#endif

View File

@ -14,7 +14,14 @@
// so any use of `frobnicate` will produce a compiler warning.
//
#if defined(_WIN32)
#if defined(__GNUC__)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ >= 6 || defined(__clang__)
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
# else
# define OPENVINO_ENUM_DEPRECATED(msg)
# endif
#elif defined(_MSC_VER)
# define OPENVINO_DEPRECATED(msg) __declspec(deprecated(msg))
# if __cplusplus >= 201402L
# define OPENVINO_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
@ -24,43 +31,36 @@
#elif defined(__INTEL_COMPILER)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
#elif defined(__GNUC__)
# define OPENVINO_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ < 6 && !defined(__clang__)
# define OPENVINO_ENUM_DEPRECATED(msg)
# else
# define OPENVINO_ENUM_DEPRECATED(msg) OPENVINO_DEPRECATED(msg)
# endif
#else
# define OPENVINO_DEPRECATED(msg)
# define OPENVINO_ENUM_DEPRECATED(msg)
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
# define OPENVINO_DO_PRAGMA(x) __pragma(x)
#elif defined(__GNUC__)
#if defined(__GNUC__)
# define OPENVINO_DO_PRAGMA(x) _Pragma(# x)
#elif defined(_MSC_VER)
# define OPENVINO_DO_PRAGMA(x) __pragma(x)
#else
# define OPENVINO_DO_PRAGMA(x)
#endif
#if defined(_MSC_VER) && !defined(__clang__)
#if defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(GCC diagnostic push) \
OPENVINO_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(GCC diagnostic pop)
#elif defined(_MSC_VER)
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 4996))
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
#elif defined(__INTEL_COMPILER)
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 1478))
OPENVINO_DO_PRAGMA(warning(disable : 1786))
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(warning(push)) \
OPENVINO_DO_PRAGMA(warning(disable : 1478)) \
OPENVINO_DO_PRAGMA(warning(disable : 1786))
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(warning(pop))
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
# define OPENVINO_SUPPRESS_DEPRECATED_START \
OPENVINO_DO_PRAGMA(GCC diagnostic push) \
OPENVINO_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define OPENVINO_SUPPRESS_DEPRECATED_END OPENVINO_DO_PRAGMA(GCC diagnostic pop)
#else
# define OPENVINO_SUPPRESS_DEPRECATED_START
# define OPENVINO_SUPPRESS_DEPRECATED_END

View File

@ -22,9 +22,9 @@ struct CheckLocInfo {
class OPENVINO_API Exception : public std::runtime_error {
public:
OPENVINO_DEPRECATED("This constructor is deprecated and will be removed, please use OPENVINO_THROW instead")
explicit Exception(const std::string& what_arg) : std::runtime_error(what_arg) {}
explicit Exception(const std::string& what_arg);
OPENVINO_DEPRECATED("This constructor is deprecated and will be removed, please use OPENVINO_THROW instead")
explicit Exception(const std::stringstream& what_arg) : std::runtime_error(what_arg.str()) {}
explicit Exception(const std::stringstream& what_arg);
[[noreturn]] static void create(const CheckLocInfo& check_loc_info,
const std::string& context_info,
const std::string& explanation);

View File

@ -11,14 +11,8 @@
#include "openvino/core/core_visibility.hpp"
#include "openvino/core/type.hpp"
// Use extern "C" in order to avoid issues with mangling
#if defined(_WIN32) && defined(IMPLEMENT_OPENVINO_EXTENSION_API)
# define OPENVINO_EXTENSION_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
# define OPENVINO_EXTENSION_API OPENVINO_CORE_EXPORTS
#else
# define OPENVINO_EXTENSION_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
# define OPENVINO_EXTENSION_API OPENVINO_CORE_EXPORTS
#endif
#define OPENVINO_EXTENSION_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
#define OPENVINO_EXTENSION_API OPENVINO_CORE_EXPORTS
namespace ov {

View File

@ -23,19 +23,21 @@
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# if defined(__INTEL_COMPILER) || defined(_MSC_VER) || defined(__GNUC__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# elif defined(__clang__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2))
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
#if defined _WIN32 || defined __CYGWIN__
#if defined(_WIN32) || defined(__CYGWIN__)
# define OPENVINO_CORE_IMPORTS __declspec(dllimport)
# define OPENVINO_CORE_EXPORTS __declspec(dllexport)
# define _OPENVINO_HIDDEN_METHOD
#elif defined(__GNUC__) && __GNUC__ >= 4
#elif defined(__GNUC__) && (__GNUC__ >= 4) || defined(__clang__)
# define OPENVINO_CORE_IMPORTS __attribute__((visibility("default")))
# define OPENVINO_CORE_EXPORTS __attribute__((visibility("default")))
# define _OPENVINO_HIDDEN_METHOD __attribute__((visibility("hidden")))

View File

@ -520,12 +520,12 @@ private:
std::numeric_limits<StorageDataType>::lowest() <= value);
OPENVINO_ASSERT(std::numeric_limits<StorageDataType>::max() >= value);
}
#if defined(_MSC_VER)
# pragma warning(pop)
#elif defined(__clang__)
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__)
# pragma GCC diagnostic pop
#elif defined(_MSC_VER)
# pragma warning(pop)
#endif
const auto size = shape_size(m_shape);

View File

@ -11,9 +11,8 @@
#include "openvino/core/except.hpp"
#include "openvino/core/node.hpp"
#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4100)
#endif
@ -83,6 +82,6 @@ ActivationFunction get_activation_func_by_name(const std::string& func_name);
} // namespace ov
#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(pop)
#endif

View File

@ -4,6 +4,10 @@
#include "openvino/core/except.hpp"
ov::Exception::Exception(const std::string& what_arg) : std::runtime_error(what_arg) {}
ov::Exception::Exception(const std::stringstream& what_arg) : std::runtime_error(what_arg.str()) {}
void ov::Exception::create(const CheckLocInfo& check_loc_info,
const std::string& context_info,
const std::string& explanation) {

View File

@ -2,8 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#ifdef _WIN32
#else
#ifndef _WIN32
# include <cxxabi.h>
#endif

View File

@ -6,8 +6,8 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <Windows.h>
# include <direct.h>
# include <windows.h>
#else // _WIN32
# include <dirent.h>
# include <dlfcn.h>

View File

@ -23,7 +23,7 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <Windows.h>
# include <windows.h>
#endif
namespace {

View File

@ -77,7 +77,7 @@ bool FrontEnd::supported_impl(const std::vector<ov::Any>& variants) const {
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
} else if (model_variant.is<std::wstring>()) {
const auto& path = model_variant.as<std::wstring>();
local_model_stream.open(path, std::ios::in | std::ifstream::binary);
local_model_stream.open(path.c_str(), std::ios::in | std::ifstream::binary);
#endif
} else if (model_variant.is<std::istream*>()) {
provided_model_stream = model_variant.as<std::istream*>();
@ -153,11 +153,11 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector<ov::Any>& variants) const
#else
model_path = tmp_path;
#endif
local_model_stream.open(model_path, std::ios::in | std::ifstream::binary);
local_model_stream.open(model_path.c_str(), std::ios::in | std::ifstream::binary);
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
} else if (model_variant.is<std::wstring>()) {
model_path = model_variant.as<std::wstring>();
local_model_stream.open(model_path, std::ios::in | std::ifstream::binary);
local_model_stream.open(model_path.c_str(), std::ios::in | std::ifstream::binary);
#endif
} else if (model_variant.is<std::istream*>()) {
provided_model_stream = model_variant.as<std::istream*>();
@ -205,7 +205,7 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector<ov::Any>& variants) const
weights = ov::load_mmap_object(weights_path);
else {
std::ifstream bin_stream;
bin_stream.open(weights_path, std::ios::binary);
bin_stream.open(weights_path.c_str(), std::ios::binary);
if (!bin_stream.is_open())
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
IE_THROW() << "Weights file " + ov::util::wstring_to_string(weights_path) + " cannot be opened!";

View File

@ -140,7 +140,7 @@ bool FrontEnd::supported_impl(const std::vector<ov::Any>& variants) const {
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
else if (variants[0].is<std::wstring>()) {
const auto path = variants[0].as<std::wstring>();
model_stream.open(path, std::ios::in | std::ifstream::binary);
model_stream.open(path.c_str(), std::ios::in | std::ifstream::binary);
}
#endif
if (model_stream.is_open()) {

View File

@ -37,7 +37,7 @@ std::string TensorExternalData::load_external_data(const std::string& model_dir)
auto full_path = file_util::path_join(model_dir, m_data_location);
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
file_util::convert_path_win_style(full_path);
std::ifstream external_data_stream(ov::util::string_to_wstring(full_path),
std::ifstream external_data_stream(ov::util::string_to_wstring(full_path).c_str(),
std::ios::binary | std::ios::in | std::ios::ate);
#else
std::ifstream external_data_stream(full_path, std::ios::binary | std::ios::in | std::ios::ate);

View File

@ -6,6 +6,7 @@
#include <algorithm>
#include <array>
#include <cstdint>
#include <exception>
#include <map>
#include <unordered_set>

View File

@ -15,7 +15,7 @@
namespace ngraph {
namespace onnx_common {
ONNX_NAMESPACE::ModelProto parse_from_file(const std::string& file_path) {
std::ifstream file_stream{file_path, std::ios::in | std::ios::binary};
std::ifstream file_stream{file_path.c_str(), std::ios::in | std::ios::binary};
if (!file_stream.is_open()) {
OPENVINO_THROW("Could not open the file: " + file_path);
@ -28,7 +28,7 @@ ONNX_NAMESPACE::ModelProto parse_from_file(const std::string& file_path) {
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
ONNX_NAMESPACE::ModelProto parse_from_file(const std::wstring& file_path) {
std::ifstream file_stream{file_path, std::ios::in | std::ios::binary};
std::ifstream file_stream{file_path.c_str(), std::ios::in | std::ios::binary};
if (!file_stream.is_open()) {
NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -136,7 +136,7 @@ std::istream* variant_to_stream_ptr(const ov::Any& variant, std::ifstream& ext_s
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
else if (variant.is<std::wstring>()) {
const auto& model_path = variant.as<std::wstring>();
ext_stream.open(model_path, std::ios::in | std::ifstream::binary);
ext_stream.open(model_path.c_str(), std::ios::in | std::ifstream::binary);
}
#endif
FRONT_END_INITIALIZATION_CHECK(ext_stream && ext_stream.is_open(), "Cannot open model file.");
@ -375,7 +375,7 @@ bool FrontEnd::supported_impl(const std::vector<ov::Any>& variants) const {
if (!ov::util::ends_with(model_path, suffix)) {
model_path += paddle::get_path_sep<wchar_t>() + L"__model__";
}
std::ifstream model_str(model_path, std::ios::in | std::ifstream::binary);
std::ifstream model_str(model_path.c_str(), std::ios::in | std::ifstream::binary);
// It is possible to validate here that protobuf can read model from the stream,
// but it will complicate the check, while it should be as quick as possible
return model_str && model_str.is_open();

View File

@ -200,7 +200,7 @@ std::basic_string<wchar_t> get_model_path(const std::basic_string<wchar_t>& path
std::wstring params_ext = L".pdiparams";
std::wstring weights_file{path};
weights_file.replace(weights_file.size() - ext.size(), ext.size(), params_ext);
weights_stream->open(weights_file, std::ios::binary);
weights_stream->open(weights_file.c_str(), std::ios::binary);
// Don't throw error if file isn't opened
// It may mean that model don't have constants
} else {
@ -306,7 +306,7 @@ void InputModel::InputModelImpl::loadConsts(const std::basic_string<T>& folder_w
if (weight_stream) {
read_succeed = read_tensor(*weight_stream, reinterpret_cast<char*>(&tensor_data[0]), data_length);
} else if (!folder_with_weights.empty()) {
std::ifstream is(get_const_path(folder_with_weights, name), std::ios::in | std::ifstream::binary);
std::ifstream is(get_const_path(folder_with_weights, name).c_str(), std::ios::in | std::ifstream::binary);
FRONT_END_GENERAL_CHECK(is && is.is_open(), "Cannot open file for constant value.");
read_succeed = read_tensor(is, reinterpret_cast<char*>(&tensor_data[0]), data_length);
} else {
@ -332,7 +332,7 @@ InputModel::InputModelImpl::InputModelImpl(const std::basic_string<T>& path,
m_telemetry(telemetry) {
std::string empty_str;
std::ifstream weights_stream;
std::ifstream pb_stream(get_model_path<T>(path, &weights_stream), std::ios::in | std::ifstream::binary);
std::ifstream pb_stream(get_model_path<T>(path, &weights_stream).c_str(), std::ios::in | std::ifstream::binary);
FRONT_END_GENERAL_CHECK(pb_stream && pb_stream.is_open(), "Model file doesn't exist");
FRONT_END_GENERAL_CHECK(m_fw_ptr->ParseFromIstream(&pb_stream), "Model can't be parsed");

View File

@ -42,7 +42,7 @@ public:
template <typename T>
static bool is_supported(const std::basic_string<T>& path) {
try {
std::ifstream mg_stream(path, std::ios::in | std::ifstream::binary);
std::ifstream mg_stream(path.c_str(), std::ios::in | std::ifstream::binary);
auto metagraph_def = std::make_shared<::tensorflow::MetaGraphDef>();
return mg_stream && mg_stream.is_open() && metagraph_def->ParsePartialFromIstream(&mg_stream) &&
metagraph_def->has_graph_def() && metagraph_def->graph_def().node_size() > 0;
@ -70,13 +70,13 @@ private:
bool read_meta(const std::basic_string<T>& path) {
std::basic_string<T> model_path = path.substr(0, path.find_last_of('.'));
std::ifstream mg_stream{path, std::ifstream::in | std::ifstream::binary};
std::ifstream mg_stream{path.c_str(), std::ifstream::in | std::ifstream::binary};
FRONT_END_GENERAL_CHECK(mg_stream && mg_stream.is_open(), "Model file does not exist");
std::basic_string<T> varIndexPath = get_variables_index_name<T>(model_path);
if (ov::util::file_exists(varIndexPath)) {
m_variables_index = std::make_shared<VariablesIndex>();
std::ifstream vi_stream{varIndexPath, std::ifstream::in | std::ifstream::binary};
std::ifstream vi_stream{varIndexPath.c_str(), std::ifstream::in | std::ifstream::binary};
FRONT_END_GENERAL_CHECK(vi_stream && vi_stream.is_open(), "MetaGraph's variable index file does not exist");
FRONT_END_GENERAL_CHECK(m_variables_index->read_variables(vi_stream, model_path, false),
"MetaGraph's variable index file cannot be parsed");

View File

@ -95,7 +95,7 @@ public:
GraphIteratorProto(const std::basic_string<T>& path)
: m_graph_def(std::make_shared<::tensorflow::GraphDef>()),
m_func_def(nullptr) {
std::ifstream pb_stream(path, std::ios::in | std::ifstream::binary);
std::ifstream pb_stream(path.c_str(), std::ios::in | std::ifstream::binary);
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");
@ -107,7 +107,7 @@ public:
template <typename T>
static bool is_supported(const std::basic_string<T>& path) {
try {
std::ifstream pb_stream(path, std::ios::in | std::ifstream::binary);
std::ifstream pb_stream(path.c_str(), std::ios::in | std::ifstream::binary);
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;

View File

@ -19,7 +19,7 @@ class GraphIteratorProtoTxt : public GraphIteratorProto {
public:
template <typename T>
GraphIteratorProtoTxt(const std::basic_string<T>& path) : GraphIteratorProto() {
std::ifstream pbtxt_stream(path, std::ios::in);
std::ifstream pbtxt_stream(path.c_str(), std::ios::in);
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");
@ -35,7 +35,7 @@ public:
template <typename T>
static bool is_supported(const std::basic_string<T>& path) {
try {
std::ifstream pbtxt_stream(path, std::ios::in);
std::ifstream pbtxt_stream(path.c_str(), std::ios::in);
bool model_exists = (pbtxt_stream && pbtxt_stream.is_open());
if (!model_exists) {
return false;

View File

@ -68,13 +68,14 @@ private:
template <typename T>
bool read_saved_model(const std::basic_string<T>& path, const std::string& tags) {
std::ifstream sm_stream{path + get_saved_model_name<T>(), std::ifstream::in | std::ifstream::binary};
std::basic_string<T> save_model_path = path + get_saved_model_name<T>();
std::ifstream sm_stream{save_model_path.c_str(), std::ifstream::in | std::ifstream::binary};
FRONT_END_GENERAL_CHECK(sm_stream && sm_stream.is_open(), "Model file does not exist");
std::basic_string<T> varIndexPath = path + get_variables_index_name<T>();
if (ov::util::file_exists(varIndexPath)) {
m_variables_index = std::make_shared<VariablesIndex>();
std::ifstream vi_stream{varIndexPath, std::ifstream::in | std::ifstream::binary};
std::ifstream vi_stream{varIndexPath.c_str(), std::ifstream::in | std::ifstream::binary};
FRONT_END_GENERAL_CHECK(vi_stream && vi_stream.is_open(),
"Saved Model's variable index file does not exist");
FRONT_END_GENERAL_CHECK(m_variables_index->read_variables(vi_stream, path),

View File

@ -264,8 +264,8 @@ bool VariablesIndex::read_variables(std::ifstream& vi_stream, const std::string&
} else {
fullPath = path + "." + suffix.data();
}
m_data_files[shard] =
std::shared_ptr<std::ifstream>(new std::ifstream(fullPath, std::ifstream::in | std::ifstream::binary));
m_data_files[shard] = std::shared_ptr<std::ifstream>(
new std::ifstream(fullPath.c_str(), std::ifstream::in | std::ifstream::binary));
FRONT_END_GENERAL_CHECK(m_data_files[shard]->is_open(), "Variable index data file does not exist");
}
@ -288,8 +288,8 @@ bool VariablesIndex::read_variables(std::ifstream& vi_stream, const std::wstring
} else {
fullPath = path + L"." + suffix.data();
}
m_data_files[shard] =
std::shared_ptr<std::ifstream>(new std::ifstream(fullPath, std::ifstream::in | std::ifstream::binary));
m_data_files[shard] = std::shared_ptr<std::ifstream>(
new std::ifstream(fullPath.c_str(), std::ifstream::in | std::ifstream::binary));
FRONT_END_GENERAL_CHECK(m_data_files[shard]->is_open(), "Variable index data file does not exist");
}

View File

@ -33,4 +33,4 @@ ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
"${root_dir}/src"
ADDITIONAL_INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:${TARGET_NAME},INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME},INCLUDE_DIRECTORIES>)
$<TARGET_PROPERTY:${TARGET_NAME},INCLUDE_DIRECTORIES>)

View File

@ -35,13 +35,13 @@ public:
*/
SharedObjectLoader() = default;
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Loads a library with the wide char name specified.
* @param pluginName Full or relative path to the plugin library
*/
explicit SharedObjectLoader(const wchar_t* pluginName);
#endif
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Loads a library with the name specified.

View File

@ -14,7 +14,7 @@
# define INFERENCE_ENGINE_API_CPP(...) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __VA_ARGS__
#else
# if defined(_WIN32)
# if defined(_WIN32) || defined(__CYGWIN__)
# ifdef IMPLEMENT_INFERENCE_ENGINE_API
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllexport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllexport) __VA_ARGS__
@ -31,53 +31,53 @@
# endif
#endif
#if defined(_WIN32)
#if defined(__GNUC__)
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ >= 6 || defined(__clang__)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# endif
#elif defined(_MSC_VER)
# define INFERENCE_ENGINE_DEPRECATED(msg) __declspec(deprecated(msg))
# if __cplusplus >= 201402L
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) [[deprecated(msg)]]
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# endif
#elif defined __INTEL_COMPILER
#elif defined(__INTEL_COMPILER)
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
#elif defined(__GNUC__)
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
# if __GNUC__ < 6 && !defined(__clang__)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
# else
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg) INFERENCE_ENGINE_DEPRECATED(msg)
# endif
#else
# define INFERENCE_ENGINE_DEPRECATED(msg)
# define INFERENCE_ENGINE_ENUM_DEPRECATED(msg)
#endif
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
# define IE_DO_PRAGMA(x) __pragma(x)
#elif defined(__GNUC__)
#if defined(__GNUC__)
# define IE_DO_PRAGMA(x) _Pragma(# x)
#elif defined(_MSC_VER)
# define IE_DO_PRAGMA(x) __pragma(x)
#else
# define IE_DO_PRAGMA(x)
#endif
#if defined(_MSC_VER) && !defined(__clang__)
#if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405)) || defined(__clang__)
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(GCC diagnostic push) \
IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
#elif defined(_MSC_VER)
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 4996))
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
#elif defined(__INTEL_COMPILER)
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 1478))
IE_DO_PRAGMA(warning(disable : 1786))
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 1478)) \
IE_DO_PRAGMA(warning(disable : 1786))
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(GCC diagnostic push) \
IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
#else
# define IE_SUPPRESS_DEPRECATED_START
# define IE_SUPPRESS_DEPRECATED_END
@ -92,18 +92,22 @@ IE_DO_PRAGMA(warning(disable : 1786))
# define _IE_SUPPRESS_DEPRECATED_END_GCC
#endif
#ifndef ENABLE_UNICODE_PATH_SUPPORT
#ifndef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
# define ENABLE_UNICODE_PATH_SUPPORT
# if defined(__INTEL_COMPILER) || defined(_MSC_VER) || defined(__GNUC__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__clang__)
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2))
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
#ifdef ENABLE_UNICODE_PATH_SUPPORT
# define OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
# ifndef ENABLE_UNICODE_PATH_SUPPORT
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
#endif
/**
@ -112,7 +116,7 @@ IE_DO_PRAGMA(warning(disable : 1786))
* @param type A plugin type
*/
#if defined(_WIN32) && defined(IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
# define INFERENCE_PLUGIN_API(type) extern "C" __declspec(dllexport) type
#else
# define INFERENCE_PLUGIN_API(type) INFERENCE_ENGINE_API(type)

View File

@ -609,7 +609,7 @@ public:
* @return rvalue for the empty locked object of type T
*/
virtual LockedMemory<T> data() noexcept {
return std::move(lockme<T>());
return lockme<T>();
}
/**
@ -618,7 +618,7 @@ public:
* @return rvalue for the empty locked const object of type T.
*/
virtual LockedMemory<const T> readOnly() const noexcept {
return std::move(lockme<const T>());
return lockme<const T>();
}
void allocate() noexcept override {
@ -639,22 +639,22 @@ public:
}
LockedMemory<void> buffer() noexcept override {
return std::move(lockme<void>());
return lockme<void>();
}
LockedMemory<const void> cbuffer() const noexcept override {
return std::move(lockme<const void>());
return lockme<const void>();
}
LockedMemory<void> rwmap() noexcept override {
return std::move(lockme<void>());
return lockme<void>();
}
LockedMemory<const void> rmap() const noexcept override {
return std::move(lockme<const void>());
return lockme<const void>();
}
LockedMemory<void> wmap() noexcept override {
return std::move(lockme<void>());
return lockme<void>();
}
Blob::Ptr createROI(const ROI& roi) const override {

View File

@ -504,7 +504,8 @@ struct NullStream {
} // namespace details
} // namespace InferenceEngine
#if defined(_WIN32)
#if defined(_WIN32) && !defined(__GNUC__)
# define __PRETTY_FUNCTION__ __FUNCSIG__
#else
# define __PRETTY_FUNCTION__ __PRETTY_FUNCTION__

View File

@ -56,7 +56,7 @@ public:
*/
std::map<std::string, Version> GetVersions(const std::string& deviceName) const;
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Reads models from IR and ONNX formats
* @param modelPath path to model
@ -69,7 +69,7 @@ public:
* @return CNNNetwork
*/
CNNNetwork ReadNetwork(const std::wstring& modelPath, const std::wstring& binPath = {}) const;
#endif
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Reads models from IR and ONNX formats

View File

@ -31,14 +31,14 @@ public:
*/
explicit Extension(const std::string& name);
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Loads extension from a shared library
*
* @param name Full or relative path to extension library
*/
explicit Extension(const std::wstring& name);
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Gets the extension version information
@ -110,7 +110,7 @@ inline std::shared_ptr<T> make_so_pointer(const std::string& name) {
return std::make_shared<Extension>(name);
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
/**
* @brief Creates extension using deprecated API
@ -123,5 +123,6 @@ inline std::shared_ptr<IExtension> make_so_pointer(const std::wstring& name) {
return std::make_shared<Extension>(name);
}
#endif
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
} // namespace InferenceEngine

View File

@ -25,13 +25,13 @@
* @def INFERENCE_EXTENSION_API(TYPE)
* @brief Defines Inference Engine Extension API method
*/
#if defined(_WIN32)
#if defined(_WIN32) || defined(__CYGWIN__)
# if defined(IMPLEMENT_INFERENCE_EXTENSION_API)
# define INFERENCE_EXTENSION_API(type) extern "C" __declspec(dllexport) type
# else
# define INFERENCE_EXTENSION_API(type) extern "C" type
# endif
#elif defined(__GNUC__) && (__GNUC__ >= 4)
#elif defined(__GNUC__) && (__GNUC__ >= 4) || defined(__clang__)
# ifdef IMPLEMENT_INFERENCE_EXTENSION_API
# define INFERENCE_EXTENSION_API(type) extern "C" __attribute__((visibility("default"))) type
# else
@ -220,7 +220,7 @@ INFERENCE_EXTENSION_API(void) CreateExtensionShared(IExtensionPtr& ext);
* @param resp Responce
* @return InferenceEngine::OK if extension is constructed and InferenceEngine::GENERAL_ERROR otherwise
*/
#if defined(_WIN32)
#ifdef _MSC_VER
INFERENCE_ENGINE_DEPRECATED("Use IE_DEFINE_EXTENSION_CREATE_FUNCTION macro")
INFERENCE_EXTENSION_API(StatusCode)
CreateExtension(IExtension*& ext, ResponseDesc* resp) noexcept;

View File

@ -39,6 +39,9 @@
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC system_header
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma system_header
#endif
#ifdef OV_GPU_USE_OPENCL_HPP
@ -49,6 +52,8 @@
#ifdef __GNUC__
# pragma GCC diagnostic pop
#elif defined(_MSC_VER)
# pragma warning(pop)
#endif
/// @endcond

View File

@ -61,7 +61,7 @@ Extension::Extension(const std::string& name) {
_actual = CreateExtensionFromLibrary<IExtension>(_so);
}
#ifdef ENABLE_UNICODE_PATH_SUPPORT
#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
Extension::Extension(const std::wstring& name) {
try {
_so = ov::util::load_shared_object(name.c_str());
@ -70,7 +70,7 @@ Extension::Extension(const std::wstring& name) {
}
_actual = CreateExtensionFromLibrary<IExtension>(_so);
}
#endif // ENABLE_UNICODE_PATH_SUPPORT
#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT
std::map<std::string, ngraph::OpSet> Extension::getOpSets() {
return _actual->getOpSets();

View File

@ -161,7 +161,7 @@ public:
private:
int get_processors_group_num() const {
# if defined(_WIN32) || defined(_WIN64)
# if defined(_WIN32)
SYSTEM_INFO si;
GetNativeSystemInfo(&si);

View File

@ -17,7 +17,7 @@ namespace threading {
#if (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
using cpu_set_t = void;
#endif // (defined(__APPLE__) || defined(_WIN32))
#endif // (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
/**
* @brief Release the cores affinity mask for the current process

View File

@ -32,7 +32,7 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <Windows.h>
# include <windows.h>
#endif
long long FileUtils::fileSize(const char* charfilepath) {

View File

@ -182,7 +182,7 @@ CNNNetwork load_ir_v7_network(const std::string& modelPath,
# endif
// Try to open model file
std::ifstream modelStream(model_path, std::ios::binary);
std::ifstream modelStream(model_path.c_str(), std::ios::binary);
if (!modelStream.is_open())
IE_THROW() << "Model file " << modelPath << " cannot be opened!";
@ -214,7 +214,7 @@ CNNNetwork load_ir_v7_network(const std::string& modelPath,
std::string weights_path = bPath;
# endif
std::ifstream binStream;
binStream.open(weights_path, std::ios::binary);
binStream.open(weights_path.c_str(), std::ios::binary);
if (!binStream.is_open())
IE_THROW() << "Weights file " << bPath << " cannot be opened!";

View File

@ -50,7 +50,7 @@ void parse_processor_info_linux(const int _processors,
std::vector<std::vector<int>>& _cpu_mapping_table);
#endif
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_WIN32)
/**
* @brief Parse processors infomation on Windows
* @param[in] base_ptr buffer object pointer of Windows system infomation

View File

@ -17,7 +17,7 @@
namespace InferenceEngine {
#if (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
using cpu_set_t = ov::threading::cpu_set_t;
#endif // (defined(__APPLE__) || defined(_WIN32))
#endif // (defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(_WIN32))
/**
* @brief Release the cores affinity mask for the current process

View File

@ -586,7 +586,7 @@ INSTANTIATE_TEST_SUITE_P(CPUMap,
_1sockets_6cores_hyperthreading));
#endif
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_WIN32)
int Hex2Int(char c) {
return (c >= '0' && c <= '9')
@ -595,7 +595,7 @@ int Hex2Int(char c) {
}
void Hex2Bin(const char* hex, std::size_t sz, char* out) {
for (int i = 0; i < sz; i += 2) {
for (size_t i = 0; i < sz; i += 2) {
out[i / 2] = (Hex2Int(hex[i]) << 4) | Hex2Int(hex[i + 1]);
}
}
@ -626,7 +626,7 @@ public:
int test_processors = 0;
int test_sockets = 0;
int test_cores = 0;
unsigned long len = unsigned long(test_len / 2);
unsigned long len = (unsigned long)(test_len / 2);
std::vector<std::vector<int>> test_proc_type_table;
std::vector<std::vector<int>> test_cpu_mapping_table;

View File

@ -8,12 +8,6 @@
#include "unit_test_utils/mocks/mock_allocator.hpp"
#ifdef _WIN32
# define UNUSED
#else
# define UNUSED __attribute__((unused))
#endif
class BlobTests : public ::testing::Test {
protected:
std::shared_ptr<MockAllocator> createMockAllocator() {
@ -78,7 +72,10 @@ TEST_F(BlobTests, doesNotUnlockIfLockFailed) {
InferenceEngine::TBlob<float> blob({InferenceEngine::Precision::FP32, v, InferenceEngine::CHW},
std::dynamic_pointer_cast<InferenceEngine::IAllocator>(allocator));
blob.allocate();
{ float UNUSED* ptr = blob.data(); }
{
float* ptr = blob.data();
(void)ptr;
}
}
TEST_F(BlobTests, canAccessDataUsingAllocator) {

View File

@ -14,7 +14,7 @@ namespace TimeUtils {
bool localtimeSafe(const time_t* time, struct tm* result) {
if (time && result) {
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_WIN32)
localtime_s(result, time);
#else
localtime_r(time, result);
@ -32,7 +32,7 @@ std::string putTime(std::chrono::system_clock::time_point tp, const char* format
std::stringstream ss;
#if (defined(__GNUC__) && (__GNUC__ < 5))
#if (defined(__GNUC__) && (__GNUC__ < 5)) && !defined(__clang__)
char time_str[24];
strftime(time_str, sizeof(time_str), format, &t);
ss << time_str;

View File

@ -1,6 +1,9 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <thread>
#include "include/mock_auto_device_plugin.hpp"
#include "include/auto_infer_request_test_base.hpp"

View File

@ -1,6 +1,9 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <thread>
#include "include/mock_auto_device_plugin.hpp"
#include "include/auto_infer_request_test_base.hpp"

View File

@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <thread>
#include "include/auto_infer_request_test_base.hpp"
mockAsyncInferRequest::mockAsyncInferRequest(const InferenceEngine::IInferRequestInternal::Ptr &inferRequest,

View File

@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <thread>
#include <gtest/gtest.h>
#include <gmock/gmock.h>

View File

@ -11,7 +11,7 @@ using ::testing::_;
using namespace MockMultiDevice;
// disable using windows.h
#if 0
#if (defined(_WIN32) || defined(_WIN64))
#if defined(_WIN32)
#include <windows.h>
#elif defined(__linux__)
#include <stdlib.h>

View File

@ -13,8 +13,8 @@
namespace ov {
namespace intel_cpu {
DISABLE_WARNING_MSVC_BEGIN(4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
OPENVINO_DISABLE_WARNING_MSVC_BEGIN(4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
class DnnlBlockedMemoryDesc : public BlockedMemoryDesc, public DnnlMemoryDesc {
public:
// Creates planar DnnlBlockedMemoryDesc
@ -100,7 +100,7 @@ private:
friend std::shared_ptr<DnnlBlockedMemoryDesc> DnnlExtensionUtils::makeUndefinedDesc(const dnnl::memory::desc &desc, const Shape& shape);
friend class MemoryDescUtils;
};
DISABLE_WARNING_MSVC_END(4250)
OPENVINO_DISABLE_WARNING_MSVC_END(4250)
using DnnlBlockedMemoryDescPtr = std::shared_ptr<DnnlBlockedMemoryDesc>;
using DnnlBlockedMemoryDescCPtr = std::shared_ptr<const DnnlBlockedMemoryDesc>;

View File

@ -11,23 +11,3 @@
# include <x86intrin.h>
# endif
#endif
#ifdef _WIN32
# if defined (__INTEL_COMPILER)
# define DLSDK_EXT_IVDEP() __pragma(ivdep)
# elif defined(_MSC_VER)
# define DLSDK_EXT_IVDEP() __pragma(loop(ivdep))
# else
# define DLSDK_EXT_IVDEP()
# endif
#elif defined(__linux__)
# if defined(__INTEL_COMPILER)
# define DLSDK_EXT_IVDEP() _Pragma("ivdep")
# elif defined(__GNUC__)
# define DLSDK_EXT_IVDEP() _Pragma("GCC ivdep")
# else
# define DLSDK_EXT_IVDEP()
# endif
#else
# define DLSDK_EXT_IVDEP()
#endif

View File

@ -215,7 +215,7 @@ std::vector<std::string> disabledTestPatterns() {
retVector.emplace_back(R"(smoke_Snippets.*)");
#endif
#if defined(_WIN32) || defined(_WIN64)
#if defined(_WIN32)
retVector.emplace_back(R"(.*LoadNetworkCompiledKernelsCacheTest.*CanCreateCacheDirAndDumpBinariesUnicodePath.*)");
#endif

View File

@ -74,7 +74,11 @@ else()
message(STATUS "Configure to build ${ARM_COMPUTE_SOURCE_DIR}")
find_host_program(SCONS scons)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
list(APPEND find_scons_extra_options REQUIRED)
endif()
find_host_program(SCONS scons ${find_scons_extra_options})
if(NOT SCONS)
message(FATAL_ERROR "Scons tool is not found!")
@ -194,7 +198,9 @@ else()
set(extra_link_flags "${extra_link_flags} ${extra_flags}")
set(extra_cxx_flags "${extra_cxx_flags} ${extra_flags}")
elseif(CMAKE_CROSSCOMPILING AND LINUX)
elseif(LINUX)
# we need to bypass this information in case of custom compiler is passed
# to cmake call. Such compiler and compiler prefix need to be passed to scons
get_filename_component(cxx_compiler "${CMAKE_CXX_COMPILER}" NAME)
get_filename_component(c_compiler "${CMAKE_C_COMPILER}" NAME)
get_filename_component(compiler_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY)
@ -258,7 +264,7 @@ else()
endif()
if(ENABLE_LTO)
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND (NOT CMAKE_CROSSCOMPILING))
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND NOT CMAKE_CROSSCOMPILING)
set(extra_cxx_flags "${extra_cxx_flags} -flto=thin")
set(extra_link_flags "${extra_link_flags} -flto=thin")
endif()
@ -300,6 +306,10 @@ else()
${ARM_COMPUTE_SOURCE_DIR}/SConscript
${ARM_COMPUTE_SOURCE_DIR}/SConstruct)
# Compute Library uses cppthreads=1
# if one day will rely on TBB only, we can omit this dependency
find_package(Threads REQUIRED)
# Import targets
add_custom_target(arm_compute_static_libs DEPENDS ${arm_compute_full_path})
@ -307,18 +317,15 @@ else()
add_library(arm_compute::arm_compute STATIC IMPORTED GLOBAL)
set_target_properties(arm_compute::arm_compute PROPERTIES
IMPORTED_LOCATION ${arm_compute_full_path}
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_SOURCE_DIR})
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_SOURCE_DIR}
INTERFACE_LINK_LIBRARIES Threads::Threads
OSX_ARCHITECTURES arm64)
add_dependencies(arm_compute::arm_compute arm_compute_static_libs)
add_library(arm_compute::half INTERFACE IMPORTED GLOBAL)
set_target_properties(arm_compute::half PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_SOURCE_DIR}/include)
# Compute Library uses cppthreads=1
# if one day will rely on TBB only, we can omit this dependency
find_package(Threads REQUIRED)
set_target_properties(arm_compute::arm_compute PROPERTIES
INTERFACE_LINK_LIBRARIES Threads::Threads)
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_SOURCE_DIR}/include
OSX_ARCHITECTURES arm64)
# Helpers for oneDNN intergation

View File

@ -24,7 +24,7 @@
#include "ie_common.h"
#include "ie_data.h"
#ifdef _WIN32
#ifdef _MSC_VER
# define _IE_SUPPRESS_DEPRECATED_START_MSVC IE_SUPPRESS_DEPRECATED_START
# define _IE_SUPPRESS_DEPRECATED_END_MSVC IE_SUPPRESS_DEPRECATED_END
#else

View File

@ -84,13 +84,6 @@ using namespace ov::intel_gna::memory;
using namespace ov::intel_gna::frontend;
using namespace ov::intel_gna::pre_post_processing;
namespace InferenceEngine {
template <>
InferenceEngine::TBlob<gna_compound_bias_t, std::enable_if<true, void>>::~TBlob() {
free();
}
} // namespace InferenceEngine
template <typename T, typename U>
void GNAPlugin::copyInputData(T* dst,
const U* src,

View File

@ -26,7 +26,7 @@
#ifdef __PRETTY_FUNCTION__
# undef __PRETTY_FUNCTION__
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(__GNUC__)
# define __PRETTY_FUNCTION__ __FUNCSIG__
#else
# define __PRETTY_FUNCTION__ __FUNCTION__

View File

@ -19,9 +19,9 @@
# ifndef _WINSOCK2API_
# define _WINSOCK2API_
# endif
# include <WinSock2.h>
# include <Windows.h>
# include "Psapi.h"
# include <winsock2.h>
# include <windows.h>
# include "psapi.h"
#endif
static size_t parseLine(char* line) {

View File

@ -5,7 +5,9 @@
#pragma once
// avoiding clash of the "max" macro with std::max
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <algorithm>
#include <cmath>

View File

@ -79,7 +79,7 @@ void readAllFile(const std::string& string_file_name, void* buffer, size_t maxSi
std::string file_name = string_file_name;
#endif
inputFile.open(file_name, std::ios::binary | std::ios::in);
inputFile.open(file_name.c_str(), std::ios::binary | std::ios::in);
if (!inputFile.is_open())
IE_THROW() << "cannot open file " << string_file_name;
if (!inputFile.read(reinterpret_cast<char*>(buffer), maxSize)) {

View File

@ -8,7 +8,7 @@
#include <gna2-inference-api.h>
#include <gna2-model-export-api.h>
#if defined(_WIN32)
#if defined(_WIN32) || defined(__CYGWIN__)
#ifdef libGNAStubs_EXPORTS
#define GNA_STUBS_EXPORT __declspec(dllexport)
#else

View File

@ -3,6 +3,8 @@
//
#pragma once
#include <cstdint>
#include <utility>
#include <type_traits>

View File

@ -42,7 +42,7 @@ enum class LogLevel : int8_t {
} // namespace ov
#ifdef GPU_DEBUG_CONFIG
#if defined(_WIN32) || defined(_WIN64)
#if defined(_WIN32)
#define SEPARATE '\\'
#else
#define SEPARATE '/'

View File

@ -4,6 +4,7 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <tuple>

View File

@ -8,6 +8,7 @@
#include <memory>
#include <vector>
#include <string>
#include <fstream>
#if defined(_WIN32)
#ifndef NOMINMAX
@ -18,9 +19,7 @@
#endif
#include <windows.h>
#include "Psapi.h"
#elif !defined(__APPLE__) && !defined(__MACOSX)
#include <fstream>
#include "psapi.h"
#endif
#include "layout.hpp"
@ -235,7 +234,7 @@ private:
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
footprint.rss = (int64_t)(pmc.WorkingSetSize/1024);
footprint.peak_rss = (int64_t)(pmc.PeakWorkingSetSize/1024);
#elif !defined(__APPLE__) && !defined(__MACOSX)
#elif !defined(__APPLE__)
std::ifstream status("/proc/self/status");
if (!status.is_open())
return footprint;

View File

@ -16,10 +16,14 @@
#include <tuple>
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#include <SetupAPI.h>
#include <setupapi.h>
#include <devguid.h>
#include <cstring>
#else
@ -195,12 +199,14 @@ TuningCache* TuningCache::get() {
GetModuleFileName(hm, module_path, sizeof(module_path));
std::string bin_path(module_path);
path = bin_path.substr(0, bin_path.find_last_of("\\")) + "\\cache.json";
#else
#elif __linux__
const char* device_info_failed_msg = "Device lookup failed";
Dl_info dl_info;
dladdr((void*)(device_info_failed_msg), &dl_info); // NOLINT
std::string bin_path(dl_info.dli_fname);
path = bin_path.substr(0, bin_path.find_last_of("/")) + "/cache.json";
#else
#error "Intel GPU plugin: unknown target system"
#endif
if (!cache_instance) {

View File

@ -245,6 +245,8 @@ void CustomLayer::LoadFromFile(const std::string configFile, CustomLayerMap& cus
#elif __linux__
char path[PATH_MAX];
char* abs_path_ptr = realpath(configFile.c_str(), path);
#else
#error "Intel GPU plugin: unknown target system"
#endif
if (abs_path_ptr == nullptr) {
IE_THROW() << "Error loading custom layer configuration file: " << configFile << ", "

View File

@ -148,6 +148,8 @@ Program::Program(InferenceEngine::CNNNetwork& network, cldnn::engine& engine, co
Dl_info dl_info;
dladdr(reinterpret_cast<void *>(CustomLayer::LoadFromFile), &dl_info);
const char* mpath = dl_info.dli_fname;
#else
#error "Intel GPU plugin: unknown target system"
#endif
std::string configFile(mpath);
std::size_t dir_split_pos = configFile.find_last_of("/\\");

View File

@ -18,7 +18,7 @@
#include <stdexcept>
#include <algorithm>
#if defined(_WIN32) && !defined(__GNUC__)
#if defined(_WIN32)
#include <windows.h>
static size_t get_cpu_ram_size() {

View File

@ -21,9 +21,11 @@
#include <utility>
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <SetupAPI.h>
#include <setupapi.h>
#include <devguid.h>
#include <cstring>
#else

View File

@ -19,7 +19,9 @@
#include <CL/cl_ext.h>
#ifdef _WIN32
# define NOMINMAX
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <CL/cl_d3d11.h>
typedef cl_d3d11_device_source_khr cl_device_source_intel;
typedef cl_d3d11_device_set_khr cl_device_set_intel;

View File

@ -10,8 +10,8 @@
#include <memory>
#include <list>
DISABLE_WARNING_MSVC_BEGIN(4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
OPENVINO_DISABLE_WARNING_MSVC_BEGIN(4250) // Visual Studio warns us about inheritance via dominance but it's done intentionally
// so turn it off
namespace cldnn {
namespace ocl {
@ -41,7 +41,7 @@ private:
bool is_set_impl() override;
};
DISABLE_WARNING_MSVC_END(4250)
OPENVINO_DISABLE_WARNING_MSVC_END(4250)
} // namespace ocl
} // namespace cldnn

View File

@ -110,7 +110,7 @@ std::vector<std::string> disabledTestPatterns() {
// TODO: range input with one element should NOT be regarded as dynamic batch model in Program::IsDynBatchModel().
R"(.*smoke_select_CompareWithRefsNumpy_dynamic_range.*)",
R"(.*CachingSupportCase.*LoadNetworkCacheTestBase.*CompareWithRefImpl.*)",
#if defined(_WIN32) || defined(_WIN64)
#if defined(_WIN32)
R"(.*KernelCachingSupportCase.*CanCreateCacheDirAndDumpBinariesUnicodePath.*)",
#endif
R"(.*CachingSupportCase.*GPU.*CompileModelCacheTestBase.*CompareWithRefImpl.*)",

View File

@ -17,7 +17,7 @@
#include <sstream>
#include <iomanip>
#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning( disable : 4503 )
#endif

View File

@ -15,7 +15,7 @@
#include <sstream>
#include <iomanip>
#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(disable: 4503)
#endif

View File

@ -10,7 +10,7 @@
using namespace reference_tests;
using namespace ov;
#ifdef _WIN32
#ifdef _MSC_VER
# pragma warning(disable : 4756)
#endif

Some files were not shown because too many files have changed in this diff Show More