1 #!/bin/sh 2 3 set -e 4 5 if [ -z "${ANDROID_SDK_HOME}" ]; 6 then echo "Please set ANDROID_SDK_HOME, exiting"; exit; 7 else echo "ANDROID_SDK_HOME is ${ANDROID_SDK_HOME}"; 8 fi 9 10 if [ -z "${ANDROID_NDK_HOME}" ]; 11 then echo "Please set ANDROID_NDK_HOME, exiting"; exit; 12 else echo "ANDROID_NDK_HOME is ${ANDROID_NDK_HOME}"; 13 fi 14 15 16 generate_local_properties() { 17 : > local.properties 18 echo "sdk.dir=${ANDROID_SDK_HOME}" >> local.properties 19 echo "ndk.dir=${ANDROID_NDK_HOME}" >> local.properties 20 } 21 22 glslang=$(realpath ../../../external/glslang/build/install/bin/glslangValidator) 23 24 prebuild() { 25 ( cd ..; python3 generate-dispatch-table.py HelpersDispatchTable.h ) 26 ( cd ..; python3 generate-dispatch-table.py HelpersDispatchTable.cpp ) 27 ( cd ..; python3 glsl-to-spirv Smoke.frag Smoke.frag.h ${glslang} ) 28 ( cd ..; python3 glsl-to-spirv Smoke.vert Smoke.vert.h ${glslang} ) 29 ( cd ..; python3 glsl-to-spirv Smoke.push_constant.vert Smoke.push_constant.vert.h ${glslang} ) 30 } 31 32 build() { 33 ./gradlew build 34 } 35 36 install() { 37 adb install -r build/outputs/apk/android-debug.apk 38 } 39 40 run() { 41 adb shell am start com.example.Smoke/android.app.NativeActivity 42 } 43 44 generate_local_properties 45 prebuild 46 build 47 install 48 #run 49