From 264e340c11ce4f6dd66aa2438108509627fcb35f Mon Sep 17 00:00:00 2001 From: saschawillems Date: Fri, 10 Mar 2017 14:05:14 +0100 Subject: [PATCH] Updated Android manifest and build files [skip ci] --- android/texture3d/AndroidManifest.xml | 1 + android/texture3d/build.bat | 19 ------------ android/texture3d/build.py | 42 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 19 deletions(-) delete mode 100644 android/texture3d/build.bat create mode 100644 android/texture3d/build.py diff --git a/android/texture3d/AndroidManifest.xml b/android/texture3d/AndroidManifest.xml index 23d9aa89..3c0030b8 100644 --- a/android/texture3d/AndroidManifest.xml +++ b/android/texture3d/AndroidManifest.xml @@ -15,6 +15,7 @@ android:label="Texture3D" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" + android:screenOrientation="landscape" android:configChanges="orientation|screenSize|keyboardHidden"> diff --git a/android/texture3d/build.bat b/android/texture3d/build.bat deleted file mode 100644 index c3e77316..00000000 --- a/android/texture3d/build.bat +++ /dev/null @@ -1,19 +0,0 @@ -cd jni -call ndk-build -if %ERRORLEVEL% EQU 0 ( - cd.. - - mkdir "assets\shaders\base" - xcopy "..\..\data\shaders\base\*.spv" "assets\shaders\base" /Y - - mkdir "assets\shaders\texture3d" - xcopy "..\..\data\shaders\texture3d\*.spv" "assets\shaders\texture3d" /Y - - mkdir "res\drawable" - xcopy "..\..\android\images\icon.png" "res\drawable" /Y - - call ant debug -Dout.final.file=vulkanTexture3d.apk -) ELSE ( - echo error : ndk-build failed with errors! - cd.. -) diff --git a/android/texture3d/build.py b/android/texture3d/build.py new file mode 100644 index 00000000..8662c1a5 --- /dev/null +++ b/android/texture3d/build.py @@ -0,0 +1,42 @@ +import os +import shutil +import subprocess +import sys +import glob + +APK_NAME = "vulkanTexture3d" +SHADER_DIR = "texture3d" + +if subprocess.call("ndk-build", shell=True) == 0: + print("Build successful") + + # Assets + if not os.path.exists("./assets"): + os.makedirs("./assets") + + # Shaders + # Base + if not os.path.exists("./assets/shaders/base"): + os.makedirs("./assets/shaders/base") + for file in glob.glob("../../data/shaders/base/*.spv"): + shutil.copy(file, "./assets/shaders/base") + # Sample + if not os.path.exists("./assets/shaders/%s" % SHADER_DIR): + os.makedirs("./assets/shaders/%s" % SHADER_DIR) + for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR): + shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR) + + # Icon + if not os.path.exists("./res/drawable"): + os.makedirs("./res/drawable") + shutil.copy("../../android/images/icon.png", "./res/drawable") + + if subprocess.call("ant debug -Dout.final.file=%s.apk" % APK_NAME, shell=True) == 0: + if len(sys.argv) > 1: + if sys.argv[1] == "-deploy": + if subprocess.call("adb install -r %s.apk" % APK_NAME, shell=True) != 0: + print("Could not deploy to device!") + else: + print("Error during build process!") +else: + print("Error building project!")