Skip to content

Commit 775a68b

Browse files
kimishpatelmalfet
authored andcommitted
Add android cross compilation for et runner (#446)
Summary: Download android ndk r26c Use that to run build_android.sh Test Plan: CI Reviewers: Subscribers: Tasks: Tags:
1 parent d6da1b4 commit 775a68b

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

.github/workflows/pull.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,3 +841,28 @@ jobs:
841841
cat ${PWD}/output_aoti
842842
843843
echo "Tests complete."
844+
845+
test-build-runner-et-android:
846+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
847+
with:
848+
runner: linux.4xlarge
849+
script: |
850+
uname -a
851+
if [ $(uname -s) == Darwin ]; then
852+
sysctl machdep.cpu.brand_string
853+
sysctl machdep.cpu.core_count
854+
fi
855+
git submodule sync
856+
git submodule update --init
857+
echo "Intalling pip packages"
858+
pip install cmake --upgrade
859+
cmake --version
860+
pip install -r requirements.txt
861+
export TORCHCHAT_ROOT=${PWD}
862+
pushd /tmp
863+
wget https://dl.google.com/android/repository/android-ndk-r26c-linux.zip
864+
unzip android-ndk-r26c-linux.zip
865+
popd
866+
export ANDROID_NDK=/tmp/android-ndk-r26c
867+
./runner/build_android.sh
868+
echo "Tests complete."

runner/build_android.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ else
1818
echo "ANDROID_NDK set to ${ANDROID_NDK}"
1919
fi
2020

21-
export CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
22-
export ANDROID_ABI=arm64-v8a
23-
export ANDROID_PLATFORM=android-23
2421
export ET_BUILD_DIR="et-build-android"
2522
export CMAKE_OUT_DIR="cmake-out-android"
2623
export EXECUTORCH_BUILD_CUSTOM_OPS_AOT="OFF"
@@ -37,6 +34,13 @@ build_runner_et() {
3734
}
3835

3936
find_cmake_prefix_path
37+
install_pip_dependencies
4038
clone_executorch
39+
export ENABLE_ET_PYBIND=false
40+
install_executorch_python_libs $ENABLE_ET_PYBIND
41+
42+
export CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
43+
export ANDROID_ABI=arm64-v8a
44+
export ANDROID_PLATFORM=android-23
4145
install_executorch
4246
build_runner_et

0 commit comments

Comments
 (0)