```bash
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:
+
+```bash
+brew install cmake automake libtool
+```
+
+- run build_ios.sh
+```bash
+#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.
\ No newline at end of file
# Now, actually build the iOS target.
BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build_ios"}
+INSTALL_PREFIX=${BUILD_ROOT}/install
mkdir -p $BUILD_ROOT
cd $BUILD_ROOT
CMAKE_ARGS+=("-DCMAKE_C_FLAGS=-fembed-bitcode")
CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS=-fembed-bitcode")
-
cmake "$CAFFE2_ROOT" \
- -DCMAKE_INSTALL_PREFIX=../install \
+ -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
${CMAKE_ARGS[@]} \
$@
cmake --build . -- "-j$(sysctl -n hw.ncpu)"
+
+# copy headers and libs to install directory
+echo "Will install headers and libs to $INSTALL_PREFIX for further Xcode project usage."
+make install
+echo "Installation completed, now you can copy the headers/libs from $INSTALL_PREFIX to your Xcode project directory."