Replaced windows batch files with (extended) python scripts (Refs #297) [skip ci]

This commit is contained in:
saschawillems 2017-03-18 16:19:52 +01:00
parent b47f250e6c
commit d02e470355
9 changed files with 145 additions and 92 deletions

View file

@ -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..
)

View file

@ -1 +0,0 @@
call android.bat update project -p . -t android-23

View file

@ -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

78
android/build-all.py Normal file
View file

@ -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)

View file

@ -1 +0,0 @@
_build %1 %2

48
android/build.py Normal file
View file

@ -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)

View file

@ -1 +1,5 @@
FOR /d /r . %%x IN (assets) DO @IF EXIST "%%x" rd /s /q "%%x"
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"

View file

@ -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

14
android/install-all.py Normal file
View file

@ -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)