demos: Fix Smoke build for Android
authorCody Northrop <cnorthrop@google.com>
Thu, 22 Sep 2016 17:08:37 +0000 (11:08 -0600)
committerCody Northrop <cnorthrop@google.com>
Fri, 23 Sep 2016 14:32:58 +0000 (08:32 -0600)
It doesn't appear that this ever worked.

BUILD.md
demos/smoke/android/build-and-install
demos/smoke/android/build.gradle

index 286e75e..06dee6a 100644 (file)
--- a/BUILD.md
+++ b/BUILD.md
@@ -189,6 +189,16 @@ adb install ./tri/bin/NativeActivity-debug.apk
 adb shell am start com.example.Cube/android.app.NativeActivity
 adb shell am start com.example.Tri/android.app.NativeActivity
 ```
+To build, install, and run the Smoke demo for Android, run the following, and any
+prompts that come back from the script:
+```
+./update_external_sources.sh --glslang
+cd demos/smoke/android
+export ANDROID_SDK_HOME=<path to Android/Sdk>
+export ANDROID_NDK_HOME=<path to Android/Sdk/ndk-bundle>
+./build-and-install
+adb shell am start com.example.Smoke/android.app.NativeActivity
+```
 
 ## Ninja Builds - All Platforms
 The [Qt Creator IDE](https://qt.io/download-open-source/#section-2) can open a root CMakeList.txt as a project directly, and it provides tools within Creator to configure and generate Vulkan SDK build files for one to many targets concurrently, resolving configuration issues as needed. Alternatively, when invoking CMake use the -G Codeblocks Ninja option to generate Ninja build files to be used as project files for QtCreator
index 7402ec4..1c1d0f9 100755 (executable)
@@ -12,12 +12,23 @@ then echo "Please set ANDROID_NDK_HOME, exiting"; exit;
 else echo "ANDROID_NDK_HOME is ${ANDROID_NDK_HOME}";
 fi
 
+
 generate_local_properties() {
        : > local.properties
        echo "sdk.dir=${ANDROID_SDK_HOME}" >> local.properties
        echo "ndk.dir=${ANDROID_NDK_HOME}" >> local.properties
 }
 
+glslang=$(realpath ../../../external/glslang/build/install/bin/glslangValidator)
+
+prebuild() {
+  ( cd ..; python3 generate-dispatch-table HelpersDispatchTable.h )
+  ( cd ..; python3 generate-dispatch-table HelpersDispatchTable.cpp )
+  ( cd ..; python3 glsl-to-spirv Smoke.frag Smoke.frag.h ${glslang} )
+  ( cd ..; python3 glsl-to-spirv Smoke.vert Smoke.vert.h ${glslang} )
+  ( cd ..; python3 glsl-to-spirv Smoke.push_constant.vert Smoke.push_constant.vert.h ${glslang} )
+}
+
 build() {
        ./gradlew build
 }
@@ -32,6 +43,7 @@ run() {
 }
 
 generate_local_properties
+prebuild
 build
 install
 #run
index a620153..38fa1ac 100644 (file)
@@ -11,7 +11,7 @@ buildscript {
 apply plugin: 'com.android.model.application'
 
 def demosDir = "../.."
-def smokeDir = "${demosDir}/Smoke"
+def smokeDir = "${demosDir}/smoke"
 def glmDir = "${demosDir}/../libs"
 def vulkanDir = "${demosDir}/../include"
 
@@ -65,6 +65,7 @@ model {
                     srcDir "${smokeDir}"
                     exclude 'ShellXcb.cpp'
                     exclude 'ShellWin32.cpp'
+                    exclude 'ShellWayland.cpp'
                 }
             }
         }