Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/39188 Extracting Vulkan_LIBS and Vulkan_INCLUDES setup from `cmake/Dependencies.cmake` to `cmake/VulkanDependencies.cmake` and reuse it in android/pytorch_android/CMakeLists.txt Adding control to build with Vulkan setting env variable `USE_VULKAN` for `scripts/build_android.sh` `scripts/build_pytorch_android.sh` We do not use Vulkan backend in pytorch_android, but with this build option we can track android aar change with `USE_VULKAN` added. Currently it is 88Kb. Test Plan: Imported from OSS Differential Revision: D21770892 Pulled By: IvanKobzarev fbshipit-source-id: a39433505fdcf43d3b524e0fe08062d5ebe0d872
This directory contains the useful tools.
build_android.sh
This script is to build PyTorch/Caffe2 library for Android. Take the following steps to start the build:
- set ANDROID_NDK to the location of ndk
export ANDROID_NDK=YOUR_NDK_PATH
- run build_android.sh
#in your PyTorch root directory
bash scripts/build_android.sh
If succeeded, the libraries and headers would be generated to build_android/install directory. You can then copy these files from build_android/install to your Android project for further usage.
You can also override the cmake flags via command line, e.g., following command will also compile the executable binary files:
bash scripts/build_android.sh -DBUILD_BINARY=ON
build_ios.sh
This script is to build PyTorch/Caffe2 library for iOS, and can only be performed on macOS. Take the following steps to start the build:
- Install Xcode from App Store, and configure "Command Line Tools" properly on Xcode.
- Install the dependencies:
brew install cmake automake libtool
- run build_ios.sh
#in your PyTorch root directory
bash scripts/build_ios.sh
If succeeded, the libraries and headers would be generated to build_ios/install directory. You can then copy these files to your Xcode project for further usage.