xref: /aosp_15_r20/external/pytorch/scripts/README.md (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1This directory contains the useful tools.
2
3
4## build_android.sh
5This script is to build PyTorch/Caffe2 library for Android. Take the following steps to start the build:
6
7- set ANDROID_NDK to the location of ndk
8
9```bash
10export ANDROID_NDK=YOUR_NDK_PATH
11```
12
13- run build_android.sh
14```bash
15#in your PyTorch root directory
16bash scripts/build_android.sh
17```
18If 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.
19
20You can also override the cmake flags via command line, e.g., following command will also compile the executable binary files:
21```bash
22bash scripts/build_android.sh -DBUILD_BINARY=ON
23```
24
25## build_ios.sh
26This script is to build PyTorch/Caffe2 library for iOS, and can only be performed on macOS. Take the following steps to start the build:
27
28- Install Xcode from App Store, and configure "Command Line Tools" properly on Xcode.
29- Install the dependencies:
30
31```bash
32brew install cmake automake libtool
33```
34
35- run build_ios.sh
36```bash
37#in your PyTorch root directory
38bash scripts/build_ios.sh
39```
40If 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.
41