1#!/bin/sh
2
3set -e
4
5if [ -z "${ANDROID_SDK_HOME}" ];
6then echo "Please set ANDROID_SDK_HOME, exiting"; exit;
7else echo "ANDROID_SDK_HOME is ${ANDROID_SDK_HOME}";
8fi
9
10if [ -z "${ANDROID_NDK_HOME}" ];
11then echo "Please set ANDROID_NDK_HOME, exiting"; exit;
12else echo "ANDROID_NDK_HOME is ${ANDROID_NDK_HOME}";
13fi
14
15
16generate_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
22glslang=$(realpath ../../../external/glslang/build/install/bin/glslangValidator)
23
24prebuild() {
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
32build() {
33	./gradlew build
34}
35
36install() {
37	adb install -r build/outputs/apk/android-debug.apk
38}
39
40run() {
41	adb shell am start com.example.Smoke/android.app.NativeActivity
42}
43
44generate_local_properties
45prebuild
46build
47install
48#run
49