diff --git a/android/_build.bat b/android/_build.bat deleted file mode 100644 index 8f9e1126..00000000 --- a/android/_build.bat +++ /dev/null @@ -1,28 +0,0 @@ -@echo off -if NOT EXIST %1 ( - echo Please specify a valid project folder for running the build -) else ( - mkdir bin - cd %1 - IF NOT EXIST build.xml ( - xcopy "..\_setup.bat" ".\" /Y - call _setup.bat - del _setup.bat - ) - IF EXIST build.py ( - python build.py %2 - ) else ( - call build %2 - ) - IF EXIST vulkan%1.apk ( - if "%2" == "-deploy" ( - echo deploying to device - IF EXIST vulkan%1.apk ( - adb install -r vulkan%1.apk - ) - ) - xcopy vulkan%1.apk "..\bin\" /Y - del vulkan%1.apk /q - ) - cd.. -) \ No newline at end of file diff --git a/android/_setup.bat b/android/_setup.bat deleted file mode 100644 index 5fe5050c..00000000 --- a/android/_setup.bat +++ /dev/null @@ -1 +0,0 @@ -call android.bat update project -p . -t android-23 diff --git a/android/build-all.bat b/android/build-all.bat deleted file mode 100644 index 99dc7166..00000000 --- a/android/build-all.bat +++ /dev/null @@ -1,47 +0,0 @@ -call _build geometryshader %1 -call _build computeparticles %1 -call _build computenbody %1 -call _build computeshader %1 -call _build computecullandlod %1 -call _build dynamicuniformbuffer %1 -call _build parallaxmapping %1 -call _build bloom %1 -call _build gears %1 -call _build texturecubemap %1 -call _build instancing %1 -call _build deferred %1 -call _build particlefire %1 -call _build occlusionquery %1 -call _build texture %1 -call _build tessellation %1 -call _build mesh %1 -call _build texturearray %1 -call _build pipelines %1 -call _build triangle %1 -call _build skeletalanimation %1 -call _build distancefieldfonts %1 -call _build vulkanscene %1 -call _build offscreen %1 -call _build shadowmapping %1 -call _build pushconstants %1 -call _build shadowmappingomni %1 -call _build sphericalenvmapping %1 -call _build radialblur %1 -call _build displacement %1 -call _build raytracing %1 -call _build multisampling %1 -call _build multithreading %1 -call _build textoverlay %1 -call _build debugmarker %1 -call _build scenerendering %1 -call _build terraintessellation %1 -call _build deferredshadows %1 -call _buold deferredmulitsampling %1 -call _build indirectdraw %1 -call _build texturemipmapgen %1 -call _build texture3d %1 -call _build specializationconstants %1 -call _build subpasses %1 -call _build hdr %1 -call _build pbrbasic %1 -call _build pbribl %1 \ No newline at end of file diff --git a/android/build-all.py b/android/build-all.py new file mode 100644 index 00000000..56b46dcc --- /dev/null +++ b/android/build-all.py @@ -0,0 +1,78 @@ +# Build all examples +# Pass -deploy to also install on connected device +import subprocess +import sys + +EXAMPLES = [ + "bloom", + "computecullandlod", + "computenbody", + "computeparticles", + "computeshader", + "debugmarker", + "deferred", + "deferredmultisampling", + "deferredshadows", + "displacement", + "distancefieldfonts", + "dynamicuniformbuffer", + "gears", + "geometryshader", + "hdr", + "indirectdraw", + "instancing", + "mesh", + "multisampling", + "multithreading", + "occlusionquery", + "offscreen", + "parallaxmapping", + "particlefire", + "pbrbasic", + "pbribl", + "pipelines", + "pushconstants", + "radialblur", + "raytracing", + "ssao", + "scenerendering", + "shadowmapping", + "shadowmappingomni", + "skeletalanimation", + "specializationconstants", + "sphericalenvmapping", + "subpasses", + "terraintessellation", + "tessellation", + "textoverlay", + "texture", + "texture3d", + "texturearray", + "texturecubemap", + "texturemipmapgen", + "triangle", + "vulkanscene" +] + +COLOR_GREEN = '\033[92m' +COLOR_END = '\033[0m' + +CURR_INDEX = 0 + +BUILD_ARGUMENTS = "" +for arg in sys.argv[1:]: + if arg == "-deploy": + BUILD_ARGUMENTS += "-deploy" + if arg == "-validation": + BUILD_ARGUMENTS += "-validation" + +print("Building all examples...") + +for example in EXAMPLES: + print(COLOR_GREEN + "Building %s (%d/%d)" % (example, CURR_INDEX, len(EXAMPLES)) + COLOR_END) + if subprocess.call("python build.py %s %s" % (example, BUILD_ARGUMENTS)) != 0: + print("Error during build process for %s" % example) + sys.exit(-1) + CURR_INDEX += 1 + +print("Successfully build %d examples" % CURR_INDEX) diff --git a/android/build.bat b/android/build.bat deleted file mode 100644 index 473cf549..00000000 --- a/android/build.bat +++ /dev/null @@ -1 +0,0 @@ -_build %1 %2 \ No newline at end of file diff --git a/android/build.py b/android/build.py new file mode 100644 index 00000000..1097d789 --- /dev/null +++ b/android/build.py @@ -0,0 +1,48 @@ +# Single example build and deploy script +import os +import subprocess +import sys +import shutil +import glob + +# Android SDK version used +SDK_VERSION = "android-23" + +PROJECT_FOLDER = "" + +# Name/folder of the project to build +if len(sys.argv) > 1: + PROJECT_FOLDER = sys.argv[1] +if not os.path.exists(PROJECT_FOLDER): + print("Please specify a valid project folder to build!") + sys.exit(-1) + +# Check if a build file is present, if not create one using the android SDK version specified +if not os.path.isfile(os.path.join(PROJECT_FOLDER, "build.xml")): + print("Build.xml not present, generating with %s " % SDK_VERSION) + if subprocess.call("android.bat update project -p ./%s -t %s" % (PROJECT_FOLDER, SDK_VERSION)) != 0: + print("Error: Project update failed!") + sys.exit(-1) + +# Run actual build script from example folder +if not os.path.isfile(os.path.join(PROJECT_FOLDER, "build.py")): + print("Error: No build script present!") + sys.exit(-1) + +BUILD_ARGUMENTS = "" +for arg in sys.argv[1:]: + if arg == "-deploy": + BUILD_ARGUMENTS += "-deploy" + if arg == "-validation": + BUILD_ARGUMENTS += "-validation" + +os.chdir(PROJECT_FOLDER) +if subprocess.call("python build.py %s" % BUILD_ARGUMENTS) != 0: + print("Error during build process!") + sys.exit(-1) + +# Move apk to bin folder +os.makedirs("../bin", exist_ok=True) +for file in glob.glob("vulkan*.apk"): + print(file) + shutil.move(file, "../bin/%s" % file) diff --git a/android/cleanup.bat b/android/cleanup.bat index e6044255..25cff3f0 100644 --- a/android/cleanup.bat +++ b/android/cleanup.bat @@ -1 +1,5 @@ -FOR /d /r . %%x IN (assets) DO @IF EXIST "%%x" rd /s /q "%%x" \ No newline at end of file +FOR /d /r . %%x IN (assets) DO @IF EXIST "%%x" rd /s /q "%%x" +FOR /d /r . %%x IN (bin) DO @IF EXIST "%%x" rd /s /q "%%x" +FOR /d /r . %%x IN (libs) DO @IF EXIST "%%x" rd /s /q "%%x" +FOR /d /r . %%x IN (obj) DO @IF EXIST "%%x" rd /s /q "%%x" +FOR /d /r . %%x IN (res) DO @IF EXIST "%%x" rd /s /q "%%x" \ No newline at end of file diff --git a/android/install-all.bat b/android/install-all.bat deleted file mode 100644 index ad72a80d..00000000 --- a/android/install-all.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -SET /P ANSWER=Install all vulkan examples on attached device (Y/N)? -if /i {%ANSWER%}=={y} (goto :install) -if /i {%ANSWER%}=={yes} (goto :install) -goto :exit - -:install -call build-all.bat -deploy -goto finish - -:exit -echo Cancelled - -:finish \ No newline at end of file diff --git a/android/install-all.py b/android/install-all.py new file mode 100644 index 00000000..f4cfa06f --- /dev/null +++ b/android/install-all.py @@ -0,0 +1,14 @@ +# Install all examples to connected device(s) +import subprocess +import sys + +answer = input("Install all vulkan examples to attached device, this may take some time! (Y/N)").lower() == 'y' +if answer: + BUILD_ARGUMENTS = "" + for arg in sys.argv[1:]: + if arg == "-validation": + BUILD_ARGUMENTS += "-validation" + if subprocess.call("python build-all.py -deploy %s" % BUILD_ARGUMENTS) != 0: + print("Error: Not all examples may have been installed!") + sys.exit(-1) + \ No newline at end of file