• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 uninstall com.example.Smoke
38	adb install build/outputs/apk/android-fat-debug.apk
39}
40
41run() {
42	adb shell am start com.example.Smoke/android.app.NativeActivity
43}
44
45generate_local_properties
46prebuild
47build
48install
49#run
50