xref: /aosp_15_r20/external/pytorch/.circleci/scripts/binary_ios_build.sh (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/bin/bash
2set -ex -o pipefail
3
4echo ""
5echo "DIR: $(pwd)"
6WORKSPACE=/Users/distiller/workspace
7PROJ_ROOT=/Users/distiller/project
8export TCLLIBPATH="/usr/local/lib"
9
10# Install conda
11curl --retry 3 -o ~/conda.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-MacOSX-x86_64.sh
12chmod +x ~/conda.sh
13/bin/bash ~/conda.sh -b -p ~/anaconda
14export PATH="~/anaconda/bin:${PATH}"
15source ~/anaconda/bin/activate
16
17# Install dependencies
18conda install numpy ninja pyyaml mkl mkl-include setuptools cmake requests typing-extensions --yes
19conda install -c conda-forge valgrind --yes
20export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
21
22# sync submodules
23cd ${PROJ_ROOT}
24git submodule sync
25git submodule update --init --recursive
26
27# run build script
28chmod a+x ${PROJ_ROOT}/scripts/build_ios.sh
29echo "########################################################"
30cat ${PROJ_ROOT}/scripts/build_ios.sh
31echo "########################################################"
32echo "IOS_ARCH: ${IOS_ARCH}"
33echo "IOS_PLATFORM: ${IOS_PLATFORM}"
34echo "USE_PYTORCH_METAL: ${USE_PYTORCH_METAL}"
35echo "USE_COREML_DELEGATE: ${USE_COREML_DELEGATE}"
36export IOS_ARCH=${IOS_ARCH}
37export IOS_PLATFORM=${IOS_PLATFORM}
38export USE_PYTORCH_METAL=${USE_PYTORCH_METAL}
39export USE_COREML_DELEGATE=${USE_COREML_DELEGATE}
40unbuffer ${PROJ_ROOT}/scripts/build_ios.sh 2>&1 | ts
41
42#store the binary
43cd ${WORKSPACE}
44DEST_DIR=${WORKSPACE}/ios
45mkdir -p ${DEST_DIR}
46cp -R ${PROJ_ROOT}/build_ios/install ${DEST_DIR}
47mv ${DEST_DIR}/install ${DEST_DIR}/${IOS_ARCH}
48