diff --git a/.ci/azure/android_arm64.yml b/.ci/azure/android_arm64.yml index 31bf5b69829..8f639c7e119 100644 --- a/.ci/azure/android_arm64.yml +++ b/.ci/azure/android_arm64.yml @@ -31,6 +31,13 @@ pr: - 'tools/*' - 'tests/layer_tests/*' +resources: + repositories: + - repository: vcpkg + type: github + endpoint: openvinotoolkit + name: microsoft/vcpkg + variables: - group: github @@ -48,9 +55,11 @@ jobs: VSTS_HTTP_TIMEOUT: 200 BUILD_TYPE: Release OPENVINO_REPO_DIR: $(Build.Repository.LocalPath) + VCPKG_ROOT: $(OPENVINO_REPO_DIR)/../vcpkg WORK_DIR: $(Pipeline.Workspace)/_w BUILD_DIR: $(WORK_DIR)/build ANDROID_TOOLS: $(WORK_DIR)/android_tools + ANDROID_NDK_HOME: $(WORK_DIR)/android_tools/ndk-bundle ANDROID_SDK_VERSION: 29 ANDROID_ABI_CONFIG: arm64-v8a TMP_DIR: /mnt/tmp @@ -108,21 +117,25 @@ jobs: displayName: 'Make dir' - checkout: self - clean: 'true' submodules: 'true' + clean: 'true' path: openvino + - checkout: vcpkg + clean: 'true' + path: vcpkg + - script: | set -e - sudo -E $(OPENVINO_REPO_DIR)/install_build_dependencies.sh - # Move into contrib install_build_dependencies.sh - sudo apt --assume-yes install scons crossbuild-essential-arm64 default-jdk - # Speed up build - sudo apt -y --no-install-recommends install unzip - wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip - unzip ninja-linux.zip - sudo cp -v ninja /usr/local/bin/ - # Install Android SDK, NDK and TOOLS + # generic dependencies + sudo -E apt --assume-yes install ccache scons default-jdk python3-pip ninja-build + # vcpkg requires cmake 3.19 or later + python3 -m pip install -U pip cmake + # vcpkg's tool dependencies + sudo -E apt --assume-yes install curl zip unzip tar + # vcpkg tree of dependencies require extra packages + sudo -E apt --assume-yes install pkg-config linux-libc-dev + # Install Android SDK, NDK and Tools sudo apt -y --no-install-recommends install unzip wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip unzip commandlinetools-linux-7583922_latest.zip @@ -130,19 +143,29 @@ jobs: ./cmdline-tools/bin/sdkmanager --sdk_root=$(ANDROID_TOOLS) --install "ndk-bundle" "platform-tools" "platforms;android-$(ANDROID_SDK_VERSION)" displayName: 'Install dependencies' + - script: | + $(VCPKG_ROOT)/bootstrap-vcpkg.sh --disableMetrics + displayName: 'Build vcpkg' + - task: CMake@1 inputs: cmakeArgs: > - -G "Ninja Multi-Config" + -G Ninja -DCMAKE_VERBOSE_MAKEFILE=ON - -DCMAKE_TOOLCHAIN_FILE=$(ANDROID_TOOLS)/ndk-bundle/build/cmake/android.toolchain.cmake + -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) + -DVCPKG_TARGET_TRIPLET=arm64-android + -DCMAKE_TOOLCHAIN_FILE=$(VCPKG_ROOT)/scripts/buildsystems/vcpkg.cmake + -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$(ANDROID_NDK_HOME)/build/cmake/android.toolchain.cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DANDROID_ABI=$(ANDROID_ABI_CONFIG) - -DANDROID_STL=c++_shared -DANDROID_PLATFORM=$(ANDROID_SDK_VERSION) + -DENABLE_PYTHON=OFF + -DENABLE_SYSTEM_OPENCL=ON + -DENABLE_SYSTEM_PROTOBUF=ON + -DENABLE_SYSTEM_PUGIXML=ON + -DENABLE_SYSTEM_SNAPPY=ON + -DENABLE_INTEL_GPU=ON -DENABLE_TESTS=ON - -DCMAKE_CXX_LINKER_LAUNCHER=ccache - -DCMAKE_C_LINKER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S $(OPENVINO_REPO_DIR) diff --git a/cmake/features.cmake b/cmake/features.cmake index 51989a999e6..b042e38cbf0 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -24,9 +24,9 @@ endif() ie_dependent_option (ENABLE_INTEL_GPU "GPU OpenCL-based plugin for OpenVINO Runtime" ${ENABLE_INTEL_GPU_DEFAULT} "X86_64 OR AARCH64;NOT APPLE;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF) -if (ANDROID OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)) - # oneDNN doesn't support old compilers and android builds for now, so we'll - # build GPU plugin without oneDNN +if (ANDROID OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) OR NOT BUILD_SHARED_LIBS) + # oneDNN doesn't support old compilers and android builds for now, so we'll build GPU plugin without oneDNN + # also, in case of static build CPU's and GPU's oneDNNs will conflict, so we are disabling GPU's one in this case set(ENABLE_ONEDNN_FOR_GPU_DEFAULT OFF) else() set(ENABLE_ONEDNN_FOR_GPU_DEFAULT ON) @@ -55,7 +55,11 @@ Usage: -DSELECTIVE_BUILD=ON -DSELECTIVE_BUILD_STAT=/path/*.csv" OFF ie_option (ENABLE_DOCS "Build docs using Doxygen" OFF) -find_package(PkgConfig QUIET) +if(NOT ANDROID) + # on Android build FindPkgConfig.cmake finds host system pkg-config, which is not appropriate + find_package(PkgConfig QUIET) +endif() + ie_dependent_option (ENABLE_PKGCONFIG_GEN "Enable openvino.pc pkg-config file generation" ON "LINUX OR APPLE;PkgConfig_FOUND;BUILD_SHARED_LIBS" OFF) # diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 00000000000..617b3f1a790 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,171 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "openvino", + "version": "2023.0.0", + "maintainers": "OpenVINO Developers ", + "summary": "This is a port for Open Visual Inference And Optimization toolkit for AI inference", + "description": [ + "Intel® Distribution of OpenVINO™ toolkit is an open-source toolkit for optimizing ", + "and deploying AI inference. It can be used to develop applications and solutions based ", + "on deep learning tasks, such as: emulation of human vision, automatic speech recognition, ", + "natural language processing, recommendation systems, etc. It provides high-performance ", + "and rich deployment options, from edge to cloud" + ], + "homepage": "https://github.com/openvinotoolkit/openvino", + "documentation": "https://docs.openvino.ai/latest/index.html", + "license": "Apache-2.0", + "builtin-baseline": "838af19556a975f1755918a360b5f83909857f11", + "dependencies": [ + "ade", + { + "name": "pkgconf", + "host": true + }, + "pugixml", + { + "name": "tbb", + "$TODO": "Remove condition for Android once it's enabled", + "platform": "(static | osx) & !android", + "version>=": "2021.9.0#1" + }, + { + "name": "tbb", + "features": [ + "hwloc" + ], + "$TODO": "Remove condition for static once static tbbbind can work in oneTBB", + "platform": "!static & !osx", + "version>=": "2021.9.0#1" + }, + { + "name": "xbyak", + "platform": "!(arm | uwp)", + "version>=": "6.69" + } + ], + "default-features": [ + "default-features" + ], + "features": { + "auto": { + "description": "Enables Auto plugin for inference" + }, + "auto-batch": { + "description": "Enables Auto Batch plugin for inference, useful for throughput mode" + }, + "cpu": { + "description": "Enables CPU plugin for inference", + "supports": "!(windows & arm)" + }, + "default-features": { + "description": "Enables all default features", + "dependencies": [ + { + "name": "openvino", + "features": [ + "auto", + "auto-batch", + "hetero", + "ir", + "onnx", + "paddle", + "pytorch", + "tensorflow", + "tensorflow-lite" + ] + }, + { + "name": "openvino", + "features": [ + "cpu" + ], + "platform": "!(windows & arm)" + }, + { + "name": "openvino", + "features": [ + "gpu" + ], + "platform": "(x64 | arm64) & !(arm64 & windows) & !(osx | uwp)" + } + ] + }, + "gpu": { + "description": "Enables GPU plugin for inference", + "supports": "(x64 | arm64) & !(arm64 & windows) & !(osx | uwp)", + "dependencies": [ + "opencl" + ] + }, + "hetero": { + "description": "Enables Hetero plugin for inference" + }, + "ir": { + "description": "Enables IR frontend for reading models in OpenVINO IR format" + }, + "onnx": { + "description": "Enables ONNX frontend for reading models in ONNX format", + "dependencies": [ + { + "name": "onnx", + "version>=": "1.13.1" + }, + { + "name": "protobuf", + "version>=": "3.21.2" + }, + { + "name": "protobuf", + "host": true, + "version>=": "3.21.2" + } + ] + }, + "paddle": { + "description": "Enables PaddlePaddle frontend for reading models in PaddlePaddle format", + "dependencies": [ + { + "name": "protobuf", + "version>=": "3.21.2" + }, + { + "name": "protobuf", + "host": true, + "version>=": "3.21.2" + } + ] + }, + "pytorch": { + "description": "Enables PyTorch frontend to convert models in PyTorch format" + }, + "tensorflow": { + "description": "Enables TensorFlow frontend for reading models in TensorFlow format", + "dependencies": [ + { + "name": "protobuf", + "version>=": "3.21.2" + }, + { + "name": "protobuf", + "host": true, + "version>=": "3.21.2" + }, + "snappy" + ] + }, + "tensorflow-lite": { + "description": "Enables TensorFlow Lite frontend for reading models in TensorFlow Lite format", + "dependencies": [ + { + "name": "flatbuffers", + "version>=": "2.0.6" + }, + { + "name": "flatbuffers", + "host": true, + "version>=": "2.0.6" + } + ] + } + } +} \ No newline at end of file