Stephen White | e6ab01f | 2019-04-04 14:31:25 -0400 | [diff] [blame] | 1 | #!/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 | |
| 10 | if [ "$#" -lt 1 ]; then |
| 11 | echo "Usage: $0 <executable>" |
| 12 | exit 1 |
| 13 | fi |
| 14 | |
| 15 | dst_dir=/data/local/tmp |
| 16 | path="$1" |
| 17 | name="$(basename "$path")" |
| 18 | shift |
| 19 | |
| 20 | if [ -z "$ANDROID_HOME" ]; then |
| 21 | ANDROID_HOME=$HOME/Android/Sdk |
| 22 | fi |
| 23 | |
| 24 | set -e |
| 25 | set -x |
| 26 | |
| 27 | for lib in libGLESv2_swiftshader.so libEGL_swiftshader.so libvk_swiftshader.so; do |
| 28 | adb push --sync "$lib" "${dst_dir}/${lib}" |
| 29 | done |
| 30 | |
| 31 | adb push --sync "$ANDROID_HOME/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so" "${dst_dir}/libc++_shared.so" |
| 32 | |
| 33 | adb push --sync "$path" "${dst_dir}/${name}" |
| 34 | adb shell "cd \"$dst_dir\"; chmod +x \"$name\"; LD_LIBRARY_PATH=. ./$name $*" |