Build using conanfile.txt (#17580)

* Build using conanfile.txt

* Update .ci/azure/linux_arm64.yml

* Several improvements

* Removed conanfile.py

* Try to use activate / deactivate

* Fixed clang-format code style

* Supported TBB version from Conan

* Added more NOMINMAX

* Fixed static build

* More improvements for static build

* Add usage of static snappy in case of static build

* More fixes

* Small fixes

* Final fixes
This commit is contained in:
Ilya Lavrenov 2023-05-19 14:01:39 +04:00 committed by GitHub
parent 54bbc9e603
commit 84db7d0ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
72 changed files with 1261 additions and 729 deletions

View File

@ -141,7 +141,6 @@ jobs:
-DANDROID_STL=c++_shared
-DANDROID_PLATFORM=$(ANDROID_SDK_VERSION)
-DENABLE_TESTS=ON
-DENABLE_INTEL_GPU=ON
-DCMAKE_CXX_LINKER_LAUNCHER=ccache
-DCMAKE_C_LINKER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache

View File

@ -245,6 +245,7 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_COMPILER=clang
-DENABLE_SYSTEM_SNAPPY=ON
-DENABLE_SYSTEM_TBB=ON
-DCPACK_GENERATOR=$(CMAKE_CPACK_GENERATOR)
-DBUILD_nvidia_plugin=OFF
-S $(REPO_DIR)

View File

@ -108,17 +108,17 @@ jobs:
- checkout: self
clean: 'true'
submodules: 'true'
path: openvino
- script: |
set -e
sudo -E $(OPENVINO_REPO_DIR)/install_build_dependencies.sh
python3 -m pip install --upgrade pip
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/requirements.txt
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/wheel/requirements-dev.txt
# install dependencies needed to build CPU plugin for ARM
sudo -E apt --assume-yes install scons crossbuild-essential-arm64
# generic dependencies
sudo -E apt --assume-yes install cmake ccache
# Speed up build
sudo -E apt -y --no-install-recommends install unzip
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
@ -126,26 +126,60 @@ jobs:
sudo cp -v ninja /usr/local/bin/
displayName: 'Install dependencies'
- task: CMake@1
inputs:
cmakeArgs: >
-G "Ninja Multi-Config"
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
-DOpenCV_DIR=$(INSTALL_OPENCV)/cmake
-DENABLE_CPPLINT=ON
-DENABLE_PYTHON=OFF
-DENABLE_TESTS=ON
-DENABLE_DATA=OFF
-DCMAKE_TOOLCHAIN_FILE=$(OPENVINO_REPO_DIR)/cmake/arm64.toolchain.cmake
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DARM_COMPUTE_SCONS_JOBS=$(NUM_PROC)
-DCMAKE_INSTALL_PREFIX=$(INSTALL_OPENVINO)
-S $(OPENVINO_REPO_DIR)
- script: |
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/gtest
displayName: 'Init submodules for non Conan dependencies'
- script: |
python3 -m pip install conan
# generate build profile
conan profile detect
# generate host profile for linux_arm64
echo "include(default)" > $(BUILD_OPENVINO)/linux_arm64
echo "[buildenv]" >> $(BUILD_OPENVINO)/linux_arm64
echo "CC=aarch64-linux-gnu-gcc" >> $(BUILD_OPENVINO)/linux_arm64
echo "CXX=aarch64-linux-gnu-g++" >> $(BUILD_OPENVINO)/linux_arm64
# install OpenVINO dependencies
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export CMAKE_C_COMPILER_LAUNCHER=ccache
conan install $(OPENVINO_REPO_DIR)/conanfile.txt \
-pr:h $(BUILD_OPENVINO)/linux_arm64 \
-s:h arch=armv8 \
-of $(BUILD_OPENVINO) \
-b missing
env:
CCACHE_DIR: $(OPENVINO_CCACHE_DIR)
CCACHE_TEMPDIR: $(TMP_DIR)/ccache
CCACHE_BASEDIR: $(Pipeline.Workspace)
CCACHE_MAXSIZE: 50G
displayName: 'Install conan and dependencies'
- script: |
source $(BUILD_OPENVINO)/conanbuild.sh
cmake \
-G Ninja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
-DENABLE_CPPLINT=OFF \
-DENABLE_PYTHON=OFF \
-DENABLE_TESTS=ON \
-DENABLE_DATA=OFF \
-DENABLE_SYSTEM_TBB=ON \
-DENABLE_SYSTEM_PROTOBUF=ON \
-DENABLE_SYSTEM_SNAPPY=ON \
-DENABLE_SYSTEM_PUGIXML=ON \
-DCMAKE_TOOLCHAIN_FILE=$(BUILD_OPENVINO)/conan_toolchain.cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DARM_COMPUTE_SCONS_JOBS=$(NUM_PROC) \
-DCMAKE_INSTALL_PREFIX=$(INSTALL_OPENVINO) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-S $(OPENVINO_REPO_DIR) \
-B $(BUILD_OPENVINO)
displayName: 'CMake OpenVINO ARM plugin'
source $(BUILD_OPENVINO)/deactivate_conanbuild.sh
displayName: 'CMake configure'
- script: cmake --build $(BUILD_OPENVINO) --parallel --config $(BUILD_TYPE)
env:
@ -153,13 +187,13 @@ jobs:
CCACHE_TEMPDIR: $(TMP_DIR)/ccache
CCACHE_BASEDIR: $(Pipeline.Workspace)
CCACHE_MAXSIZE: 50G
displayName: 'Build OpenVINO ARM plugin'
displayName: 'Build OpenVINO Runtime'
- script: cmake --build $(BUILD_OPENVINO) --parallel --config $(BUILD_TYPE) --target install
displayName: 'Install OpenVINO ARM plugin'
displayName: 'Install OpenVINO Runtime'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: 'openvino_aarch64_linux'
displayName: 'Publish OpenVINO AArch64 linux package'
displayName: 'Publish OpenVINO Runtime for ARM'

View File

@ -117,7 +117,6 @@ jobs:
-DENABLE_CPPLINT=OFF ^
-DENABLE_GAPI_PREPROCESSING=OFF ^
-DENABLE_PLUGINS_XML=ON ^
-DENABLE_FASTER_BUILD=ON ^
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON ^
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ^
-DENABLE_PROFILING_ITT=ON ^
@ -154,7 +153,6 @@ jobs:
-DVERBOSE_BUILD=ON ^
-DENABLE_CPPLINT=OFF ^
-DENABLE_GAPI_PREPROCESSING=OFF ^
-DENABLE_FASTER_BUILD=ON ^
-DENABLE_PROFILING_ITT=OFF ^
-DSELECTIVE_BUILD=ON ^
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON ^

1
.gitignore vendored
View File

@ -26,6 +26,7 @@ temp/
.repo/
CMakeLists.txt.user
docs/IE_PLUGIN_DG/html/
CMakeUserPresets.json
*.project
*.cproject

View File

@ -111,8 +111,8 @@ else()
set(BIN_FOLDER "bin/${ARCH_FOLDER}")
endif()
if(CMAKE_GENERATOR MATCHES "^Ninja Multi-Config$")
# Ninja-Multi specific, see:
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
# 'Ninja Multi-Config' specific, see:
# https://cmake.org/cmake/help/latest/variable/CMAKE_DEFAULT_BUILD_TYPE.html
set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "CMake default build type")
elseif(NOT OV_GENERATOR_MULTI_CONFIG)
@ -240,7 +240,7 @@ if(ENABLE_LTO)
LANGUAGES C CXX)
if(NOT IPO_SUPPORTED)
set(ENABLE_LTO "OFF" CACHE STRING "Enable Link Time Optmization" FORCE)
set(ENABLE_LTO "OFF" CACHE STRING "Enable Link Time Optimization" FORCE)
message(WARNING "IPO / LTO is not supported: ${OUTPUT_MESSAGE}")
endif()
endif()
@ -250,8 +250,8 @@ endif()
macro(ov_install_static_lib target comp)
if(NOT BUILD_SHARED_LIBS)
get_target_property(target_type ${target} TYPE)
if(${target_type} STREQUAL "STATIC_LIBRARY")
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL FALSE)
if(target_type STREQUAL "STATIC_LIBRARY")
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL OFF)
endif()
install(TARGETS ${target} EXPORT OpenVINOTargets
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${comp} ${ARGN})

View File

@ -641,7 +641,7 @@ _repository = None
# Files to exclude from linting. This is set by the --exclude flag.
_excludes = None
# Whether to supress PrintInfo messages
# Whether to suppress PrintInfo messages
_quiet = False
# The allowed line length of files.
@ -752,7 +752,7 @@ def ParseNolintSuppressions(filename, raw_line, linenum, error):
'Unknown NOLINT error category: %s' % category)
def ProcessGlobalSuppresions(lines):
def ProcessGlobalSuppressions(lines):
"""Updates the list of global error suppressions.
Parses any lint directives in the file that have global effect.
@ -780,7 +780,7 @@ def IsErrorSuppressedByNolint(category, linenum):
"""Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.
ParseNolintSuppressions/ProcessGlobalSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
@ -6203,7 +6203,7 @@ def ProcessFileData(filename, file_extension, lines, error,
ResetNolintSuppressions()
CheckForCopyright(filename, lines, error)
ProcessGlobalSuppresions(lines)
ProcessGlobalSuppressions(lines)
RemoveMultiLineComments(filename, lines, error)
clean_lines = CleansedLines(lines)

View File

@ -215,23 +215,34 @@ macro(ov_add_frontend)
if(proto_files)
if(OV_FRONTEND_PROTOBUF_LITE)
if(NOT protobuf_lite_installed)
ov_install_static_lib(${Protobuf_LITE_LIBRARIES} ${OV_CPACK_COMP_CORE})
set(protobuf_lite_installed ON CACHE INTERNAL "" FORCE)
endif()
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES})
set(protobuf_target_name libprotobuf-lite)
set(protobuf_install_name "protobuf_lite_installed")
else()
if(NOT protobuf_installed)
ov_install_static_lib(${Protobuf_LIBRARIES} ${OV_CPACK_COMP_CORE})
set(protobuf_installed ON CACHE INTERNAL "" FORCE)
endif()
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LIBRARIES})
set(protobuf_target_name libprotobuf)
set(protobuf_install_name "protobuf_installed")
endif()
if(ENABLE_SYSTEM_PROTOBUF)
# use imported target name with namespace
set(protobuf_target_name "protobuf::${protobuf_target_name}")
endif()
link_system_libraries(${TARGET_NAME} PRIVATE ${protobuf_target_name})
# protobuf generated code emits -Wsuggest-override error
if(SUGGEST_OVERRIDE_SUPPORTED)
target_compile_options(${TARGET_NAME} PRIVATE -Wno-suggest-override)
endif()
# install protobuf if it is not installed yet
if(NOT ${protobuf_install_name})
if(ENABLE_SYSTEM_PROTOBUF)
# we have to add find_package(Protobuf) to the OpenVINOConfig.cmake for static build
# no needs to install protobuf
else()
ov_install_static_lib(${protobuf_target_name} ${OV_CPACK_COMP_CORE})
set("${protobuf_install_name}" ON CACHE INTERNAL "" FORCE)
endif()
endif()
endif()
if(flatbuffers_schema_files)

View File

@ -25,7 +25,7 @@ macro(ov_common_libraries_cpack_set_dirs)
set(OV_CPACK_IE_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/inferenceengine${OpenVINO_VERSION})
set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/openvino${OpenVINO_VERSION})
set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION})
set(OV_CPACK_LICENSESDIR licenses)
ov_get_pyversion(pyversion)
if(pyversion)

View File

@ -31,6 +31,7 @@ macro(ov_debian_cpack_set_dirs)
set(OV_CPACK_NGRAPH_CMAKEDIR ${OV_CPACK_RUNTIMEDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${OV_CPACK_RUNTIMEDIR}/cmake/openvino${OpenVINO_VERSION})
set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION})
set(OV_CPACK_LICENSESDIR ${OV_CPACK_DOCDIR}/licenses)
set(OV_CPACK_PYTHONDIR lib/python3/dist-packages)
# non-native stuff

View File

@ -29,6 +29,7 @@ macro(ov_cpack_set_dirs)
set(OV_CPACK_NGRAPH_CMAKEDIR runtime/cmake)
set(OV_CPACK_OPENVINO_CMAKEDIR runtime/cmake)
set(OV_CPACK_DOCDIR docs)
set(OV_CPACK_LICENSESDIR ${OV_CPACK_DOCDIR}/licenses)
set(OV_CPACK_SAMPLESDIR samples)
set(OV_CPACK_WHEELSDIR tools)
set(OV_CPACK_TOOLSDIR tools)
@ -99,10 +100,10 @@ endif()
# if <FILE> is a symlink, we resolve it, but install file with a name of symlink
#
function(ov_install_with_name file component)
if((APPLE AND file MATCHES "^[^\.]+\.[0-9]+${CMAKE_SHARED_LIBRARY_SUFFIX}$") OR
(file MATCHES "^.*\.${CMAKE_SHARED_LIBRARY_SUFFIX}\.[0-9]+$"))
get_filename_component(actual_name "${file}" NAME)
if((APPLE AND actual_name MATCHES "^[^\.]+\.[0-9]+${CMAKE_SHARED_LIBRARY_SUFFIX}$") OR
(actual_name MATCHES "^.*\.${CMAKE_SHARED_LIBRARY_SUFFIX}\.[0-9]+$"))
if(IS_SYMLINK "${file}")
get_filename_component(actual_name "${file}" NAME)
get_filename_component(file "${file}" REALPATH)
set(install_rename RENAME "${actual_name}")
endif()
@ -162,7 +163,7 @@ elseif(CPACK_GENERATOR STREQUAL "RPM")
include(packaging/rpm/rpm)
elseif(CPACK_GENERATOR STREQUAL "NSIS")
include(packaging/nsis)
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW)$")
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW|CONAN)$")
include(packaging/common-libraries)
endif()

View File

@ -22,6 +22,11 @@ macro(ov_rpm_cpack_set_dirs)
set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/openvino${OpenVINO_VERSION})
set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION})
set(OV_CPACK_LICENSESDIR ${OV_CPACK_DOCDIR}/licenses)
# TODO:
# 1. define python installation directories for RPM packages
# 2. make sure only a single version of python API can be installed at the same time (define conflicts section)
# set(OV_CPACK_PYTHONDIR lib/python3/dist-packages)
ov_get_pyversion(pyversion)

View File

@ -43,9 +43,9 @@ macro(_ov_detect_arch_by_processor_type)
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*|wasm")
set(X86 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*)")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*|armv8)")
set(AARCH64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(ARM ON)

View File

@ -34,6 +34,10 @@ endif()
ie_dependent_option (ENABLE_ONEDNN_FOR_GPU "Enable oneDNN with GPU support" ${ENABLE_ONEDNN_FOR_GPU_DEFAULT} "ENABLE_INTEL_GPU" OFF)
ie_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
ie_dependent_option (ENABLE_GPU_DEBUG_CAPS "enable GPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_CPU" OFF)
ie_dependent_option (ENABLE_CPU_DEBUG_CAPS "enable CPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_GPU" OFF)
ie_option (ENABLE_PROFILING_ITT "Build with ITT tracing. Optionally configure pre-built ittnotify library though INTEL_VTUNE_DIR variable." OFF)
ie_option_enum(ENABLE_PROFILING_FILTER "Enable or disable ITT counter groups.\
@ -81,19 +85,16 @@ ie_dependent_option (ENABLE_TBBBIND_2_5 "Enable TBBBind_2_5 static usage in Open
ie_dependent_option (ENABLE_INTEL_GNA "GNA support for OpenVINO Runtime" ON
"NOT APPLE;NOT ANDROID;X86_64;CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.4" OFF)
ie_option (ENABLE_INTEL_GNA_DEBUG "GNA debug build" OFF)
ie_dependent_option (ENABLE_INTEL_GNA_DEBUG "GNA debug build" OFF "ENABLE_INTEL_GNA" OFF)
ie_dependent_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF "ENABLE_INTEL_GNA" OFF)
ie_dependent_option (ENABLE_IR_V7_READER "Enables IR v7 reader" ${BUILD_SHARED_LIBS} "ENABLE_TESTS;ENABLE_INTEL_GNA" OFF)
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)
ie_option (ENABLE_AUTO_BATCH "Enables Auto-Batching Plugin" ON)
ie_option (ENABLE_HETERO "Enables Hetero Device Plugin" ON)
ie_option (ENABLE_TEMPLATE "Enable template plugin" ON)
ie_dependent_option (ENABLE_PLUGINS_XML "Generate plugins.xml configuration file or not" OFF "BUILD_SHARED_LIBS" OFF)
@ -102,20 +103,27 @@ ie_dependent_option (GAPI_TEST_PERF "if GAPI unit tests should examine performan
ie_dependent_option (ENABLE_DATA "fetch models from testdata repo" ON "ENABLE_FUNCTIONAL_TESTS;NOT ANDROID" OFF)
ie_dependent_option (ENABLE_BEH_TESTS "tests oriented to check OpenVINO Runtime API correctness" ON "ENABLE_TESTS" OFF)
ie_dependent_option (ENABLE_FUNCTIONAL_TESTS "functional tests" ON "ENABLE_TESTS" OFF)
ie_option (ENABLE_SAMPLES "console samples are part of OpenVINO Runtime package" ON)
ie_option (ENABLE_OPENCV "enables custom OpenCV download" OFF)
ie_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF)
set(OPENVINO_EXTRA_MODULES "" CACHE STRING "Extra paths for extra modules to include into OpenVINO build")
ie_dependent_option(ENABLE_TBB_RELEASE_ONLY "Only Release TBB libraries are linked to the OpenVINO Runtime binaries" ON "THREADING MATCHES TBB;LINUX" OFF)
find_host_package(PythonInterp 3 QUIET)
ie_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ${PYTHONINTERP_FOUND})
ie_option(ENABLE_OV_PADDLE_FRONTEND "Enable PaddlePaddle FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_option(ENABLE_OV_PYTORCH_FRONTEND "Enable PyTorch FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_option(ENABLE_OV_TF_FRONTEND "Enable TensorFlow FrontEnd" ON)
ie_option(ENABLE_OV_TF_LITE_FRONTEND "Enable TensorFlow Lite FrontEnd" ON)
ie_dependent_option(ENABLE_SNAPPY_COMPRESSION "Enables compression support for TF FE" ON
"ENABLE_OV_TF_FRONTEND" ON)
if(CMAKE_HOST_LINUX AND LINUX)
# Debian packages are enabled on Ubuntu systems
# so, system TBB / pugixml / OpenCL can be tried for usage
@ -131,40 +139,37 @@ else()
set(ENABLE_SYSTEM_TBB_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
endif()
if(BUILD_SHARED_LIBS)
set(ENABLE_SYSTEM_PUGIXML_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
else()
# for static libraries case libpugixml.a must be compiled with -fPIC
# but we still need an ability to compile with system PugiXML and BUILD_SHARED_LIBS
# for Conan case where everything is compiled statically
set(ENABLE_SYSTEM_PUGIXML_DEFAULT OFF)
endif()
# users wants to use his own TBB version, specific either via env vars or cmake options
if(DEFINED ENV{TBBROOT} OR DEFINED ENV{TBB_DIR} OR DEFINED TBB_DIR OR DEFINED TBBROOT)
set(ENABLE_SYSTEM_TBB_DEFAULT OFF)
endif()
# for static libraries case libpugixml.a must be compiled with -fPIC
ie_dependent_option (ENABLE_SYSTEM_PUGIXML "use the system copy of pugixml" ${ENABLE_SYSTEM_LIBS_DEFAULT} "BUILD_SHARED_LIBS" OFF)
ie_dependent_option (ENABLE_SYSTEM_TBB "use the system version of TBB" ${ENABLE_SYSTEM_TBB_DEFAULT} "THREADING MATCHES TBB" OFF)
ie_dependent_option (ENABLE_SYSTEM_OPENCL "Use the system version of OpenCL" ${ENABLE_SYSTEM_LIBS_DEFAULT} "BUILD_SHARED_LIBS;ENABLE_INTEL_GPU" OFF)
ie_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
ie_dependent_option (ENABLE_GPU_DEBUG_CAPS "enable GPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS" OFF)
ie_dependent_option (ENABLE_CPU_DEBUG_CAPS "enable CPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS" OFF)
find_host_package(PythonInterp 3 QUIET)
ie_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ${PYTHONINTERP_FOUND})
ie_option(ENABLE_OV_PADDLE_FRONTEND "Enable PaddlePaddle FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_option(ENABLE_OV_PYTORCH_FRONTEND "Enable PyTorch FrontEnd" ON)
ie_option(ENABLE_OV_TF_FRONTEND "Enable TensorFlow FrontEnd" ON)
ie_option(ENABLE_OV_TF_LITE_FRONTEND "Enable TensorFlow Lite FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_dependent_option(ENABLE_SNAPPY_COMPRESSION "Enables compression support for TF FE" ON
"ENABLE_OV_TF_FRONTEND" ON)
ie_dependent_option(ENABLE_SYSTEM_PROTOBUF "Enables use of system protobuf" OFF
"ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_TF_FRONTEND;BUILD_SHARED_LIBS" OFF)
ie_dependent_option (ENABLE_SYSTEM_TBB "Enables use of system TBB" ${ENABLE_SYSTEM_TBB_DEFAULT}
"THREADING MATCHES TBB" OFF)
# TODO: turn it off by default during the work on cross-os distribution, because pugixml is not
# available out of box on all systems (like RHEL, UBI)
ie_option (ENABLE_SYSTEM_PUGIXML "Enables use of system PugiXML" ${ENABLE_SYSTEM_PUGIXML_DEFAULT})
# the option is on by default, because we use only flatc compiler and don't use any libraries
ie_dependent_option(ENABLE_SYSTEM_FLATBUFFERS "Enables use of system flatbuffers" ON
"ENABLE_OV_TF_LITE_FRONTEND" OFF)
ie_dependent_option(ENABLE_SYSTEM_SNAPPY "Enables use of system version of snappy" OFF "ENABLE_SNAPPY_COMPRESSION;BUILD_SHARED_LIBS" OFF)
ie_dependent_option (ENABLE_SYSTEM_OPENCL "Enables use of system OpenCL" ${ENABLE_SYSTEM_LIBS_DEFAULT}
"ENABLE_INTEL_GPU" OFF)
# the option is turned off by default, because we compile our own static version of protobuf
# with LTO and -fPIC options, while system one does not have such flags
ie_dependent_option (ENABLE_SYSTEM_PROTOBUF "Enables use of system Protobuf" OFF
"ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_TF_FRONTEND" OFF)
# the option is turned off by default, because we don't want to have a dependency on libsnappy.so
ie_dependent_option (ENABLE_SYSTEM_SNAPPY "Enables use of system version of Snappy" OFF
"ENABLE_SNAPPY_COMPRESSION" OFF)
ie_option(ENABLE_OPENVINO_DEBUG "Enable output for OPENVINO_DEBUG statements" OFF)

View File

@ -10,8 +10,8 @@ macro(ov_cpack_settings)
set(cpack_components_all ${CPACK_COMPONENTS_ALL})
unset(CPACK_COMPONENTS_ALL)
foreach(item IN LISTS cpack_components_all)
# filter out some components, which are not needed to be wrapped to conda-forge | brew
if(# python is not a part of conda | brew
# filter out some components, which are not needed to be wrapped to conda-forge | brew | conan
if(# python is not a part of conda | brew | conan
NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO}_python.*" AND
# python wheels are not needed to be wrapped by conda | brew packages
NOT item STREQUAL OV_CPACK_COMP_PYTHON_WHEELS AND

View File

@ -6,7 +6,7 @@ if(CPACK_GENERATOR STREQUAL "DEB")
include(cmake/packaging/debian.cmake)
elseif(CPACK_GENERATOR STREQUAL "RPM")
include(cmake/packaging/rpm.cmake)
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW)$")
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW|CONAN)$")
include(cmake/packaging/common-libraries.cmake)
elseif(CPACK_GENERATOR STREQUAL "NSIS")
include(cmake/packaging/nsis.cmake)

View File

@ -142,6 +142,14 @@ if(ENABLE_SYSTEM_PUGIXML)
endif()
endif()
set(_IE_nlohmann_json_FOUND "@nlohmann_json_FOUND@")
if(_IE_nlohmann_json_FOUND)
find_dependency(nlohmann_json)
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES IMPORTED_GLOBAL ON)
add_library(IE::nlohmann_json ALIAS nlohmann_json::nlohmann_json)
endif()
unset(_IE_nlohmann_json_FOUND)
# inherit OpenCV from main IE project if enabled
if ("@OpenCV_FOUND@")
load_cache("${cache_path}" READ_WITH_PREFIX "" OpenCV_DIR)

View File

@ -85,9 +85,9 @@
#
# `OpenVINO_VERSION_MAJOR`
# Major version component
#
#
# `OpenVINO_VERSION_MINOR`
# minor version component
# Minor version component
#
# `OpenVINO_VERSION_PATCH`
# Patch version component
@ -138,7 +138,7 @@ endmacro()
macro(_ov_find_tbb)
set(THREADING "@THREADING@")
if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND NOT TBB_FOUND)
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
set(enable_pkgconfig_tbb "@tbb_FOUND@")
# try tbb.pc
@ -153,10 +153,10 @@ macro(_ov_find_tbb)
endif()
pkg_search_module(tbb
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET
tbb)
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET
tbb)
unset(pkg_config_quiet_arg)
unset(pkg_config_required_arg)
@ -223,28 +223,185 @@ macro(_ov_find_tbb)
PATHS ${_tbb_bind_dir}
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
set_target_properties(${TBBBIND_2_5_IMPORTED_TARGETS} PROPERTIES IMPORTED_GLOBAL ON)
unset(_tbb_bind_dir)
endif()
unset(install_tbbbind)
endif()
endmacro()
macro(_ov_find_pugixml)
set(_OV_ENABLE_SYSTEM_PUGIXML "@ENABLE_SYSTEM_PUGIXML@")
if(_OV_ENABLE_SYSTEM_PUGIXML)
set(_ov_pugixml_pkgconfig_interface "@pugixml_FOUND@")
set(_ov_pugixml_cmake_interface "@PugiXML_FOUND@")
if(_ov_pugixml_pkgconfig_interface AND NOT ANDROID)
_ov_find_dependency(PkgConfig)
elseif(_ov_pugixml_cmake_interface)
_ov_find_dependency(PugiXML REQUIRED)
endif()
if(PugiXML_FOUND)
if(TARGET pugixml)
set(_ov_pugixml_target pugixml)
elseif(TARGET pugixml::pugixml)
set(_ov_pugixml_target pugixml::pugixml)
endif()
if(OpenVINODeveloperPackage_DIR)
set_property(TARGET ${_ov_pugixml_target} PROPERTY IMPORTED_GLOBAL ON)
# align with build tree
add_library(openvino::pugixml ALIAS ${_ov_pugixml_target})
endif()
unset(_ov_pugixml_target)
elseif(PkgConfig_FOUND)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(pkg_config_quiet_arg QUIET)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
set(pkg_config_required_arg REQUIRED)
endif()
pkg_search_module(pugixml
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET
GLOBAL
pugixml)
unset(pkg_config_quiet_arg)
unset(pkg_config_required_arg)
if(pugixml_FOUND)
if(OpenVINODeveloperPackage_DIR)
add_library(openvino::pugixml ALIAS PkgConfig::pugixml)
endif()
# PATCH: on Ubuntu 18.04 pugixml.pc contains incorrect include directories
get_target_property(interface_include_dir PkgConfig::pugixml INTERFACE_INCLUDE_DIRECTORIES)
if(interface_include_dir AND NOT EXISTS "${interface_include_dir}")
set_target_properties(PkgConfig::pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "")
endif()
endif()
endif()
# debian 9 case: no cmake, no pkg-config files
if(NOT TARGET openvino::pugixml)
find_library(PUGIXML_LIBRARY NAMES pugixml DOC "Path to pugixml library")
if(PUGIXML_LIBRARY)
add_library(openvino::pugixml INTERFACE IMPORTED)
set_target_properties(openvino::pugixml PROPERTIES INTERFACE_LINK_LIBRARIES "${PUGIXML_LIBRARY}")
else()
message(FATAL_ERROR "Failed to find system pugixml in OpenVINO Developer Package")
endif()
endif()
endif()
endmacro()
macro(_ov_find_itt)
set(_ENABLE_PROFILING_ITT "@ENABLE_PROFILING_ITT@")
# whether 'ittapi' is found via find_package
set(_ENABLE_SYSTEM_ITTAPI "@ittapi_FOUND@")
if(_ENABLE_PROFILING_ITT AND _ENABLE_SYSTEM_ITTAPI)
_ov_find_dependency(ittapi)
endif()
unset(_ENABLE_PROFILING_ITT)
unset(_ENABLE_SYSTEM_ITTAPI)
endmacro()
macro(_ov_find_ade)
set(_OV_ENABLE_GAPI_PREPROCESSING "@ENABLE_GAPI_PREPROCESSING@")
# whether 'ade' is found via find_package
set(_ENABLE_SYSTEM_ADE "@ade_FOUND@")
if(_OV_ENABLE_GAPI_PREPROCESSING AND _ENABLE_SYSTEM_ADE)
_ov_find_dependency(ade 0.1.2)
endif()
unset(_OV_ENABLE_GAPI_PREPROCESSING)
unset(_ENABLE_SYSTEM_ADE)
endmacro()
macro(_ov_find_intel_cpu_dependencies)
set(_OV_ENABLE_CPU_ACL "@DNNL_USE_ACL@")
if(_OV_ENABLE_CPU_ACL)
if(_ov_as_external_package)
set_and_check(ARM_COMPUTE_LIB_DIR "@PACKAGE_ARM_COMPUTE_LIB_DIR@")
set(_ov_find_acl_options NO_DEFAULT_PATH)
set(_ov_find_acl_path "${CMAKE_CURRENT_LIST_DIR}")
else()
set_and_check(_ov_find_acl_path "@PACKAGE_FIND_ACL_PATH@")
endif()
_ov_find_dependency(ACL
NO_MODULE
PATHS "${_ov_find_acl_path}"
${_ov_find_acl_options})
unset(ARM_COMPUTE_LIB_DIR)
unset(_ov_find_acl_path)
unset(_ov_find_acl_options)
endif()
unset(_OV_ENABLE_CPU_ACL)
endmacro()
macro(_ov_find_intel_gpu_dependencies)
set(_OV_ENABLE_INTEL_GPU "@ENABLE_INTEL_GPU@")
set(_OV_ENABLE_SYSTEM_OPENCL "@ENABLE_SYSTEM_OPENCL@")
if(_OV_ENABLE_INTEL_GPU AND _OV_ENABLE_SYSTEM_OPENCL)
set(_OV_OpenCLICDLoader_FOUND "@OpenCLICDLoader_FOUND@")
if(_OV_OpenCLICDLoader_FOUND)
_ov_find_dependency(OpenCLICDLoader)
else()
_ov_find_dependency(OpenCL)
endif()
unset(_OV_OpenCLICDLoader_FOUND)
endif()
unset(_OV_ENABLE_INTEL_GPU)
unset(_OV_ENABLE_SYSTEM_OPENCL)
endmacro()
macro(_ov_find_intel_gna_dependencies)
set(_OV_ENABLE_INTEL_GNA "@ENABLE_INTEL_GNA@")
if(_OV_ENABLE_INTEL_GNA AND NOT libGNA_FOUND)
if(_OV_ENABLE_INTEL_GNA)
set_and_check(GNA_PATH "@PACKAGE_GNA_PATH@")
_ov_find_dependency(libGNA
COMPONENTS KERNEL
CONFIG
PATHS "${CMAKE_CURRENT_LIST_DIR}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
unset(GNA_PATH)
endif()
unset(_OV_ENABLE_INTEL_GNA)
endmacro()
macro(_ov_find_protobuf_frontend_dependency)
set(_OV_ENABLE_SYSTEM_PROTOBUF "@ENABLE_SYSTEM_PROTOBUF@")
# TODO: remove check for target existence
if(_OV_ENABLE_SYSTEM_PROTOBUF AND NOT TARGET protobuf::libprotobuf)
_ov_find_dependency(Protobuf @Protobuf_VERSION@ EXACT)
endif()
unset(_OV_ENABLE_SYSTEM_PROTOBUF)
endmacro()
macro(_ov_find_tensorflow_frontend_dependencies)
set(_OV_ENABLE_SYSTEM_SNAPPY "@ENABLE_SYSTEM_SNAPPY@")
set(_ov_snappy_lib "@ov_snappy_lib@")
# TODO: remove check for target existence
if(_OV_ENABLE_SYSTEM_SNAPPY AND NOT TARGET ${_ov_snappy_lib})
_ov_find_dependency(Snappy @Snappy_VERSION@ EXACT)
endif()
unset(_OV_ENABLE_SYSTEM_SNAPPY)
unset(_ov_snappy_lib)
set(PACKAGE_PREFIX_DIR ${_ov_package_prefix_dir})
endmacro()
macro(_ov_find_onnx_frontend_dependencies)
set(_OV_ENABLE_SYSTEM_ONNX "@ENABLE_SYSTEM_ONNX@")
if(_OV_ENABLE_SYSTEM_ONNX)
_ov_find_dependency(ONNX @ONNX_VERSION@ EXACT)
endif()
unset(_OV_ENABLE_SYSTEM_ONNX)
endmacro()
function(_ov_target_no_deprecation_error)
if(NOT MSVC)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
@ -270,8 +427,28 @@ set(_ov_package_prefix_dir "${PACKAGE_PREFIX_DIR}")
set(_OV_ENABLE_OPENVINO_BUILD_SHARED "@BUILD_SHARED_LIBS@")
if(NOT TARGET openvino)
set(_ov_as_external_package ON)
endif()
if(NOT _OV_ENABLE_OPENVINO_BUILD_SHARED)
# common openvino dependencies
_ov_find_tbb()
_ov_find_itt()
_ov_find_pugixml()
# preprocessing dependencies
_ov_find_ade()
# frontend dependencies
_ov_find_protobuf_frontend_dependency()
_ov_find_tensorflow_frontend_dependencies()
_ov_find_onnx_frontend_dependencies()
# plugin dependencies
_ov_find_intel_cpu_dependencies()
_ov_find_intel_gpu_dependencies()
_ov_find_intel_gna_dependencies()
endif()
@ -279,33 +456,26 @@ _ov_find_dependency(Threads)
unset(_OV_ENABLE_OPENVINO_BUILD_SHARED)
set (RUNTIME_AND_FRONTEND_TARGETS openvino::runtime openvino::runtime::c
set(_ov_imported_libs openvino::runtime openvino::runtime::c
openvino::frontend::onnx openvino::frontend::paddle openvino::frontend::tensorflow
openvino::frontend::pytorch openvino::frontend::tensorflow_lite)
if(NOT TARGET openvino)
set(_ov_as_external_package ON)
if(_ov_as_external_package)
include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake")
foreach(target ${RUNTIME_AND_FRONTEND_TARGETS})
foreach(target IN LISTS _ov_imported_libs)
if(TARGET ${target})
get_target_property(ORIGINAL_NAME ${target} ALIASED_TARGET)
if (ORIGINAL_NAME MATCHES "ORIGINAL_NAME-NOTFOUND")
set (ORIGINAL_NAME ${target})
endif()
get_target_property(imported_configs ${target} IMPORTED_CONFIGURATIONS)
if(RELWITHDEBINFO IN_LIST imported_configs)
set (MAP_CONFIG RELWITHDEBINFO)
else()
set (MAP_CONFIG RELEASE)
if(NOT RELWITHDEBINFO IN_LIST imported_configs)
set_property(TARGET ${target} PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE)
endif()
set_property(TARGET ${ORIGINAL_NAME} PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO ${MAP_CONFIG})
unset(imported_configs)
endif()
endforeach()
# WA for cmake version < 3.16 which does not export
# IMPORTED_LINK_DEPENDENT_LIBRARIES_** properties if no PUBLIC dependencies for the library
if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND TBB_FOUND)
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
foreach(type RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
foreach(tbb_target TBB::tbb TBB::tbbmalloc PkgConfig::tbb)
if(TARGET ${tbb_target})
@ -346,11 +516,12 @@ endif()
# Apply common functions
#
foreach(target ${RUNTIME_AND_FRONTEND_TARGETS})
foreach(target IN LISTS _ov_imported_libs)
if(TARGET ${target} AND _ov_as_external_package)
_ov_target_no_deprecation_error(${target})
endif()
endforeach()
unset(_ov_imported_libs)
unset(_ov_as_external_package)
# restore PACKAGE_PREFIX_DIR
@ -364,7 +535,6 @@ if(_need_package_name_reset)
unset(_need_package_name_reset)
endif()
unset(RUNTIME_AND_FRONTEND_TARGETS)
unset(${CMAKE_FIND_PACKAGE_NAME}_IR_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_Paddle_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND)

View File

@ -56,6 +56,7 @@ find_dependency(OpenVINO
NO_DEFAULT_PATH)
_ov_find_tbb()
_ov_find_pugixml()
foreach(component @openvino_export_components@)
# TODO: remove legacy targets from some tests
@ -65,58 +66,6 @@ foreach(component @openvino_export_components@)
# endif()
endforeach()
if(ENABLE_SYSTEM_PUGIXML)
set(_ov_pugixml_pkgconfig_interface "@pugixml_FOUND@")
set(_ov_pugixml_cmake_interface "@PugiXML_FOUND@")
if(_ov_pugixml_pkgconfig_interface)
find_dependency(PkgConfig)
elseif(_ov_pugixml_cmake_interface)
find_dependency(PugiXML)
endif()
if(PugiXML_FOUND)
set_property(TARGET pugixml PROPERTY IMPORTED_GLOBAL TRUE)
add_library(openvino::pugixml ALIAS pugixml)
elseif(PkgConfig_FOUND)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(pkg_config_quiet_arg QUIET)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
set(pkg_config_required_arg REQUIRED)
endif()
pkg_search_module(pugixml
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET GLOBAL
pugixml)
unset(pkg_config_quiet_arg)
unset(pkg_config_required_arg)
if(pugixml_FOUND)
add_library(openvino::pugixml ALIAS PkgConfig::pugixml)
# PATCH: on Ubuntu 18.04 pugixml.pc contains incorrect include directories
get_target_property(interface_include_dir PkgConfig::pugixml INTERFACE_INCLUDE_DIRECTORIES)
if(interface_include_dir AND NOT EXISTS "${interface_include_dir}")
set_target_properties(PkgConfig::pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "")
endif()
endif()
endif()
# debian 9 case: no cmake, no pkg-config files
if(NOT TARGET openvino::pugixml)
find_library(PUGIXML_LIBRARY NAMES pugixml DOC "Path to pugixml library")
if(PUGIXML_LIBRARY)
add_library(openvino::pugixml INTERFACE IMPORTED GLOBAL)
set_target_properties(openvino::pugixml PROPERTIES INTERFACE_LINK_LIBRARIES "${PUGIXML_LIBRARY}")
else()
message(FATAL_ERROR "Failed to find system pugixml in OpenVINO Developer Package")
endif()
endif()
endif()
# inherit OpenCV from main OpenVINO project if enabled
if ("@OpenCV_FOUND@")
load_cache("${cache_path}" READ_WITH_PREFIX "" OpenCV_DIR)

View File

@ -0,0 +1,75 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR amd64)
set(CMAKE_C_COMPILER x86_64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER x86_64-linux-gnu-g++)
set(CMAKE_STRIP x86_64-linux-gnu-strip)
set(PKG_CONFIG_EXECUTABLE "NOT-FOUND" CACHE PATH "Path to amd64 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)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(UNIX)
endif()
find_program(${ARGN})
SET(WIN32)
SET(APPLE)
SET(UNIX 1)
__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)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(UNIX)
endif()
find_package(${ARGN})
SET(WIN32)
SET(APPLE)
SET(UNIX 1)
__cmake_find_root_restore()
endmacro()

33
conanfile.txt Normal file
View File

@ -0,0 +1,33 @@
[requires]
ade/0.1.2a
onetbb/[>=2021.2.1]
pugixml/[>=1.10]
protobuf/[>=3.20.3]
ittapi/[>=3.23.0]
zlib/[>=1.2.8]
opencl-icd-loader/[>=2022.09.30]
# opencl-clhpp-headers/[>=2022.09.30]
opencl-headers/[>=2022.09.30]
xbyak/[>=6.62]
snappy/[>=1.1.7]
gflags/2.2.2
onnx/1.13.1
nlohmann_json/[>=3.1.1]
pybind11/[>=2.10.1]
flatbuffers/[>=22.9.24]
[tool_requires]
cmake/[>=3.15]
patchelf/[>=0.12]
protobuf/[>=3.20.3]
flatbuffers/[>=22.9.24]
[options]
protobuf/*:lite=True
onetbb/*:tbbmalloc=True
onetbb/*:tbbproxy=True
flatbuffers/*:header_only=True
[generators]
CMakeDeps
CMakeToolchain

View File

@ -9,7 +9,7 @@
ov_cpack_add_component(${OV_CPACK_COMP_LICENSING} HIDDEN)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${OV_CPACK_DOCDIR}/licensing
DESTINATION ${OV_CPACK_LICENSESDIR}
COMPONENT ${OV_CPACK_COMP_LICENSING}
PATTERN CMakeLists.txt EXCLUDE
PATTERN dev-third-party-programs.txt EXCLUDE

View File

@ -115,6 +115,9 @@ elseif(gflags_required)
elseif(TARGET gflags-shared)
# gflags shared case for CentOS / RHEL / Fedora
set(GFLAGS_TARGET gflags-shared)
elseif(TARGET gflags::gflags)
# gflags case for Conan
set(GFLAGS_TARGET gflags::gflags)
else()
message(FATAL_ERROR "Internal error: failed to find imported target 'gflags' using '${gflags_component}' component")
endif()

View File

@ -12,13 +12,15 @@ if(NOT ANDROID)
find_package(PkgConfig QUIET)
endif()
if(NOT TARGET zlib::zlib)
find_package(ZLIB QUIET)
if(NOT TARGET ZLIB::ZLIB)
if(PkgConfig_FOUND)
pkg_search_module(zlib QUIET
IMPORTED_TARGET GLOBAL
zlib)
if(zlib_FOUND)
add_library(zlib::zlib ALIAS PkgConfig::zlib)
add_library(ZLIB::ZLIB ALIAS PkgConfig::zlib)
endif()
endif()

View File

@ -8,7 +8,6 @@ include(cmake/install_tbb.cmake)
# CC library should be registered before other cc targets
add_subdirectory(common)
# TODO: Fix Wall for core, frontends and tests
add_subdirectory(core)
add_subdirectory(frontends)
# TODO: remove ngraph/ngraph.hpp usage
@ -17,7 +16,6 @@ if(ENABLE_TESTS)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wall)
ie_add_compiler_flags(-Wmissing-declarations)
endif()

View File

@ -11,34 +11,72 @@ function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
return()
endif()
foreach(property INTERFACE_LINK_LIBRARIES
IMPORTED_LOCATION_RELEASE
IMPORTED_LOCATION_RELWITHDEBINFO
IMPORTED_LOCATION_NONE
IMPORTED_LOCATION)
get_target_property(_tbb_lib_location ${tbb_target} ${property})
if(_tbb_lib_location)
if(property STREQUAL INTERFACE_LINK_LIBRARIES)
# pkg-config can set multiple libraries as interface, need to filter out
foreach(tbb_lib IN LISTS _tbb_lib_location)
if(tbb_lib MATCHES "${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(${_tbb_lib_location_var} "${tbb_lib}" PARENT_SCOPE)
return()
endif()
endforeach()
else()
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
return()
function(_get_target_location target lib_location_var)
if(NOT TARGET ${target})
message(FATAL_ERROR "Internal error: ${target} does not represent a target")
endif()
get_target_property(_imported_configs ${target} IMPORTED_CONFIGURATIONS)
if(NOT _imported_configs)
# if IMPORTED_CONFIGURATIONS property is not set, then set a common list
set(_imported_configs RELEASE NONE)
endif()
# generate a list of locations
foreach(_imported_config IN LISTS _imported_configs)
list(APPEND _location_properties IMPORTED_LOCATION_${_imported_config})
endforeach()
# add some more locations which are used by package managers
list(APPEND _location_properties IMPORTED_LOCATION)
foreach(_location_property IN LISTS _location_properties)
get_target_property(_lib_location ${target} ${_location_property})
if(_lib_location)
set(${lib_location_var} "${_lib_location}" PARENT_SCOPE)
break()
endif()
endforeach()
endfunction()
macro(_handle_tbb_target _tbb_target)
_get_target_location(${_tbb_target} "_tbb_lib_location")
if(_tbb_lib_location)
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
return()
endif()
endmacro()
# handle INTERFACE_LINK_LIBRARIES
get_target_property(_tbb_interface_link_libraries ${tbb_target} INTERFACE_LINK_LIBRARIES)
# pkg-config can set multiple libraries as interface, need to filter out
foreach(tbb_lib IN LISTS _tbb_interface_link_libraries)
# handle cases like in conan: $<$<CONFIG:Release>:CONAN_LIB::onetbb_TBB_tbb_tbb_RELEASE>
if(${tbb_lib} MATCHES "CONAN_LIB::([A-Za-z0-9_]*)")
set(tbb_lib_parsed "CONAN_LIB::${CMAKE_MATCH_1}")
_handle_tbb_target(${tbb_lib_parsed})
elseif(tbb_lib MATCHES "${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}")
# tbb_lib just a full path to a library itself
set(${_tbb_lib_location_var} "${tbb_lib}" PARENT_SCOPE)
return()
endif()
endforeach()
# handle case of usual target
_handle_tbb_target(${tbb_target})
message(FATAL_ERROR "Failed to detect TBB library location")
endfunction()
macro(ov_find_package_tbb)
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND)
set(_ov_minimal_tbb_version 2017.0)
# conan generates TBBConfig.cmake files, which follows cmake's
# SameMajorVersion scheme, while TBB itself follows AnyNewerVersion one
# see https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#generating-a-package-version-file
if(CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain.cmake" OR CONAN_EXPORTED)
set(_ov_minimal_tbb_version 2021.0)
else()
set(_ov_minimal_tbb_version 2017.0)
endif()
if(NOT ENABLE_SYSTEM_TBB)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
@ -74,7 +112,10 @@ macro(ov_find_package_tbb)
unset(tbb_FOUND CACHE)
endmacro()
pkg_search_module(tbb QUIET
IMPORTED_TARGET GLOBAL
IMPORTED_TARGET
# we need to set GLOBAL in order to create ALIAS later
# ALIAS creation for non-GLOBAL targets is available since cmake 3.18
GLOBAL
tbb)
if(tbb_FOUND)
# parse version
@ -99,7 +140,7 @@ macro(ov_find_package_tbb)
else()
_ov_pkg_config_tbb_unset()
if(CPACK_GENERATOR STREQUAL "^(DEB|RPM|CONDA-FORGE|BREW)$")
if(CPACK_GENERATOR STREQUAL "^(DEB|RPM|CONDA-FORGE|BREW|CONAN)$")
# package managers require system TBB
set(message_type FATAL_ERROR)
else()
@ -148,12 +189,14 @@ macro(ov_find_package_tbb)
# let's try it first
if(PkgConfig_FOUND)
pkg_search_module(HWLOC QUIET
IMPORTED_TARGET GLOBAL
IMPORTED_TARGET
GLOBAL
hwloc)
endif()
if(TARGET PkgConfig::HWLOC)
# dependency is satisfied
add_library(HWLOC::hwloc_2_5 ALIAS PkgConfig::HWLOC)
else()
# Add HWLOC::hwloc_2_5 target to check via ApiValidator
get_target_property(imported_configs TBB::tbbbind_2_5 IMPORTED_CONFIGURATIONS)
@ -168,9 +211,7 @@ macro(ov_find_package_tbb)
set(hwloc_dll_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwloc${CMAKE_SHARED_LIBRARY_SUFFIX}")
find_file(HWLOC_DLL NAMES ${hwloc_dll_name} PATHS "${TBB_dir}" DOC "Path to hwloc.dll")
if(NOT HWLOC_DLL)
message(WARNING "Failed to find ${hwloc_dll_name} in ${TBB_dir}")
else()
if(HWLOC_DLL)
add_library(HWLOC::hwloc_2_5 SHARED IMPORTED)
set_property(TARGET HWLOC::hwloc_2_5 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(HWLOC::hwloc_2_5 PROPERTIES IMPORTED_LOCATION_RELEASE "${HWLOC_DLL}")

View File

@ -96,7 +96,7 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
set(_ov_system_tbb_is_obsolete ON)
endif()
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW)$" AND
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW|CONAN)$" AND
NOT ENABLE_SYSTEM_TBB AND
NOT _ov_system_tbb_is_obsolete)
message(FATAL_ERROR "Debian | RPM | Conda-forge | Brew packages can be built only with system TBB. Use -DENABLE_SYSTEM_TBB=ON")

View File

@ -118,14 +118,8 @@ ov_install_static_lib(${TARGET_NAME}_dev ${OV_CPACK_COMP_CORE})
# Install OpenVINO runtime
#
list(APPEND PATH_VARS "IE_INCLUDE_DIR")
ov_add_library_version(${TARGET_NAME})
if(ENABLE_INTEL_GNA)
list(APPEND PATH_VARS "GNA_PATH")
endif()
ov_cpack_add_component(${OV_CPACK_COMP_CORE}
HIDDEN
DEPENDS ${core_components})
@ -145,7 +139,9 @@ if(ENABLE_PLUGINS_XML)
endif()
endif()
#
# Install cmake scripts
#
install(EXPORT OpenVINOTargets
FILE OpenVINOTargets.cmake
@ -153,6 +149,17 @@ install(EXPORT OpenVINOTargets
DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
COMPONENT ${OV_CPACK_COMP_CORE_DEV})
# build tree
list(APPEND PATH_VARS "IE_INCLUDE_DIR")
if(ENABLE_INTEL_GNA)
list(APPEND PATH_VARS "GNA_PATH")
endif()
if(DNNL_USE_ACL)
list(APPEND BUILD_PATH_VARS "FIND_ACL_PATH")
set(FIND_ACL_PATH "${intel_cpu_thirdparty_SOURCE_DIR}")
endif()
set(PUBLIC_HEADERS_DIR "${OpenVINO_SOURCE_DIR}/src/inference/include")
set(IE_INCLUDE_DIR "${PUBLIC_HEADERS_DIR}/ie")
set(IE_TBB_DIR "${TBB_DIR}")
@ -160,12 +167,21 @@ set(IE_TBB_DIR "${TBB_DIR}")
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
PATH_VARS ${PATH_VARS})
PATH_VARS ${PATH_VARS} ${BUILD_PATH_VARS})
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig.cmake.in"
"${CMAKE_BINARY_DIR}/OpenVINOConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
PATH_VARS ${PATH_VARS})
PATH_VARS ${PATH_VARS} ${BUILD_PATH_VARS})
# install tree
if(DNNL_USE_ACL)
list(APPEND INSTALL_PATH_VARS "ARM_COMPUTE_LIB_DIR")
# remove generator expression at the end, because searching in Release / Debug will be
# done by ACLConfig.cmake itself
string(REPLACE "$<CONFIG>" "" ARM_COMPUTE_LIB_DIR "${OV_CPACK_LIBRARYDIR}")
endif()
set(IE_INCLUDE_DIR "${OV_CPACK_INCLUDEDIR}/ie")
set(IE_TBB_DIR "${IE_TBB_DIR_INSTALL}")
@ -178,12 +194,12 @@ endif()
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig.cmake.in"
"${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake"
INSTALL_DESTINATION ${OV_CPACK_IE_CMAKEDIR}
PATH_VARS ${PATH_VARS})
PATH_VARS ${PATH_VARS} ${INSTALL_PATH_VARS})
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig.cmake.in"
"${CMAKE_BINARY_DIR}/share/OpenVINOConfig.cmake"
INSTALL_DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
PATH_VARS ${PATH_VARS})
PATH_VARS ${PATH_VARS} ${INSTALL_PATH_VARS})
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" @ONLY)
@ -200,7 +216,9 @@ install(FILES "${CMAKE_BINARY_DIR}/share/OpenVINOConfig.cmake"
DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
COMPONENT ${OV_CPACK_COMP_CORE_DEV})
#
# Generate and install openvino.pc pkg-config file
#
if(ENABLE_PKGCONFIG_GEN)
# fill in PKGCONFIG_OpenVINO_DEFINITIONS

View File

@ -7,13 +7,12 @@ set(TARGET_NAME itt)
file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.hpp")
add_library(${TARGET_NAME} STATIC ${SOURCES})
add_library(openvino::itt ALIAS ${TARGET_NAME})
target_link_libraries(${TARGET_NAME} PUBLIC openvino::util)
if(TARGET ittnotify)
target_link_libraries(${TARGET_NAME} PUBLIC ittnotify)
if(ENABLE_PROFILING_ITT)
target_link_libraries(${TARGET_NAME} PUBLIC ittapi::ittnotify)
if(ENABLE_PROFILING_FILTER STREQUAL "ALL")
target_compile_definitions(${TARGET_NAME} PUBLIC
ENABLE_PROFILING_ALL

View File

@ -48,12 +48,12 @@ find_package_handle_standard_args(ITT
if(ITT_FOUND)
set(INTEL_ITT_FOUND ${ITT_FOUND})
add_library(ittnotify STATIC IMPORTED GLOBAL)
set_target_properties(ittnotify PROPERTIES IMPORTED_LOCATION "${Located_ITT_LIBS}"
INTERFACE_INCLUDE_DIRECTORIES ${Located_ITT_INCLUDE_DIRS}
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
add_library(ittapi::ittnotify STATIC IMPORTED GLOBAL)
set_target_properties(ittapi::ittnotify PROPERTIES IMPORTED_LOCATION "${Located_ITT_LIBS}"
INTERFACE_INCLUDE_DIRECTORIES ${Located_ITT_INCLUDE_DIRS}
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
if(UNIX)
set_target_properties(ittnotify PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS};Threads::Threads")
set_target_properties(ittapi::ittnotify PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS};Threads::Threads")
endif()
endif()

View File

@ -32,7 +32,8 @@ target_include_directories(${TARGET_NAME} PUBLIC
$<BUILD_INTERFACE:${REF_IMPL_INCLUDE_DIR}>
$<BUILD_INTERFACE:${OV_CORE_INCLUDE_PATH}>)
link_system_libraries(${TARGET_NAME} PRIVATE xbyak)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE
$<BUILD_INTERFACE:$<$<TARGET_EXISTS:xbyak::xbyak>:$<TARGET_PROPERTY:xbyak::xbyak,INTERFACE_INCLUDE_DIRECTORIES>>>)
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})

View File

@ -40,7 +40,7 @@ struct ConvolutionParams {
};
template <typename Int>
constexpr inline bool in_range(Int val, std::pair<Int, Int> range) noexcept {
constexpr inline bool in_range(Int val, const std::pair<Int, Int>& range) noexcept {
return val >= range.first && val < range.second;
}

View File

@ -2,14 +2,18 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "jit_generator.hpp"
#include <xbyak/xbyak_util.h>
#include "ngraph/type/float16.hpp"
#include "openvino/core/visibility.hpp"
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
# if defined _WIN32 && !defined NOMINMAX
# define NOMINMAX
# endif
# include <xbyak/xbyak_util.h>
# include "jit_generator.hpp"
# include "ngraph/type/float16.hpp"
namespace ngraph {
namespace runtime {
namespace jit {

View File

@ -79,7 +79,7 @@ bool ov::pass::Manager::run_passes(shared_ptr<ov::Model> func) {
continue;
}
OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::ov_pass, pass::perf_counters()[pass->get_type_info()]);
OV_ITT_SCOPE(FIRST_INFERENCE, ov::itt::domains::ov_pass, ov::pass::perf_counters()[pass->get_type_info()]);
pass_timer.start();

View File

@ -6,5 +6,6 @@ set(TARGET_NAME ov_protobuf_shutdown)
add_library(${TARGET_NAME} STATIC shutdown_protobuf.cpp)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE $<BUILD_INTERFACE:${Protobuf_INCLUDE_DIRS}>)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE
$<BUILD_INTERFACE:$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>>)
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})

View File

@ -7,6 +7,9 @@
#include "openvino/util/file_util.hpp"
// clang-format-off
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <windows.h>
// clang-format-on

View File

@ -29,9 +29,9 @@ target_include_directories(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${ONNX_COMMON
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime)
if(ONNX_USE_LITE_PROTO)
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LITE_LIBRARIES})
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx protobuf::libprotobuf-lite)
else()
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LIBRARIES})
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx protobuf::libprotobuf)
endif()
target_include_directories(${TARGET_NAME} PRIVATE ${ONNX_COMMON_SRC_DIR})

View File

@ -145,7 +145,7 @@ target_include_directories(ov_onnx_frontend_tests
SYSTEM PRIVATE
$<TARGET_PROPERTY:onnx,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:onnx_proto,INTERFACE_INCLUDE_DIRECTORIES>
${Protobuf_INCLUDE_DIRS})
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(ov_onnx_frontend_tests PRIVATE $<TARGET_PROPERTY:onnx,INTERFACE_COMPILE_DEFINITIONS>)
target_compile_definitions(ov_onnx_frontend_tests PRIVATE ENABLE_OV_ONNX_FRONTEND)

View File

@ -8,6 +8,6 @@ ov_add_frontend(NAME tensorflow
LINK_LIBRARIES openvino::core::dev openvino::frontend::tensorflow_common)
if(ENABLE_SNAPPY_COMPRESSION)
target_link_libraries(openvino_tensorflow_frontend PRIVATE Snappy::snappy)
target_link_libraries(openvino_tensorflow_frontend PRIVATE openvino::snappy)
target_compile_definitions(openvino_tensorflow_frontend PRIVATE ENABLE_SNAPPY_COMPRESSION)
endif()

View File

@ -78,7 +78,7 @@ public:
}
/// \brief Checks if variable has a mapped pair
/// \param name Name of variable for checking existance
/// \param name Name of variable for checking existence
/// \returns True in case variable has mapped value and false otherwise
bool has_mapped_variable(const std::string& name) const {
auto mapItem = m_variables_map.find(name);

View File

@ -52,13 +52,13 @@ NamedOutputVector translate_non_max_suppression_op(const NodeContext& node) {
auto scores = node.get_input(1);
auto max_output_size = node.get_input(2);
// prepare boxes: in TensorFlow NonMaxSupression operation there is no batch dimension
// prepare boxes: in TensorFlow NonMaxSuppression operation there is no batch dimension
// so we need to introduce it to be aligned with OpenVINO NonMaxSuppression
// boxes of shape [num_batches, num_boxes, 4]
auto boxes_axis = make_shared<Constant>(element::i32, Shape{1}, 0);
auto ov_boxes = make_shared<Unsqueeze>(boxes, boxes_axis);
// prepare scores: in TensorFlow NonMaxSupression operation there is no batch and class dimensions
// prepare scores: in TensorFlow NonMaxSuppression operation there is no batch and class dimensions
// so we need to introduce them to be aligned with OpenVINO NonMaxSuppression scores
// of shape [num_batches, num_classes, num_boxes]
auto scores_axes = make_shared<Constant>(element::i32, Shape{2}, vector<int32_t>{0, 1});

View File

@ -133,7 +133,7 @@ target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE
$<TARGET_PROPERTY:ngraph,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:openvino::pugixml,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:xbyak,INTERFACE_INCLUDE_DIRECTORIES>)
$<$<TARGET_EXISTS:xbyak::xbyak>:$<TARGET_PROPERTY:xbyak::xbyak,INTERFACE_INCLUDE_DIRECTORIES>>)
target_include_directories(${TARGET_NAME}_obj PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src"

View File

@ -31,6 +31,9 @@
# endif
# if defined(_WIN32) || defined(_WIN64)
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
# endif

View File

@ -19,15 +19,17 @@
#include "streams_executor.hpp"
#include "threading/ie_cpu_streams_info.hpp"
#define XBYAK_NO_OP_NAMES
#define XBYAK_UNDEF_JNL
#include <xbyak/xbyak_util.h>
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
# define XBYAK_NO_OP_NAMES
# define XBYAK_UNDEF_JNL
# include <xbyak/xbyak_util.h>
#endif
using namespace InferenceEngine;
namespace ov {
#if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64)
#if defined(OPENVINO_ARCH_X86_64)
// note: MSVC 2022 (17.4) is not able to compile the next line for ARM and ARM64
// so, we disable this code since for non-x86 platforms it returns 'false' anyway
@ -77,7 +79,7 @@ bool with_cpu_x86_avx512_core_amx() {
return with_cpu_x86_avx512_core_amx_int8() || with_cpu_x86_avx512_core_amx_bf16();
}
#else // OPENVINO_ARCH_X86 || OPENVINO_ARCH_X86_64
#else // OPENVINO_ARCH_X86_64
bool with_cpu_x86_sse42() {
return false;
@ -110,7 +112,7 @@ bool with_cpu_x86_avx512_core_amx() {
return false;
}
#endif // OPENVINO_ARCH_X86 || OPENVINO_ARCH_X86_64
#endif // OPENVINO_ARCH_X86_64
bool check_open_mp_env_vars(bool include_omp_num_threads) {
for (auto&& var : {"GOMP_CPU_AFFINITY",

View File

@ -1,12 +1,11 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if(NOT ENABLE_AUTO AND NOT ENABLE_MULTI)
return()
endif()
set (TARGET_NAME "openvino_auto_plugin")
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/*.cpp)

View File

@ -39,7 +39,7 @@ namespace {
1
};
static std::shared_ptr<ngraph::Function> simple_function_non_max_supression_internal(ngraph::element::Type, size_t) {
static std::shared_ptr<ngraph::Function> simple_function_non_max_suppression_internal(ngraph::element::Type, size_t) {
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
auto max_output_boxes_per_class = ov::op::v0::Constant::create(element::i32, Shape{1}, {10});
@ -77,7 +77,7 @@ namespace {
static std::vector<ovModelWithName> internal_functions_cpu() {
std::vector<ovModelWithName> funcs = {
ovModelWithName { simple_function_non_max_supression_internal, "NonMaxSuppressionIEInternal"},
ovModelWithName { simple_function_non_max_suppression_internal, "NonMaxSuppressionIEInternal"},
ovModelWithName { simple_function_matrix_nms_internal, "NmsStaticShapeIE_MatrixNms"},
ovModelWithName { simple_function_multiclass_nms_internal, "MulticlassNmsIEInternal"},
};

View File

@ -39,7 +39,7 @@ namespace {
1
};
static std::shared_ptr<ngraph::Function> simple_function_non_max_supression_internal(ngraph::element::Type, size_t) {
static std::shared_ptr<ngraph::Function> simple_function_non_max_suppression_internal(ngraph::element::Type, size_t) {
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
auto max_output_boxes_per_class = opset1::Constant::create(element::i32, Shape{1}, {10});
@ -77,7 +77,7 @@ namespace {
static std::vector<nGraphFunctionWithName> internal_functions_cpu() {
std::vector<nGraphFunctionWithName> funcs = {
nGraphFunctionWithName { simple_function_non_max_supression_internal, "NonMaxSuppressionIEInternal"},
nGraphFunctionWithName { simple_function_non_max_suppression_internal, "NonMaxSuppressionIEInternal"},
nGraphFunctionWithName { simple_function_matrix_nms_internal, "NmsStaticShapeIE_MatrixNms"},
nGraphFunctionWithName { simple_function_multiclass_nms_internal, "MulticlassNmsIEInternal"},
};

View File

@ -0,0 +1,360 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
if(ARM_COMPUTE_INCLUDE_DIR OR ARM_COMPUTE_LIB_DIR)
set(ARM_COMPUTE_INCLUDE_DIR "" CACHE PATH "Path to ARM Compute Library headers" FORCE)
if(NOT ARM_COMPUTE_LIB_DIR)
message(FATAL_ERROR "Undefined ARM_COMPUTE_LIB_DIR input variable should be set manually")
elseif(NOT TARGET arm_compute::arm_compute)
if(WIN32 OR APPLE)
if(OV_GENERATOR_MULTI_CONFIG)
set(extra_args PATH_SUFFIXES ${CMAKE_CONFIGURATION_TYPES})
else()
set(extra_args PATH_SUFFIXES ${CMAKE_BUILD_TYPE})
endif()
endif()
find_library(ARM_COMPUTE_LIB
NAMES arm_compute-static
PATHS ${ARM_COMPUTE_LIB_DIR}
${extra_args})
unset(extra_args)
message(STATUS "Found arm_compute-static: ${ARM_COMPUTE_LIB}")
add_library(arm_compute::arm_compute STATIC IMPORTED GLOBAL)
set_target_properties(arm_compute::arm_compute PROPERTIES
IMPORTED_LOCATION ${ARM_COMPUTE_LIB})
add_library(arm_compute::half INTERFACE IMPORTED GLOBAL)
if(ARM_COMPUTE_INCLUDE_DIR)
set_target_properties(arm_compute::arm_compute arm_compute::half PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_INCLUDE_DIR})
endif()
endif()
# for oneDNN integration
set(ACL_FOUND ON)
set(ACL_LIBRARIES arm_compute::arm_compute arm_compute::half)
foreach(acl_library IN LISTS ACL_LIBRARIES)
list(APPEND ACL_INCLUDE_DIRS
$<TARGET_PROPERTY:${acl_library},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
elseif(ENABLE_ARM_COMPUTE_CMAKE)
set(ARM_COMPUTE_SOURCE_DIR "${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary")
set(ARM_COMPUTE_BINARY_DIR "${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary")
function(ov_build_compute_library)
# build ComputeLibrary as static libraries
set(BUILD_SHARED_LIBS OFF)
# ComputeLibrary settings
set(ARM_COMPUTE_GRAPH_ENABLED OFF CACHE BOOL "" FORCE)
# disable OpenMP
set(OPENMP OFF CACHE BOOL "" FORCE)
# and use std::threads instead
set(CPPTHREADS OFF CACHE BOOL "" FORCE)
# SVE is not supported on Darwin
if(CMAKE_HOST_APPLE)
set(ENABLE_SVE OFF CACHE BOOL "" FORCE)
set(ARM_COMPUTE_ENABLE_SVE OFF CACHE BOOL "" FORCE)
set(ARM_COMPUTE_ENABLE_SVEF32MM OFF CACHE BOOL "" FORCE)
endif()
add_subdirectory(${ARM_COMPUTE_SOURCE_DIR} ${ARM_COMPUTE_BINARY_DIR} EXCLUDE_FROM_ALL)
add_library(ArmCompute::Half INTERFACE IMPORTED GLOBAL)
set_target_properties(ArmCompute::Half PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ARM_COMPUTE_SOURCE_DIR}/include")
endfunction()
ov_build_compute_library()
# Helpers for oneDNN intergation
set(ACL_FOUND ON)
set(ACL_LIBRARIES arm_compute_core ArmCompute::Half)
foreach(acl_library IN LISTS ACL_LIBRARIES)
list(APPEND ACL_INCLUDE_DIRS
$<TARGET_PROPERTY:${acl_library},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
# required by oneDNN to attempt to parse ACL version
set(ENV{ACL_ROOT_DIR} "${ARM_COMPUTE_SOURCE_DIR}")
elseif(NOT TARGET arm_compute::arm_compute)
set(ARM_COMPUTE_SOURCE_DIR "${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary")
set(ARM_COMPUTE_BINARY_DIR "${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary")
message(STATUS "Configure to build ${ARM_COMPUTE_SOURCE_DIR}")
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!")
endif()
file(GLOB_RECURSE SOURCES
${ARM_COMPUTE_SOURCE_DIR}/*.cpp
${ARM_COMPUTE_SOURCE_DIR}/*.hpp
${ARM_COMPUTE_SOURCE_DIR}/*.h
)
set(extra_cxx_flags "${CMAKE_CXX_FLAGS} -Wno-undef")
if(MSVC64)
# clang-cl does not recognize /MP option
string(REPLACE "/MP " "" extra_cxx_flags "${extra_cxx_flags}")
elseif(CMAKE_POSITION_INDEPENDENT_CODE)
# -fPIC is not applicable for clang-cl
set(extra_cxx_flags "${extra_cxx_flags} -fPIC")
endif()
set(ARM_COMPUTE_OPTIONS
neon=1
opencl=0
openmp=0
cppthreads=1
examples=0
Werror=0
gemm_tuner=0
reference_openmp=0
validation_tests=0
benchmark_tests=0
# TODO: check this for Apple Silicon
# multi_isa=1
# TODO: use CC for ARM compute library to minimize binary size
# build_config=<file>
# TODO: use data_type_support to disable useless kernels
data_layout_support=all
arch=${ARM_COMPUTE_TARGET_ARCH}
)
if(NOT MSVC64)
list(APPEND ARM_COMPUTE_OPTIONS
build_dir=${ARM_COMPUTE_BINARY_DIR}
install_dir=${ARM_COMPUTE_BINARY_DIR}/install)
endif()
if(ARM_COMPUTE_SCONS_JOBS)
list(APPEND ARM_COMPUTE_OPTIONS --jobs=${ARM_COMPUTE_SCONS_JOBS})
endif()
set(ARM_COMPUTE_DEBUG_OPTIONS
debug=1
asserts=1
logging=1)
# cmake older 3.20 does not support generator expressions in add_custom_command
# https://cmake.org/cmake/help/latest/command/add_custom_command.html#examples-generating-files
if(OV_GENERATOR_MULTI_CONFIG AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
foreach(option IN LISTS ARM_COMPUTE_DEBUG_OPTIONS)
list(APPEND ARM_COMPUTE_OPTIONS $<$<CONFIG:Debug>:${option}>
$<$<CONFIG:RelWithDebInfo>:${option}>)
endforeach()
foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER "${config}" config_upper)
set(flags ${CMAKE_CXX_FLAGS_${config_upper}})
set(extra_cxx_flags "${extra_cxx_flags} $<$<CONFIG:${config}>:${flags}>")
endforeach()
elseif(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
list(APPEND ARM_COMPUTE_OPTIONS ${ARM_COMPUTE_DEBUG_OPTIONS})
endif()
if(EMSCRIPTEN OR LINUX)
list(APPEND ARM_COMPUTE_OPTIONS os=linux)
elseif(ANDROID)
list(APPEND ARM_COMPUTE_OPTIONS os=android)
elseif(APPLE)
list(APPEND ARM_COMPUTE_OPTIONS os=macos)
elseif(WIN32)
list(APPEND ARM_COMPUTE_OPTIONS os=windows)
endif()
if(CMAKE_CROSSCOMPILING)
list(APPEND ARM_COMPUTE_OPTIONS build=cross_compile)
else()
list(APPEND ARM_COMPUTE_OPTIONS build=native)
endif()
if (CMAKE_CXX_COMPILER_LAUNCHER)
list(APPEND ARM_COMPUTE_OPTIONS compiler_cache=${CMAKE_CXX_COMPILER_LAUNCHER})
endif()
# used to build for yocto
if(ARM_COMPUTE_TOOLCHAIN_PREFIX)
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix=${ARM_COMPUTE_TOOLCHAIN_PREFIX})
endif()
if(ANDROID)
if(ANDROID_PLATFORM_LEVEL LESS 18)
message(FATAL_ERROR "ARM compute library requires Android API 18 level and higher"
"Please, speficy -DANDROID_PLATFORM=android-18 at least")
endif()
if(ANDROID_NDK_REVISION LESS "23.0")
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix="${ANDROID_TOOLCHAIN_PREFIX}")
else()
string(REGEX REPLACE "/bin/[^/]+-" "/bin/llvm-" ANDROID_TOOLCHAIN_PREFIX_FIXED "${ANDROID_TOOLCHAIN_PREFIX}")
message(STATUS "SCONS: using ANDROID_TOOLCHAIN_PREFIX=${ANDROID_TOOLCHAIN_PREFIX_FIXED}")
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix="${ANDROID_TOOLCHAIN_PREFIX_FIXED}")
endif()
list(APPEND ARM_COMPUTE_OPTIONS
compiler_prefix="${ANDROID_TOOLCHAIN_ROOT}/bin/")
set(extra_flags "${extra_flags} --target=${ANDROID_LLVM_TRIPLE}")
set(extra_flags "${extra_flags} --gcc-toolchain=${ANDROID_TOOLCHAIN_ROOT}")
set(extra_flags "${extra_flags} --sysroot=${CMAKE_SYSROOT}")
set(extra_link_flags "${extra_link_flags} ${extra_flags}")
set(extra_cxx_flags "${extra_cxx_flags} ${extra_flags}")
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)
set(cmake_build_env
CC=${c_compiler}
CXX=${cxx_compiler})
list(APPEND ARM_COMPUTE_OPTIONS compiler_prefix="${compiler_prefix}/")
elseif(EMSCRIPTEN)
set(cmake_build_env
CC=emcc
CXX=em++
RANLIB=emranlib
AR=emar)
# EMSDK: Passing any of -msse, -msse2, -msse3, -mssse3, -msse4.1, -msse4.2,
# -msse4, -mavx, -mfpu=neon flags also requires passing -msimd128 (or -mrelaxed-simd)!
set(extra_cxx_flags "${extra_cxx_flags} -msimd128")
# clang-16: error: argument unused during compilation: '-mthumb' [-Werror,-Wunused-command-line-argument]
# clang-16: error: argument unused during compilation: '-mfloat-abi=hard' [-Werror,-Wunused-command-line-argument]
set(extra_cxx_flags "${extra_cxx_flags} \
-Wno-unused-command-line-argument \
-Wno-unknown-warning-option \
-Wno-unused-function \
-Wno-unused-but-set-variable")
get_filename_component(toolchain_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY)
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix="${toolchain_prefix}/")
elseif(APPLE)
if(CMAKE_OSX_DEPLOYMENT_TARGET)
set(extra_cxx_flags "${extra_cxx_flags} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(minos_added ON)
endif()
if(HOST_X86_64)
if(NOT minos_added)
message(FATAL_ERROR "Please, specify either env MACOSX_DEPLOYMENT_TARGET or cmake CMAKE_OSX_DEPLOYMENT_TARGET variables")
endif()
set(extra_cxx_flags "${extra_cxx_flags} --sysroot ${CMAKE_OSX_SYSROOT}")
endif()
set(extra_cxx_flags "${extra_cxx_flags} -Wno-error=return-stack-address")
get_filename_component(compiler_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY)
list(APPEND ARM_COMPUTE_OPTIONS compiler_prefix="${compiler_prefix}/")
if(CMAKE_OSX_ARCHITECTURES)
foreach(arch IN LISTS CMAKE_OSX_ARCHITECTURES)
set(extra_cxx_flags "${extra_cxx_flags} -arch ${arch}")
endforeach()
endif()
elseif(MSVC64)
# required for clang-cl compiler
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
set(extra_cxx_flags "${extra_cxx_flags} $<IF:$<CONFIG:Release>,/MD,/MDd>")
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(extra_cxx_flags "${extra_cxx_flags} /MDd")
else()
set(extra_cxx_flags "${extra_cxx_flags} /MD")
endif()
endif()
endif()
if(ENABLE_LTO)
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()
endif()
if(SUGGEST_OVERRIDE_SUPPORTED)
set(extra_cxx_flags "${extra_cxx_flags} -Wno-suggest-override")
endif()
if(extra_link_flags)
list(APPEND ARM_COMPUTE_OPTIONS extra_link_flags=${extra_link_flags})
endif()
if(extra_cxx_flags)
list(APPEND ARM_COMPUTE_OPTIONS extra_cxx_flags=${extra_cxx_flags})
endif()
if(NOT CMAKE_VERBOSE_MAKEFILE)
list(APPEND ARM_COMPUTE_OPTIONS --silent)
endif()
if(MSVC64)
set(arm_compute build/arm_compute-static.lib)
set(arm_compute_full_path "${ARM_COMPUTE_SOURCE_DIR}/${arm_compute}")
else()
set(arm_compute ${ARM_COMPUTE_BINARY_DIR}/libarm_compute-static.a)
set(arm_compute_full_path "${arm_compute}")
endif()
add_custom_command(
OUTPUT
${arm_compute_full_path}
COMMAND ${CMAKE_COMMAND} -E env ${cmake_build_env}
${SCONS} ${ARM_COMPUTE_OPTIONS}
${arm_compute}
WORKING_DIRECTORY ${ARM_COMPUTE_SOURCE_DIR}
COMMENT "Build Arm Compute Library"
DEPENDS ${SOURCES}
${CMAKE_CURRENT_LIST_FILE}
${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})
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_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
OSX_ARCHITECTURES arm64)
# Helpers for oneDNN intergation
set(ACL_FOUND ON)
set(ACL_LIBRARIES arm_compute::arm_compute arm_compute::half)
foreach(acl_library IN LISTS ACL_LIBRARIES)
list(APPEND ACL_INCLUDE_DIRS
$<TARGET_PROPERTY:${acl_library},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
# required by oneDNN to attempt to parse ACL version
set(ENV{ACL_ROOT_DIR} "${ARM_COMPUTE_SOURCE_DIR}")
endif()

View File

@ -15,7 +15,7 @@ if(ENABLE_LTO)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
endif()
function(ie_add_onednn)
function(ov_add_onednn)
set(DNNL_ENABLE_JIT_PROFILING ${BUILD_SHARED_LIBS} CACHE BOOL "" FORCE)
if(BUILD_SHARED_LIBS AND ENABLE_PROFILING_ITT)
set(DNNL_ENABLE_ITT_TASKS ON CACHE BOOL "" FORCE)
@ -137,16 +137,26 @@ function(ie_add_onednn)
endif()
# to find our FindACL.cmake
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${intel_cpu_thirdparty_SOURCE_DIR}")
add_subdirectory(onednn EXCLUDE_FROM_ALL)
# install static libraries
ov_install_static_lib(dnnl cpu)
if(ARM OR AARCH64)
ov_install_static_lib(arm_compute_core cpu)
if(DNNL_USE_ACL AND NOT BUILD_SHARED_LIBS)
# use ACLConfig.cmake in OpenVINOConfig.cmake in case of static build
# we cannot use 'ov_install_static_lib' for imported targets,
# but for this we need to install library files
install(FILES $<TARGET_PROPERTY:arm_compute::arm_compute,IMPORTED_LOCATION>
DESTINATION ${OV_CPACK_ARCHIVEDIR}
COMPONENT cpu)
install(FILES "${intel_cpu_thirdparty_SOURCE_DIR}/ACLConfig.cmake"
DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
COMPONENT core_dev)
endif()
endfunction()
if(ENABLE_INTEL_CPU)
ie_add_onednn()
ov_add_onednn()
endif()

View File

@ -2,341 +2,4 @@
# SPDX-License-Identifier: Apache-2.0
#
if(ARM_COMPUTE_INCLUDE_DIR OR ARM_COMPUTE_LIB_DIR)
if (NOT ARM_COMPUTE_INCLUDE_DIR)
message(FATAL_ERROR "Undefined ARM_COMPUTE_INCLUDE_DIR input variable should be set manually")
else()
message(STATUS "Using ${ARM_COMPUTE_INCLUDE_DIR} to include arm compute library headers")
endif()
if (NOT ARM_COMPUTE_LIB_DIR)
message(FATAL_ERROR "Undefined ARM_COMPUTE_LIB_DIR input variable should be set manually")
else()
find_library(
ARM_COMPUTE_LIB
arm_compute-static
PATHS ${ARM_COMPUTE_LIB_DIR}
)
message(STATUS "Found arm_compute-static: ${ARM_COMPUTE_LIB}")
add_library(arm_compute STATIC IMPORTED GLOBAL)
set_target_properties(arm_compute PROPERTIES
IMPORTED_LOCATION ${ARM_COMPUTE_LIB}
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_INCLUDE_DIR})
endif()
add_library(half INTERFACE IMPORTED GLOBAL)
set_target_properties(half PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${ARM_COMPUTE_INCLUDE_DIR})
elseif(ENABLE_ARM_COMPUTE_CMAKE)
set(ARM_COMPUTE_SOURCE_DIR "${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary")
set(ARM_COMPUTE_BINARY_DIR "${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary")
function(ov_build_compute_library)
# build ComputeLibrary as static libraries
set(BUILD_SHARED_LIBS OFF)
# ComputeLibrary settings
set(ARM_COMPUTE_GRAPH_ENABLED OFF CACHE BOOL "" FORCE)
# disable OpenMP
set(OPENMP OFF CACHE BOOL "" FORCE)
# and use std::threads instead
set(CPPTHREADS OFF CACHE BOOL "" FORCE)
# SVE is not supported on Darwin
if(CMAKE_HOST_APPLE)
set(ENABLE_SVE OFF CACHE BOOL "" FORCE)
set(ARM_COMPUTE_ENABLE_SVE OFF CACHE BOOL "" FORCE)
set(ARM_COMPUTE_ENABLE_SVEF32MM OFF CACHE BOOL "" FORCE)
endif()
add_subdirectory(${ARM_COMPUTE_SOURCE_DIR} ${ARM_COMPUTE_BINARY_DIR} EXCLUDE_FROM_ALL)
add_library(ArmCompute::Half INTERFACE IMPORTED GLOBAL)
set_target_properties(ArmCompute::Half PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ARM_COMPUTE_SOURCE_DIR}/include")
endfunction()
ov_build_compute_library()
# Helpers for oneDNN intergation
set(ACL_FOUND ON)
set(ACL_LIBRARIES arm_compute_core ArmCompute::Half)
foreach(acl_library IN LISTS ACL_LIBRARIES)
list(APPEND ACL_INCLUDE_DIRS
$<TARGET_PROPERTY:${acl_library},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
# required by oneDNN to attempt to parse ACL version
set(ENV{ACL_ROOT_DIR} "${ARM_COMPUTE_SOURCE_DIR}")
else()
set(ARM_COMPUTE_SOURCE_DIR "${intel_cpu_thirdparty_SOURCE_DIR}/ComputeLibrary")
set(ARM_COMPUTE_BINARY_DIR "${intel_cpu_thirdparty_BINARY_DIR}/ComputeLibrary")
message(STATUS "Configure to build ${ARM_COMPUTE_SOURCE_DIR}")
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!")
endif()
file(GLOB_RECURSE SOURCES
${ARM_COMPUTE_SOURCE_DIR}/*.cpp
${ARM_COMPUTE_SOURCE_DIR}/*.hpp
${ARM_COMPUTE_SOURCE_DIR}/*.h
)
set(extra_cxx_flags "${CMAKE_CXX_FLAGS} -Wno-undef")
if(MSVC64)
# clang-cl does not recognize /MP option
string(REPLACE "/MP " "" extra_cxx_flags "${extra_cxx_flags}")
elseif(CMAKE_POSITION_INDEPENDENT_CODE)
# -fPIC is not applicable for clang-cl
set(extra_cxx_flags "${extra_cxx_flags} -fPIC")
endif()
set(ARM_COMPUTE_OPTIONS
neon=1
opencl=0
openmp=0
cppthreads=1
examples=0
Werror=0
gemm_tuner=0
reference_openmp=0
validation_tests=0
benchmark_tests=0
# TODO: check this for Apple Silicon
# multi_isa=1
# TODO: use CC for ARM compute library to minimize binary size
# build_config=<file>
# TODO: use data_type_support to disable useless kernels
data_layout_support=all
arch=${ARM_COMPUTE_TARGET_ARCH}
)
if(NOT MSVC64)
list(APPEND ARM_COMPUTE_OPTIONS
build_dir=${ARM_COMPUTE_BINARY_DIR}
install_dir=${ARM_COMPUTE_BINARY_DIR}/install)
endif()
if(ARM_COMPUTE_SCONS_JOBS)
list(APPEND ARM_COMPUTE_OPTIONS --jobs=${ARM_COMPUTE_SCONS_JOBS})
endif()
set(ARM_COMPUTE_DEBUG_OPTIONS
debug=1
asserts=1
logging=1)
# cmake older 3.20 does not support generator expressions in add_custom_command
# https://cmake.org/cmake/help/latest/command/add_custom_command.html#examples-generating-files
if(OV_GENERATOR_MULTI_CONFIG AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
foreach(option IN LISTS ARM_COMPUTE_DEBUG_OPTIONS)
list(APPEND ARM_COMPUTE_OPTIONS $<$<CONFIG:Debug>:${option}>
$<$<CONFIG:RelWithDebInfo>:${option}>)
endforeach()
foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER "${config}" config_upper)
set(flags ${CMAKE_CXX_FLAGS_${config_upper}})
set(extra_cxx_flags "${extra_cxx_flags} $<$<CONFIG:${config}>:${flags}>")
endforeach()
elseif(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
list(APPEND ARM_COMPUTE_OPTIONS ${ARM_COMPUTE_DEBUG_OPTIONS})
endif()
if(EMSCRIPTEN OR LINUX)
list(APPEND ARM_COMPUTE_OPTIONS os=linux)
elseif(ANDROID)
list(APPEND ARM_COMPUTE_OPTIONS os=android)
elseif(APPLE)
list(APPEND ARM_COMPUTE_OPTIONS os=macos)
elseif(WIN32)
list(APPEND ARM_COMPUTE_OPTIONS os=windows)
endif()
if(CMAKE_CROSSCOMPILING)
list(APPEND ARM_COMPUTE_OPTIONS build=cross_compile)
else()
list(APPEND ARM_COMPUTE_OPTIONS build=native)
endif()
if (CMAKE_CXX_COMPILER_LAUNCHER)
list(APPEND ARM_COMPUTE_OPTIONS compiler_cache=${CMAKE_CXX_COMPILER_LAUNCHER})
endif()
# used to build for yocto
if(ARM_COMPUTE_TOOLCHAIN_PREFIX)
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix=${ARM_COMPUTE_TOOLCHAIN_PREFIX})
endif()
if(ANDROID)
if(ANDROID_PLATFORM_LEVEL LESS 18)
message(FATAL_ERROR "ARM compute library requires Android API 18 level and higher"
"Please, speficy -DANDROID_PLATFORM=android-18 at least")
endif()
if(ANDROID_NDK_REVISION LESS "23.0")
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix="${ANDROID_TOOLCHAIN_PREFIX}")
else()
string(REGEX REPLACE "/bin/[^/]+-" "/bin/llvm-" ANDROID_TOOLCHAIN_PREFIX_FIXED "${ANDROID_TOOLCHAIN_PREFIX}")
message(STATUS "SCONS: using ANDROID_TOOLCHAIN_PREFIX=${ANDROID_TOOLCHAIN_PREFIX_FIXED}")
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix="${ANDROID_TOOLCHAIN_PREFIX_FIXED}")
endif()
list(APPEND ARM_COMPUTE_OPTIONS
compiler_prefix="${ANDROID_TOOLCHAIN_ROOT}/bin/")
set(extra_flags "${extra_flags} --target=${ANDROID_LLVM_TRIPLE}")
set(extra_flags "${extra_flags} --gcc-toolchain=${ANDROID_TOOLCHAIN_ROOT}")
set(extra_flags "${extra_flags} --sysroot=${CMAKE_SYSROOT}")
set(extra_link_flags "${extra_link_flags} ${extra_flags}")
set(extra_cxx_flags "${extra_cxx_flags} ${extra_flags}")
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)
set(cmake_build_env
CC=${c_compiler}
CXX=${cxx_compiler})
list(APPEND ARM_COMPUTE_OPTIONS compiler_prefix="${compiler_prefix}/")
elseif(EMSCRIPTEN)
set(cmake_build_env
CC=emcc
CXX=em++
RANLIB=emranlib
AR=emar)
# EMSDK: Passing any of -msse, -msse2, -msse3, -mssse3, -msse4.1, -msse4.2,
# -msse4, -mavx, -mfpu=neon flags also requires passing -msimd128 (or -mrelaxed-simd)!
set(extra_cxx_flags "${extra_cxx_flags} -msimd128")
# clang-16: error: argument unused during compilation: '-mthumb' [-Werror,-Wunused-command-line-argument]
# clang-16: error: argument unused during compilation: '-mfloat-abi=hard' [-Werror,-Wunused-command-line-argument]
set(extra_cxx_flags "${extra_cxx_flags} \
-Wno-unused-command-line-argument \
-Wno-unknown-warning-option \
-Wno-unused-function \
-Wno-unused-but-set-variable")
get_filename_component(toolchain_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY)
list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix="${toolchain_prefix}/")
elseif(APPLE)
if(CMAKE_OSX_DEPLOYMENT_TARGET)
set(extra_cxx_flags "${extra_cxx_flags} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(minos_added ON)
endif()
if(HOST_X86_64)
if(NOT minos_added)
message(FATAL_ERROR "Please, specify either env MACOSX_DEPLOYMENT_TARGET or cmake CMAKE_OSX_DEPLOYMENT_TARGET variables")
endif()
set(extra_cxx_flags "${extra_cxx_flags} --sysroot ${CMAKE_OSX_SYSROOT}")
endif()
set(extra_cxx_flags "${extra_cxx_flags} -Wno-error=return-stack-address")
get_filename_component(compiler_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY)
list(APPEND ARM_COMPUTE_OPTIONS compiler_prefix="${compiler_prefix}/")
if(CMAKE_OSX_ARCHITECTURES)
foreach(arch IN LISTS CMAKE_OSX_ARCHITECTURES)
set(extra_cxx_flags "${extra_cxx_flags} -arch ${arch}")
endforeach()
endif()
elseif(MSVC64)
# required for clang-cl compiler
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
set(extra_cxx_flags "${extra_cxx_flags} $<IF:$<CONFIG:Release>,/MD,/MDd>")
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(extra_cxx_flags "${extra_cxx_flags} /MDd")
else()
set(extra_cxx_flags "${extra_cxx_flags} /MD")
endif()
endif()
endif()
if(ENABLE_LTO)
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()
endif()
if(SUGGEST_OVERRIDE_SUPPORTED)
set(extra_cxx_flags "${extra_cxx_flags} -Wno-suggest-override")
endif()
if(extra_link_flags)
list(APPEND ARM_COMPUTE_OPTIONS extra_link_flags=${extra_link_flags})
endif()
if(extra_cxx_flags)
list(APPEND ARM_COMPUTE_OPTIONS extra_cxx_flags=${extra_cxx_flags})
endif()
if(NOT CMAKE_VERBOSE_MAKEFILE)
list(APPEND ARM_COMPUTE_OPTIONS --silent)
endif()
if(MSVC64)
set(arm_compute build/arm_compute-static.lib)
set(arm_compute_full_path "${ARM_COMPUTE_SOURCE_DIR}/${arm_compute}")
else()
set(arm_compute ${ARM_COMPUTE_BINARY_DIR}/libarm_compute-static.a)
set(arm_compute_full_path "${arm_compute}")
endif()
add_custom_command(
OUTPUT
${arm_compute_full_path}
COMMAND ${CMAKE_COMMAND} -E env ${cmake_build_env}
${SCONS} ${ARM_COMPUTE_OPTIONS}
${arm_compute}
WORKING_DIRECTORY ${ARM_COMPUTE_SOURCE_DIR}
COMMENT "Build Arm Compute Library"
DEPENDS ${SOURCES}
${CMAKE_CURRENT_LIST_FILE}
${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})
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_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
OSX_ARCHITECTURES arm64)
# Helpers for oneDNN intergation
set(ACL_FOUND ON)
set(ACL_LIBRARIES arm_compute::arm_compute arm_compute::half)
foreach(acl_library IN LISTS ACL_LIBRARIES)
list(APPEND ACL_INCLUDE_DIRS
$<TARGET_PROPERTY:${acl_library},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
# required by oneDNN to attempt to parse ACL version
set(ENV{ACL_ROOT_DIR} "${ARM_COMPUTE_SOURCE_DIR}")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/ACLConfig.cmake)

View File

@ -44,6 +44,7 @@ file(GLOB_RECURSE HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
find_package(libGNA REQUIRED
NO_MODULE
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
NO_DEFAULT_PATH)

View File

@ -19,25 +19,25 @@
#
# The example usage:
#
# find_package(libGNA COMPONENTS API KERNEL)
# find_package(libGNA NO_MODULE COMPONENTS API KERNEL)
#
set(libGNA_FOUND TRUE)
set(libGNA_FOUND ON)
set(GNA_KERNEL_LIB_NAME gna CACHE STRING "" FORCE)
if (NOT libGNA_FIND_COMPONENTS)
if(NOT libGNA_FIND_COMPONENTS)
set(libGNA_FIND_COMPONENTS "API;KERNEL")
endif()
foreach (_gna_component ${libGNA_FIND_COMPONENTS})
set(libGNA_${_gna_component}_FOUND FALSE)
set(libGNA_FIND_REQUIRED_${_gna_component} TRUE)
set(libGNA_${_gna_component}_FOUND OFF)
set(libGNA_FIND_REQUIRED_${_gna_component} ON)
endforeach()
set(libGNA_LIBRARIES_BASE_PATH ${GNA_PATH} CACHE STRING "" FORCE)
if(libGNA_FIND_REQUIRED_KERNEL)
if(libGNA_FIND_REQUIRED_KERNEL AND NOT TARGET libGNA::KERNEL)
find_library(GNA_KERNEL_LIBRARY ${GNA_KERNEL_LIB_NAME}
HINTS ${libGNA_LIBRARIES_BASE_PATH}
NO_CMAKE_FIND_ROOT_PATH)
@ -55,26 +55,34 @@ if(libGNA_FIND_REQUIRED_KERNEL)
IMPORTED_LOCATION_RELEASE "${GNA_KERNEL_LIBRARY}"
INTERFACE_LINK_OPTIONS "-Wl,-rpath-link,${libGNA_LIBRARIES_BASE_PATH}")
endif()
set(libGNA_KERNEL_FOUND TRUE)
else()
message(SEND_ERROR "GNA KERNEL library (${GNA_KERNEL_LIB_NAME}) was not found in ${libGNA_LIBRARIES_BASE_PATH}")
endif()
endif()
if(libGNA_FIND_REQUIRED_API)
if(libGNA_FIND_REQUIRED_API AND NOT TARGET libGNA::API)
find_path(libGNA_INCLUDE_DIRS gna2-api.h
PATHS "${GNA_EXT_DIR}/include"
NO_CMAKE_FIND_ROOT_PATH)
if(libGNA_INCLUDE_DIRS)
add_library(libGNA::API INTERFACE IMPORTED)
set_target_properties(libGNA::API PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${libGNA_INCLUDE_DIRS}")
set(libGNA_API_FOUND TRUE)
else()
message(SEND_ERROR "GNA API headers (gna2-api.h) was not found in ${GNA_EXT_DIR}/include")
endif()
endif()
add_library(libGNA INTERFACE IMPORTED)
foreach(_lib_name IN LISTS libGNA_FIND_COMPONENTS)
set_property(TARGET libGNA APPEND PROPERTY INTERFACE_LINK_LIBRARIES libGNA::${_lib_name})
endforeach(_lib_name)
if(TARGET libGNA::KERNEL)
set(libGNA_KERNEL_FOUND ON)
endif()
if(TARGET libGNA::API)
set(libGNA_API_FOUND ON)
endif()
if(NOT TARGET libGNA)
add_library(libGNA INTERFACE IMPORTED)
foreach(_lib_name IN LISTS libGNA_FIND_COMPONENTS)
set_property(TARGET libGNA APPEND PROPERTY INTERFACE_LINK_LIBRARIES libGNA::${_lib_name})
endforeach()
endif()

View File

@ -42,7 +42,7 @@ if (ENABLE_INTEL_GNA AND BUILD_SHARED_LIBS)
list(REMOVE_ITEM TEST_SRC "${gna_stub}")
add_library(libGNAStubs SHARED "${gna_stub}")
find_package(libGNA)
find_package(libGNA NO_MODULE REQUIRED)
target_include_directories(libGNAStubs PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/engines/gna/")
target_link_libraries(libGNAStubs PUBLIC libGNA::API gmock gtest)

View File

@ -10,7 +10,7 @@
namespace cldnn {
/// @brief Performs non max supression of input boxes and returns indices of selected boxes.
/// @brief Performs non max suppression of input boxes and returns indices of selected boxes.
/// @detail Filters out boxes that have high intersection-over-union (IOU) with previously
/// selected boxes with higher score. Boxes with score higher than score_threshold are
/// filtered out. This filtering happens per class.
@ -24,7 +24,7 @@ struct non_max_suppression : public primitive_base<non_max_suppression> {
DECLARE_OBJECT_TYPE_SERIALIZATION
/// @brief Creates non max supression primitive.
/// @brief Creates non max suppression primitive.
/// @param id This primitive id.
/// @param boxes_positions Id of primitive with bounding boxes.
/// @param boxes_score Id of primitive with boxes scores per class.

View File

@ -153,7 +153,7 @@ vector2D<bounding_box> load_boxes(stream& stream, memory::ptr mem, bool center_p
case cldnn::data_types::f32:
return load_boxes_impl<data_type_to_type<data_types::f32>::type>(stream, mem, center_point);
default:
throw std::runtime_error("Non max supression - unsupported boxes data type");
throw std::runtime_error("Non max suppression - unsupported boxes data type");
}
}
@ -190,7 +190,7 @@ vector3D<float> load_scores(stream& stream, memory::ptr mem) {
case cldnn::data_types::f32:
return load_scores_impl<data_type_to_type<data_types::f32>::type>(stream, mem);
default:
throw std::runtime_error("Non max supression - unsupported scores data type");
throw std::runtime_error("Non max suppression - unsupported scores data type");
}
}
@ -213,7 +213,7 @@ T load_scalar(stream& stream, memory::ptr mem) {
case cldnn::data_types::f32:
return load_scalar_impl<T, data_type_to_type<data_types::f32>::type>(stream, mem);
default:
throw std::runtime_error("Non max supression - unsupported data type");
throw std::runtime_error("Non max suppression - unsupported data type");
}
}
@ -253,7 +253,7 @@ void store_result(stream& stream, memory::ptr mem, const std::vector<result_indi
store_result_impl<data_type_to_type<data_types::f32>::type>(stream, mem, result);
break;
default:
throw std::runtime_error("Non max supression - unsupported output data type");
throw std::runtime_error("Non max suppression - unsupported output data type");
}
}
@ -267,7 +267,7 @@ void store_first_output(stream& stream, memory::ptr mem, const std::vector<resul
store_result_impl<data_type_to_type<data_types::i32>::type>(stream, mem, result);
break;
default:
throw std::runtime_error("Non max supression - unsupported output data type");
throw std::runtime_error("Non max suppression - unsupported output data type");
}
}
@ -304,7 +304,7 @@ void store_second_output(stream& stream, memory::ptr mem, const std::vector<resu
store_second_output_impl<data_type_to_type<data_types::f32>::type>(stream, mem, result);
break;
default:
throw std::runtime_error("Non max supression - unsupported second output data type");
throw std::runtime_error("Non max suppression - unsupported second output data type");
}
}
@ -325,7 +325,7 @@ void store_third_output(stream& stream, memory::ptr mem, const std::vector<resul
store_third_output_impl<data_type_to_type<data_types::i32>::type>(stream, mem, result);
break;
default:
throw std::runtime_error("Non max supression - unsupported third output data type");
throw std::runtime_error("Non max suppression - unsupported third output data type");
}
}

View File

@ -76,7 +76,7 @@ std::string non_max_suppression_inst::to_string(non_max_suppression_node const&
json_composite info;
info.add("center point box", desc->center_point_box);
node_info->add("non max supression info", info);
node_info->add("non max suppression info", info);
std::stringstream description;
node_info->dump(description);

View File

@ -14,6 +14,9 @@
#include <climits>
#ifdef _WIN32
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
#endif

View File

@ -64,9 +64,9 @@ static void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_pt
};
if (p.use_new_shape_infer()) {
auto nonMaxSupressionLayerName = layer_type_name_ID(op);
auto nonMaxSuppressionLayerName = layer_type_name_ID(op);
auto prim = cldnn::non_max_suppression(
nonMaxSupressionLayerName,
nonMaxSuppressionLayerName,
reordered_inputs[0],
reordered_inputs[1],
0,
@ -105,11 +105,11 @@ static void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_pt
GPU_DEBUG_LOG << "[" << layer_type_name_ID(op) << ": mutable data]" << std::endl;
shared_memory.emplace_back(p.get_engine().allocate_memory(mutableLayoutSecond));
cldnn::primitive_id non_max_supression_mutable_id_w_second = layer_type_name_ID(op) + "_md_write_second";
auto nms_mutable_prim_second = cldnn::mutable_data(non_max_supression_mutable_id_w_second,
cldnn::primitive_id non_max_suppression_mutable_id_w_second = layer_type_name_ID(op) + "_md_write_second";
auto nms_mutable_prim_second = cldnn::mutable_data(non_max_suppression_mutable_id_w_second,
shared_memory.back());
p.add_primitive(*op, nms_mutable_prim_second);
inputs.push_back(cldnn::input_info(non_max_supression_mutable_id_w_second));
inputs.push_back(cldnn::input_info(non_max_suppression_mutable_id_w_second));
}
case 2: {
auto mutable_precision_first = op->get_output_element_type(1);
@ -121,20 +121,20 @@ static void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_pt
GPU_DEBUG_LOG << "[" << layer_type_name_ID(op) << ": mutable data]" << std::endl;
shared_memory.emplace_back(p.get_engine().allocate_memory(mutableLayoutFirst));
cldnn::primitive_id non_max_supression_mutable_id_w_first = layer_type_name_ID(op) + "_md_write_first";
auto nms_mutable_prim_first = cldnn::mutable_data(non_max_supression_mutable_id_w_first,
cldnn::primitive_id non_max_suppression_mutable_id_w_first = layer_type_name_ID(op) + "_md_write_first";
auto nms_mutable_prim_first = cldnn::mutable_data(non_max_suppression_mutable_id_w_first,
shared_memory.back());
p.add_primitive(*op, nms_mutable_prim_first);
inputs.push_back(cldnn::input_info(non_max_supression_mutable_id_w_first));
inputs.push_back(cldnn::input_info(non_max_suppression_mutable_id_w_first));
}
case 1: break;
default: IE_THROW() << "Incorrect number of output for layer: " << op->get_friendly_name();
}
auto nonMaxSupressionLayerName = num_outputs > 1 ? layer_type_name_ID(op) + ".out0" : layer_type_name_ID(op);
auto nonMaxSuppressionLayerName = num_outputs > 1 ? layer_type_name_ID(op) + ".out0" : layer_type_name_ID(op);
auto prim = cldnn::non_max_suppression(
nonMaxSupressionLayerName,
nonMaxSuppressionLayerName,
reordered_inputs[0],
reordered_inputs[1],
static_cast<int>(outputIndices),
@ -163,16 +163,16 @@ static void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_pt
switch (num_outputs) {
case 3: {
cldnn::primitive_id non_max_supression_id_r_second = layer_type_name_ID(op) + ".out2";
auto nms_mutable_prim_r_second = cldnn::mutable_data(non_max_supression_id_r_second,
{ cldnn::input_info(nonMaxSupressionLayerName) },
cldnn::primitive_id non_max_suppression_id_r_second = layer_type_name_ID(op) + ".out2";
auto nms_mutable_prim_r_second = cldnn::mutable_data(non_max_suppression_id_r_second,
{ cldnn::input_info(nonMaxSuppressionLayerName) },
shared_memory.front());
p.add_primitive(*op, nms_mutable_prim_r_second);
}
case 2: {
cldnn::primitive_id non_max_supression_id_r_first = layer_type_name_ID(op) + ".out1";
auto nms_mutable_prim_r_first = cldnn::mutable_data(non_max_supression_id_r_first,
{ cldnn::input_info(nonMaxSupressionLayerName) },
cldnn::primitive_id non_max_suppression_id_r_first = layer_type_name_ID(op) + ".out1";
auto nms_mutable_prim_r_first = cldnn::mutable_data(non_max_suppression_id_r_first,
{ cldnn::input_info(nonMaxSuppressionLayerName) },
shared_memory.back());
p.add_primitive(*op, nms_mutable_prim_r_first);
}

View File

@ -19,7 +19,10 @@
#include <algorithm>
#if defined(_WIN32)
#include <windows.h>
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
static size_t get_cpu_ram_size() {
MEMORYSTATUSEX s {};
@ -28,15 +31,15 @@ static size_t get_cpu_ram_size() {
return s.ullTotalPhys;
}
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__QNXNTO__)
#include <unistd.h>
#include <sys/sysctl.h>
# include <unistd.h>
# include <sys/sysctl.h>
static size_t get_cpu_ram_size() {
#ifdef __APPLE__
# ifdef __APPLE__
int query_ram[] = {CTL_HW, HW_MEMSIZE};
#else
# else
int query_ram[] = {CTL_HW, HW_PHYSMEM};
#endif
# endif
int query_ram_len = sizeof(query_ram) / sizeof(*query_ram);
size_t totalram = 0;
size_t length = sizeof(totalram);
@ -45,7 +48,7 @@ static size_t get_cpu_ram_size() {
return totalram;
}
#else
#include <sys/sysinfo.h>
# include <sys/sysinfo.h>
static size_t get_cpu_ram_size() {
struct sysinfo s {};

View File

@ -24,6 +24,9 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#include <setupapi.h>
#include <devguid.h>

View File

@ -104,6 +104,9 @@ if(ENABLE_ONEDNN_FOR_GPU)
"-DONEDNN_BUILD_GRAPH=OFF"
"-DOpenCL_LIBRARY=${OpenCL_LIBRARY}"
"-DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIR}"
# specifically for Conan, because it overrides CMAKE_PREFIX_PATH and oneDNN's FindOpenCL.cmake is ignored
# Conan's FindOpenCL.cmake module does not set OpenCL_INCLUDE_DIRS, so we need to set it manually
"-DOpenCL_INCLUDE_DIRS=${OpenCL_INCLUDE_DIR}"
)
add_library(onednn_gpu_tgt INTERFACE)
set_target_properties(onednn_gpu_tgt PROPERTIES

View File

@ -8,7 +8,7 @@ import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestNonMaxSupression(CommonTFLayerTest):
class TestNonMaxSuppression(CommonTFLayerTest):
# overload inputs generation to suit NMS use case
def _prepare_input(self, inputs_dict):
@ -83,7 +83,7 @@ class TestNonMaxSupression(CommonTFLayerTest):
@pytest.mark.nightly
@pytest.mark.precommit
@pytest.mark.precommit_tf_fe
def test_NonMaxSupression(self, test_params, ie_device, precision, ir_version, temp_dir,
def test_NonMaxSuppression(self, test_params, ie_device, precision, ir_version, temp_dir,
use_new_frontend, use_old_api):
if ie_device == 'GPU':
pytest.skip("Skip TF NonMaxSuppresion test on GPU")
@ -96,7 +96,7 @@ class TestNonMaxSupression(CommonTFLayerTest):
@pytest.mark.nightly
@pytest.mark.precommit
@pytest.mark.precommit_tf_fe
def test_NonMaxSupressionWithScores(self, test_params, ie_device, precision, ir_version, temp_dir,
def test_NonMaxSuppressionWithScores(self, test_params, ie_device, precision, ir_version, temp_dir,
use_new_frontend, use_old_api):
if ie_device == 'GPU':
pytest.skip("Skip TF NonMaxSuppresionWithScores test on GPU")

View File

@ -18,7 +18,20 @@ if(ENABLE_LTO)
endif()
if(ENABLE_PROFILING_ITT)
add_subdirectory(ittapi)
find_package(ittapi QUIET)
if(ittapi_FOUND)
# conan defines 'ittapi::ittapi' target
# create more common alias 'ittapi::ittnotify'
set_target_properties(ittapi::ittapi PROPERTIES
IMPORTED_GLOBAL ON
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
add_library(ittapi::ittnotify ALIAS ittapi::ittapi)
# set ittapi_FOUND to parent scope to properly generate OpenVINOConfig.cmake for static build
set(ittapi_FOUND ${ittapi_FOUND} PARENT_SCOPE)
else()
add_subdirectory(ittapi)
endif()
add_subdirectory(itt_collector EXCLUDE_FROM_ALL)
endif()
@ -26,9 +39,18 @@ if(ENABLE_SAMPLES OR ENABLE_TESTS)
add_subdirectory(cnpy EXCLUDE_FROM_ALL)
endif()
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS xbyak)
ov_install_static_lib(xbyak ${OV_CPACK_COMP_CORE})
if(X86_64 OR UNIVERSAL2)
find_package(xbyak QUIET)
if(xbyak_FOUND)
# conan creates alias xbyak::xbyak, we only need to make it GLOBAL
set_target_properties(xbyak::xbyak PROPERTIES IMPORTED_GLOBAL ON)
else()
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
# export and install xbyak
openvino_developer_export_targets(COMPONENT openvino_common TARGETS xbyak::xbyak)
ov_install_static_lib(xbyak ${OV_CPACK_COMP_CORE})
endif()
endif()
#
# OpenCL
@ -36,30 +58,41 @@ ov_install_static_lib(xbyak ${OV_CPACK_COMP_CORE})
if(ENABLE_INTEL_GPU)
if(ENABLE_SYSTEM_OPENCL)
# try to find system OpenCL (installed via 'brew install opencl-icd-loader')
# try to find system OpenCL:
# - 'brew install opencl-icd-loader'
# - 'conan install opencl-icd-loader'
find_package(OpenCLICDLoader QUIET)
if(OpenCLICDLoader_FOUND)
# 'brew install opencl-headers'
# examples:
# - 'brew install opencl-headers'
# - 'conan install opencl-headers'
find_package(OpenCLHeaders QUIET)
if(NOT OpenCLHeaders_FOUND)
message(WARNING "OpenCLHeaders not found, but OpenCLICDLoader is installed. Please, install OpenCL headers")
else()
set_target_properties(OpenCL::Headers PROPERTIES IMPORTED_GLOBAL ON)
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenCL::Headers)
endif()
# 'brew install opencl-clhpp-gheaders'
# examples:
# - 'brew install opencl-clhpp-headers'
# - 'conan install opencl-clhpp-headers'
find_package(OpenCLHeadersCpp QUIET)
if(NOT OpenCLHeadersCpp_FOUND)
message(WARNING "OpenCLHeadersCpp not found, but OpenCLICDLoader is installed. Please, install OpenCL C++ headers")
else()
set_target_properties(OpenCL::HeadersCpp PROPERTIES IMPORTED_GLOBAL ON)
get_target_property(opencl_cpp_include_dirs OpenCL::HeadersCpp INTERFACE_INCLUDE_DIRECTORIES)
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenCL::HeadersCpp)
endif()
# set OpenCLICDLoader_FOUND to parent scope to generate proper OpenVINOConfig.cmake for static libraries case
set(OpenCLICDLoader_FOUND ON PARENT_SCOPE)
else()
# try to find system OpenCL:
# - 'sudo -E apt-get install opencl-headers ocl-icd-opencl-dev'
# - 'sudo -E yum install ocl-icd-devel opencl-headers'
# - 'apt-get install opencl-headers ocl-icd-opencl-dev'
# - 'yum install ocl-icd-devel opencl-headers'
# - 'conda install khronos-opencl-icd-loader -c conda-forge'
find_package(OpenCL QUIET)
endif()
@ -105,6 +138,9 @@ if(ENABLE_INTEL_GPU)
set(OpenCL_INCLUDE_DIR "${OpenCL_INCLUDE_DIR}" PARENT_SCOPE)
set(OpenCL_LIBRARY "${OpenCL_LIBRARY}" PARENT_SCOPE)
set(opencl_root_hints "${opencl_root_hints}" PARENT_SCOPE)
# system OpenCL is not found: set it explictly for consistent OpenVINOConfig.cmake generation
set(ENABLE_SYSTEM_OPENCL OFF PARENT_SCOPE)
endif()
# cmake cannot set properties for imported targets
@ -136,17 +172,24 @@ endif()
#
if(ENABLE_SAMPLES OR ENABLE_TESTS)
if(PkgConfig_FOUND)
find_package(ZLIB QUIET NO_MODULE)
if(ZLIB_FOUND)
# need to make it global to use outside of the current sub-directory
set_target_properties(ZLIB::ZLIB PROPERTIES IMPORTED_GLOBAL ON)
endif()
# cmake has failed to find zlib, let's try pkg-config
if(NOT ZLIB_FOUND AND PkgConfig_FOUND)
pkg_search_module(zlib QUIET
IMPORTED_TARGET GLOBAL
zlib)
if(zlib_FOUND)
add_library(zlib::zlib ALIAS PkgConfig::zlib)
add_library(ZLIB::ZLIB ALIAS PkgConfig::zlib)
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
endif()
endif()
if(NOT zlib_FOUND)
if(NOT (zlib_FOUND OR ZLIB_FOUND))
add_subdirectory(zlib EXCLUDE_FROM_ALL)
endif()
endif()
@ -159,20 +202,22 @@ if(ENABLE_SYSTEM_PUGIXML)
# try system pugixml first
find_package(PugiXML QUIET)
if(PugiXML_FOUND)
# TODO: use static pugixml library in case of BUILD_SHARED_LIBS=OFF
if(TARGET pugixml::shared)
# example: cross-compilation on debian
set(pugixml_target pugixml::shared)
elseif(TARGET pugixml::pugixml)
# or create an alias for pugixml::pugixml shared library
# example: pugixml brew package
# - 'brew install pugixml'
# - 'conan install pugixml'
set(pugixml_target pugixml::pugixml)
elseif(TARGET pugixml)
# or create an alias for pugixml shared library
# example: libpugixml-dev debian package
# - 'apt-get install libpugixml-dev'
set(pugixml_target pugixml)
elseif(TARGET pugixml::static)
# sometimes pugixml::static target already exists, just need to make it global
# example: building using conda environment
# - 'conda install pugixml -c conda-forge'
set(pugixml_target pugixml::static)
else()
message(FATAL_ERROR "Failed to detect pugixml library target name")
@ -182,7 +227,8 @@ if(ENABLE_SYSTEM_PUGIXML)
elseif(PkgConfig_FOUND)
# U18 case when cmake interface is not available
pkg_search_module(pugixml QUIET
IMPORTED_TARGET GLOBAL
IMPORTED_TARGET
GLOBAL
pugixml)
if(pugixml_FOUND)
set(pugixml_target PkgConfig::pugixml)
@ -237,26 +283,27 @@ if(ENABLE_SYSTEM_PUGIXML)
# create an alias for real target which can be shared or static
add_library(openvino::pugixml ALIAS ${pugixml_target})
else()
# reset to prevent improper code generation in OpenVINODeveloperPackage
set(ENABLE_SYSTEM_PUGIXML OFF CACHE BOOL "" FORCE)
# reset to prevent improper code generation in OpenVINODeveloperPackage.cmake,
# and OpenVINOConfig.cmake for static case
set(ENABLE_SYSTEM_PUGIXML OFF PARENT_SCOPE)
endif()
endif()
if(NOT TARGET openvino::pugixml)
# use OpenVINO pugixml copy if system one is not found
function(ie_build_pugixml)
function(ie_build_pugixml_static)
function(ov_build_pugixml)
function(ov_build_pugixml_static)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(pugixml EXCLUDE_FROM_ALL)
endfunction()
ie_build_pugixml_static()
ov_build_pugixml_static()
set_property(TARGET pugixml-static PROPERTY EXPORT_NAME pugixml)
add_library(openvino::pugixml ALIAS pugixml-static)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS openvino::pugixml)
ov_install_static_lib(pugixml-static ${OV_CPACK_COMP_CORE})
endfunction()
ie_build_pugixml()
ov_build_pugixml()
endif()
#
@ -267,7 +314,23 @@ if(ENABLE_GAPI_PREPROCESSING)
add_library(ocv_hal INTERFACE)
target_include_directories(ocv_hal INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ocv")
add_subdirectory(ade EXCLUDE_FROM_ALL)
# ade
find_package(ade 0.1.2 QUIET)
if(ade_FOUND)
# conan creates 'ade' target
# set ade_FOUND to parent scope to properly generate OpenVINOConfig.cmake for static build
set(ade_FOUND ${ade_FOUND} PARENT_SCOPE)
else()
add_subdirectory(ade EXCLUDE_FROM_ALL)
set_target_properties(ade PROPERTIES FOLDER thirdparty)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ade)
ov_install_static_lib(ade ${OV_CPACK_COMP_CORE})
endif()
# fluid
add_subdirectory(fluid/modules/gapi EXCLUDE_FROM_ALL)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
@ -277,10 +340,9 @@ if(ENABLE_GAPI_PREPROCESSING)
target_compile_options(fluid PRIVATE "-Wno-unused-but-set-variable")
endif()
set_target_properties(ade fluid PROPERTIES FOLDER thirdparty)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ade fluid)
set_target_properties(fluid PROPERTIES FOLDER thirdparty)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS fluid)
ov_install_static_lib(ade ${OV_CPACK_COMP_CORE})
ov_install_static_lib(fluid ${OV_CPACK_COMP_CORE})
endif()
@ -297,6 +359,9 @@ if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
set(gflag_component nothreads_static)
endif()
find_package(gflags QUIET OPTIONAL_COMPONENTS ${gflag_component})
else()
# conan case
find_package(gflags QUIET)
endif()
if(gflags_FOUND)
@ -352,17 +417,22 @@ endif()
if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND)
if(ENABLE_SYSTEM_PROTOBUF)
# Note: Debian / Ubuntu / RHEL libprotobuf.a can only be used with -DBUILD_SHARED_LIBS=OFF
# because they are compiled without -fPIC
set(Protobuf_USE_STATIC_LIBS ON)
if(CMAKE_VERBOSE_MAKEFILE)
set(Protobuf_DEBUG ON)
endif()
find_package(Protobuf 3.20.3 REQUIRED)
set(Protobuf_LITE_LIBRARIES protobuf::libprotobuf-lite)
set(Protobuf_LIBRARIES protobuf::libprotobuf)
set(PROTOC_EXECUTABLE protobuf::protoc)
foreach(target IN LISTS PROTOC_EXECUTABLE Protobuf_LIBRARIES Protobuf_LITE_LIBRARIES)
set_property(TARGET ${target} PROPERTY IMPORTED_GLOBAL ON)
# in case of system protobuf, we have to add version to OpenVINOConfig.cmake for static build
# to ensure no mismatch between versions of protoc and libprotobuf, we need to use exactly
# the same versions
set(Protobuf_VERSION ${Protobuf_VERSION} PARENT_SCOPE)
foreach(target ${PROTOC_EXECUTABLE} protobuf::libprotobuf protobuf::libprotobuf-lite)
set_target_properties(${target} PROPERTIES IMPORTED_GLOBAL ON)
endforeach()
else()
add_subdirectory(protobuf EXCLUDE_FROM_ALL)
@ -371,34 +441,40 @@ if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND
# forward variables used in the other places
set(PROTOC_DEPENDENCY ${PROTOC_DEPENDENCY} PARENT_SCOPE)
set(PROTOC_EXECUTABLE ${PROTOC_EXECUTABLE} PARENT_SCOPE)
set(Protobuf_LIBRARIES ${Protobuf_LIBRARIES} PARENT_SCOPE)
set(Protobuf_LITE_LIBRARIES ${Protobuf_LITE_LIBRARIES} PARENT_SCOPE)
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE)
set(Protobuf_IN_FRONTEND ON PARENT_SCOPE)
# set public / interface compile options
foreach(target IN LISTS Protobuf_LITE_LIBRARIES Protobuf_LIBRARIES)
foreach(target_name protobuf::libprotobuf protobuf::libprotobuf-lite)
set(link_type PUBLIC)
if(ENABLE_SYSTEM_PROTOBUF)
set(link_type INTERFACE)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
target_compile_options(${target} ${link_type} -Wno-undef)
get_target_property(original_name ${target_name} ALIASED_TARGET)
if(TARGET ${original_name})
# during build protobuf's cmake creates aliased targets
set(target_name ${original_name})
endif()
target_compile_options(${target_name} ${link_type} -Wno-undef)
endif()
endforeach()
endif()
#
# Flat Buffers
# FlatBuffers
#
if(ENABLE_OV_TF_LITE_FRONTEND)
if(ENABLE_SYSTEM_FLATBUFFERS)
if(CMAKE_HOST_LINUX AND EMSCRIPTEN AND HOST_X86_64)
if(CMAKE_HOST_LINUX AND EMSCRIPTEN)
set(_old_flat_CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE})
# without this WA cmake does not search in <triplet> subfolder
# see https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
if(HOST_X86_64)
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
elseif(HOST_AARCH64)
set(CMAKE_LIBRARY_ARCHITECTURE "aarch64-linux-gnu")
endif()
endif()
find_host_package(Flatbuffers QUIET NO_CMAKE_FIND_ROOT_PATH)
@ -433,10 +509,24 @@ endif()
if(ENABLE_SNAPPY_COMPRESSION)
if(ENABLE_SYSTEM_SNAPPY)
find_package(Snappy REQUIRED)
set_target_properties(Snappy::snappy PROPERTIES IMPORTED_GLOBAL ON)
set(ov_snappy_lib Snappy::snappy)
if(NOT BUILD_SHARED_LIBS AND TARGET Snappy::snappy-static)
# we can use static library only in static build, because in case od dynamic build
# the libsnappy.a should be compiled with -fPIC, while Debian / Ubuntu / RHEL don't do it
set(ov_snappy_lib Snappy::snappy-static)
endif()
set_target_properties(${ov_snappy_lib} PROPERTIES IMPORTED_GLOBAL ON)
add_library(openvino::snappy ALIAS ${ov_snappy_lib})
# set Snappy_VERSION to parent scope for consistent OpenVINOConfig.cmake generation
# in case of static build with system dependencies
set(Snappy_VERSION ${Snappy_VERSION} PARENT_SCOPE)
set(ov_snappy_lib ${ov_snappy_lib} PARENT_SCOPE)
endif()
if(NOT TARGET Snappy::snappy)
if(NOT TARGET openvino::snappy)
function(ov_build_snappy)
set(BUILD_SHARED_LIBS OFF)
set(SNAPPY_BUILD_BENCHMARKS OFF)
@ -462,10 +552,10 @@ if(ENABLE_SNAPPY_COMPRESSION)
endif()
add_subdirectory(snappy EXCLUDE_FROM_ALL)
# need to create alias Snappy::snappy
add_library(Snappy::snappy ALIAS snappy)
# need to create alias openvino::snappy
add_library(openvino::snappy ALIAS snappy)
# WA for emscriptem build which currently requires -fexceptions
# WA for emscripten build which currently requires -fexceptions
if(EMSCRIPTEN)
target_compile_options(snappy PRIVATE "-fexceptions")
endif()
@ -481,7 +571,19 @@ endif()
#
if(ENABLE_OV_ONNX_FRONTEND)
add_subdirectory(onnx)
find_package(ONNX 1.13.1 EXACT QUIET COMPONENTS onnx onnx_proto NO_MODULE)
if(ONNX_FOUND)
# conan creates imported targets 'onnx' and 'onnx_proto'
set_target_properties(onnx onnx_proto PROPERTIES IMPORTED_GLOBAL ON)
# set ONNX_VERSION to parent scope for correct OpenVINOConfig.cmake generation
# in case of static libraries
set(ONNX_VERSION ${ONNX_VERSION} PARENT_SCOPE)
set(ENABLE_SYSTEM_ONNX ON PARENT_SCOPE)
else()
add_subdirectory(onnx)
endif()
endif()
#
@ -489,18 +591,26 @@ endif()
#
if(ENABLE_SAMPLES)
add_subdirectory(json)
# Note: VPUX requires 3.9.0 version, because it contains 'nlohmann::ordered_json'
find_package(nlohmann_json 3.9.0 QUIET)
if(nlohmann_json_FOUND)
# conan creates imported target nlohmann_json::nlohmann_json
# no needs to make the target global, because samples call find_package(nlohmann_json) as well
# but we need to set nlohmann_json_FOUND to parent scope to properly generate InferenceEngineDeveloperPackageConfig.cmake
set(nlohmann_json_FOUND ${nlohmann_json_FOUND} PARENT_SCOPE)
else()
add_subdirectory(json)
# this is required only because of VPUX plugin reused this
openvino_developer_export_targets(COMPONENT openvino_common
TARGETS nlohmann_json)
# this is required only because of VPUX plugin reused this
openvino_developer_export_targets(COMPONENT openvino_common TARGETS nlohmann_json)
# for nlohmann library version v3.0.0 and later
if(NOT TARGET nlohmann_json::nlohmann_json)
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED GLOBAL)
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
INTERFACE_LINK_LIBRARIES nlohmann_json
INTERFACE_COMPILE_DEFINITIONS JSON_HEADER)
# for nlohmann library versions older than v3.0.0
if(NOT TARGET nlohmann_json::nlohmann_json)
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED GLOBAL)
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
INTERFACE_LINK_LIBRARIES nlohmann_json
INTERFACE_COMPILE_DEFINITIONS JSON_HEADER)
endif()
endif()
endif()
@ -508,14 +618,14 @@ endif()
# Install
#
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW)$")
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW|CONAN)$")
# These libraries are dependencies for openvino-samples package
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
if(NOT gflags_FOUND)
message(FATAL_ERROR "gflags must be used as a ${CPACK_GENERATOR} package. Install libgflags-dev / gflags-devel")
endif()
if(NOT zlib_FOUND)
if(NOT (zlib_FOUND OR ZLIB_FOUND))
message(FATAL_ERROR "zlib must be used as a ${CPACK_GENERATOR} package. Install zlib1g-dev / zlib-devel")
endif()
endif()

View File

@ -13,7 +13,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
PRIVATE -Wno-all)
endif()
target_link_libraries(${TARGET_NAME} PUBLIC zlib::zlib)
target_link_libraries(${TARGET_NAME} PUBLIC ZLIB::ZLIB)
target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER thirdparty)

View File

@ -95,7 +95,7 @@ GAPI_EXPORTS_W GArray<Rect> parseSSD(const GMat& in,
/** @brief Parses output of Yolo network.
Extracts detection information (box, confidence, label) from Yolo output,
filters it by given confidence and performs non-maximum supression for overlapping boxes.
filters it by given confidence and performs non-maximum suppression for overlapping boxes.
@note Function textual ID is "org.opencv.nn.parsers.parseYolo"
@ -105,7 +105,7 @@ where num_classes - a number of classes Yolo network was trained with.
@param inSz Size to project detected boxes to (size of the input image).
@param confidenceThreshold If confidence of the
detection is smaller than confidence threshold, detection is rejected.
@param nmsThreshold Non-maximum supression threshold which controls minimum
@param nmsThreshold Non-maximum suppression threshold which controls minimum
relative box intersection area required for rejecting the box with a smaller confidence.
If 1.f, nms is not performed and no boxes are rejected.
@param anchors Anchors Yolo network was trained with.

View File

@ -27,15 +27,18 @@ add_library(${TARGET_NAME} SHARED ${SOURCES})
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME IntelSEAPI)
target_link_libraries(${TARGET_NAME} PRIVATE ittnotify)
target_link_libraries(${TARGET_NAME} PRIVATE ittapi::ittnotify)
if(UNIX)
target_link_libraries(${TARGET_NAME} PRIVATE dl)
target_compile_options(${TARGET_NAME} PRIVATE -Wno-undef -Wno-deprecated-declarations -Wno-multichar)
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS})
elseif(WIN32)
target_link_libraries(${TARGET_NAME} PRIVATE Dbghelp)
endif()
if(CMAKE_COMPILER_IS_GNUCC OR OV_COMPILER_IS_CLANG)
target_compile_options(${TARGET_NAME} PRIVATE -Wno-undef -Wno-deprecated-declarations -Wno-multichar)
endif()
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
install(TARGETS ${TARGET_NAME}

View File

@ -10,7 +10,7 @@ if(DEFINED INTEL_VTUNE_DIR OR DEFINED ENV{INTEL_VTUNE_DIR})
message(WARNING "Profiling option enabled, but no ITT library was found under INTEL_VTUNE_DIR")
endif()
else()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ittapi ${CMAKE_BINARY_DIR}/_deps/ittapi EXCLUDE_FROM_ALL)
add_subdirectory(ittapi EXCLUDE_FROM_ALL)
target_compile_definitions(ittnotify INTERFACE ENABLE_PROFILING_ITT)
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
@ -22,6 +22,9 @@ else()
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ittapi/src/ittnotify>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ittapi/include>)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ittnotify)
ov_install_static_lib(ittnotify ${OV_CPACK_COMP_CORE})
# create alias ittapi::ittnotify
add_library(ittapi::ittnotify ALIAS ittnotify)
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ittapi::ittnotify)
ov_install_static_lib(ittapi::ittnotify ${OV_CPACK_COMP_CORE})
endif()

View File

@ -41,8 +41,10 @@ endfunction()
ov_onnx_build_static()
target_include_directories(onnx SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
target_include_directories(onnx_proto SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
foreach(_onnx_target onnx onnx_proto)
target_include_directories(${_onnx_target} SYSTEM PRIVATE
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
if(WIN32)
# from onnx==1.13.1 it requires C++17 when compiling on Windows
@ -62,12 +64,14 @@ ov_install_static_lib(onnx ${OV_CPACK_COMP_CORE})
ov_install_static_lib(onnx_proto ${OV_CPACK_COMP_CORE})
# WA for ONNX: protobuf must be in the same export set of ONNX targets
if(NOT BUILD_SHARED_LIBS)
# in case of protobuf::libprotobuf-lite / protobuf::libprotobuf are imported targets
if(NOT ENABLE_SYSTEM_PROTOBUF)
if(ONNX_USE_LITE_PROTO)
install(TARGETS ${Protobuf_LITE_LIBRARIES} EXPORT ONNXTargets
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${OV_CPACK_COMP_CORE})
set(protobuf_target_name libprotobuf-lite)
else()
install(TARGETS ${Protobuf_LIBRARIES} EXPORT ONNXTargets
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${OV_CPACK_COMP_CORE})
set(protobuf_target_name libprotobuf)
endif()
install(TARGETS ${protobuf_target_name} EXPORT ONNXTargets
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${OV_CPACK_COMP_CORE})
endif()

View File

@ -96,10 +96,3 @@ else()
set(PROTOC_EXECUTABLE $<TARGET_FILE:protoc> PARENT_SCOPE)
set(PROTOC_DEPENDENCY protoc PARENT_SCOPE)
endif()
# set to parent scope
set(protobuf_VERSION ${protobuf_VERSION} PARENT_SCOPE)
set(Protobuf_LITE_LIBRARIES libprotobuf-lite PARENT_SCOPE)
set(Protobuf_LIBRARIES libprotobuf PARENT_SCOPE)
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE)

View File

@ -55,8 +55,8 @@ set(zlib_ext_hdrs
zlib/zconf.h)
add_library(${TARGET_NAME} STATIC ${zlib_srcs} ${zlib_hdrs} ${lib_ext_hdrs})
add_library(${TARGET_NAME}::${TARGET_NAME} ALIAS ${TARGET_NAME})
add_library(ZLIB::ZLIB ALIAS ${TARGET_NAME})
target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/zlib")
set_target_properties(zlib PROPERTIES FOLDER thirdparty)
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER thirdparty)

View File

@ -38,7 +38,7 @@ ov_cpack_add_component(${OV_CPACK_COMP_CORE_TOOLS}
HIDDEN
DEPENDS ${OV_CPACK_COMP_CORE})
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW)$")
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW|CONAN)$")
install(TARGETS compile_tool
RUNTIME DESTINATION ${OV_CPACK_TOOLSDIR}
COMPONENT ${OV_CPACK_COMP_CORE_TOOLS})

View File

@ -580,7 +580,7 @@ class IgnoredAction(argparse.Action):
def canonicalize_and_check_paths(values: Union[str, List[str]], param_name,
try_mo_root=False, check_existance=True) -> List[str]:
try_mo_root=False, check_existence=True) -> List[str]:
if values is not None:
list_of_values = list()
if isinstance(values, str):
@ -591,7 +591,7 @@ def canonicalize_and_check_paths(values: Union[str, List[str]], param_name,
else:
raise Error('Unsupported type of command line parameter "{}" value'.format(param_name))
if not check_existance:
if not check_existence:
return [get_absolute_path(path) for path in list_of_values]
for idx, val in enumerate(list_of_values):
@ -619,7 +619,7 @@ class CanonicalizePathAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
list_of_paths = canonicalize_and_check_paths(values, param_name=option_string,
try_mo_root=False, check_existance=False)
try_mo_root=False, check_existence=False)
setattr(namespace, self.dest, ','.join(list_of_paths))
@ -631,7 +631,7 @@ class CanonicalizeTransformationPathCheckExistenceAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
list_of_paths = canonicalize_and_check_paths(values, param_name=option_string,
try_mo_root=True, check_existance=True)
try_mo_root=True, check_existence=True)
setattr(namespace, self.dest, ','.join(list_of_paths))
@ -643,7 +643,7 @@ class CanonicalizePathCheckExistenceAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
list_of_paths = canonicalize_and_check_paths(values, param_name=option_string,
try_mo_root=False, check_existance=True)
try_mo_root=False, check_existence=True)
setattr(namespace, self.dest, ','.join(list_of_paths))
@ -655,7 +655,7 @@ class CanonicalizeExtensionsPathCheckExistenceAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
list_of_paths = canonicalize_and_check_paths(values, param_name=option_string,
try_mo_root=False, check_existance=True)
try_mo_root=False, check_existence=True)
# Extensions paths are needed to be stored as list
setattr(namespace, self.dest, list_of_paths)