blob: abc5d4a247365729ca4516cf32ce0e1e5f818eae [file] [log] [blame]
Stephen Whitee6ab01f2019-04-04 14:31:25 -04001#!/bin/bash
2
3# Run an Android NDK binary on the connected device.
4#
5# Example usage:
6# $ cd <builddir>
7# $ make vk-unittests
8# $ ../rundroid vk-unittests
9
10if [ "$#" -lt 1 ]; then
11 echo "Usage: $0 <executable>"
12 exit 1
13fi
14
15dst_dir=/data/local/tmp
16path="$1"
17name="$(basename "$path")"
18shift
19
20if [ -z "$ANDROID_HOME" ]; then
21 ANDROID_HOME=$HOME/Android/Sdk
22fi
23
24set -e
25set -x
26
27for lib in libGLESv2_swiftshader.so libEGL_swiftshader.so libvk_swiftshader.so; do
28 adb push --sync "$lib" "${dst_dir}/${lib}"
29done
30
31adb push --sync "$ANDROID_HOME/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so" "${dst_dir}/libc++_shared.so"
32
33adb push --sync "$path" "${dst_dir}/${name}"
34adb shell "cd \"$dst_dir\"; chmod +x \"$name\"; LD_LIBRARY_PATH=. ./$name $*"