Removed old python build scripts, replaced with json example definition files
This commit is contained in:
parent
b5a733b502
commit
7ef4e1eb06
5 changed files with 64 additions and 107 deletions
|
|
@ -40,6 +40,16 @@ with open(os.path.join(PROJECT_FOLDER, "example.json")) as json_file:
|
|||
APK_NAME = EXAMPLE_JSON["apkname"]
|
||||
SHADER_DIR = EXAMPLE_JSON["directories"]["shaders"]
|
||||
|
||||
# Additional
|
||||
ADDITIONAL_DIRS = []
|
||||
ADDITIONAL_FILES = []
|
||||
if "additional" in EXAMPLE_JSON["assets"]:
|
||||
ADDITIONAL = EXAMPLE_JSON["assets"]["additional"]
|
||||
if "directories" in ADDITIONAL:
|
||||
ADDITIONAL_DIRS = ADDITIONAL["directories"]
|
||||
if "files" in ADDITIONAL:
|
||||
ADDITIONAL_FILES = ADDITIONAL["files"]
|
||||
|
||||
# Get assets to be copied
|
||||
ASSETS_MODELS = []
|
||||
ASSETS_TEXTURES = []
|
||||
|
|
@ -80,18 +90,23 @@ if subprocess.call("ndk-build %s" %BUILD_ARGS, shell=True) == 0:
|
|||
# Create folders
|
||||
os.makedirs("./assets/shaders/base", exist_ok=True)
|
||||
os.makedirs("./assets/shaders/%s" % SHADER_DIR, exist_ok=True)
|
||||
os.makedirs("./res/drawable", exist_ok=True)
|
||||
os.makedirs("./assets/models", exist_ok=True)
|
||||
os.makedirs("./assets/textures", exist_ok=True)
|
||||
for directory in ADDITIONAL_DIRS:
|
||||
os.makedirs("./assets/%s" % directory, exist_ok=True)
|
||||
os.makedirs("./res/drawable", exist_ok=True)
|
||||
|
||||
for file in glob.glob("../../data/shaders/base/*.spv"):
|
||||
shutil.copy(file, "./assets/shaders/base")
|
||||
for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR):
|
||||
shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR)
|
||||
for file in ASSETS_MODELS:
|
||||
shutil.copy("../../data/models/%s" % file, "./assets/models")
|
||||
for file in ASSETS_TEXTURES:
|
||||
shutil.copy("../../data/textures/%s" % file, "./assets/textures")
|
||||
for filename in glob.glob("../../data/shaders/base/*.spv"):
|
||||
shutil.copy(filename, "./assets/shaders/base")
|
||||
for filename in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR):
|
||||
shutil.copy(filename, "./assets/shaders/%s" % SHADER_DIR)
|
||||
for filename in ASSETS_MODELS:
|
||||
shutil.copy("../../data/models/%s" % filename, "./assets/models")
|
||||
for filename in ASSETS_TEXTURES:
|
||||
shutil.copy("../../data/textures/%s" % filename, "./assets/textures")
|
||||
for filename in ADDITIONAL_FILES:
|
||||
print("%s" % filename)
|
||||
shutil.copy("../../data/%s" % filename, "./assets/%s" % filename)
|
||||
|
||||
shutil.copy("../../android/images/icon.png", "./res/drawable")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import glob
|
||||
|
||||
APK_NAME = "vulkanPBRTexture"
|
||||
SHADER_DIR = "pbrtexture"
|
||||
ASSETS_MODELS = ["cube.obj"]
|
||||
ASSETS_TEXTURES = ["hdr/gcanyon_cube.ktx"]
|
||||
|
||||
if subprocess.call("ndk-build", shell=True) == 0:
|
||||
print("Build successful")
|
||||
|
||||
# Assets
|
||||
os.makedirs("./assets/shaders/base", exist_ok=True)
|
||||
os.makedirs("./assets/shaders/%s" % SHADER_DIR, exist_ok=True)
|
||||
os.makedirs("./res/drawable", exist_ok=True)
|
||||
os.makedirs("./assets/textures/hdr", exist_ok=True)
|
||||
os.makedirs("./assets/models", exist_ok=True)
|
||||
os.makedirs("./assets/models/cerberus/", exist_ok=True)
|
||||
|
||||
# Shaders
|
||||
# Base
|
||||
for file in glob.glob("../../data/shaders/base/*.spv"):
|
||||
shutil.copy(file, "./assets/shaders/base")
|
||||
# Sample
|
||||
for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR):
|
||||
shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR)
|
||||
# Textures
|
||||
for file in ASSETS_TEXTURES:
|
||||
shutil.copy("../../data/textures/%s" % file, "./assets/textures/hdr")
|
||||
# Models
|
||||
for file in ASSETS_MODELS:
|
||||
shutil.copy("../../data/models/%s" % file, "./assets/models")
|
||||
for file in glob.glob("../../data/models/cerberus/*.*"):
|
||||
shutil.copy(file, "./assets/models/cerberus")
|
||||
|
||||
# Icon
|
||||
shutil.copy("../../android/images/icon.png", "./res/drawable")
|
||||
|
||||
if subprocess.call("ant debug -Dout.final.file=%s.apk" % APK_NAME, shell=True) == 0:
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == "-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!")
|
||||
|
||||
23
android/pbrtexture/example.json
Normal file
23
android/pbrtexture/example.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"apkname": "vulkanPBRTexture",
|
||||
"directories": {
|
||||
"shaders": "pbrtexture"
|
||||
},
|
||||
"assets": {
|
||||
"models": [
|
||||
"cube.obj"
|
||||
],
|
||||
"additional" : {
|
||||
"directories": ["textures/hdr", "models/cerberus"],
|
||||
"files": [
|
||||
"textures/hdr/gcanyon_cube.ktx",
|
||||
"models/cerberus/cerberus.fbx",
|
||||
"models/cerberus/albedo.ktx",
|
||||
"models/cerberus/ao.ktx",
|
||||
"models/cerberus/metallic.ktx",
|
||||
"models/cerberus/normal.ktx",
|
||||
"models/cerberus/roughness.ktx"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import glob
|
||||
|
||||
APK_NAME = "vulkanSubpasses"
|
||||
SHADER_DIR = "subpasses"
|
||||
ASSETS_MODELS = ["samplebuilding.dae", "samplebuilding_glass.dae"]
|
||||
ASSETS_TEXTURES = ["colored_glass_bc3_unorm.ktx", "colored_glass_etc2_unorm.ktx", "colored_glass_astc_8x8_unorm.ktx"]
|
||||
|
||||
if subprocess.call("ndk-build", shell=True) == 0:
|
||||
print("Build successful")
|
||||
|
||||
# Assets
|
||||
os.makedirs("./assets/shaders/base", exist_ok=True)
|
||||
os.makedirs("./assets/shaders/%s" % SHADER_DIR, exist_ok=True)
|
||||
os.makedirs("./assets/textures", exist_ok=True)
|
||||
os.makedirs("./assets/models", exist_ok=True)
|
||||
os.makedirs("./res/drawable", exist_ok=True)
|
||||
|
||||
# Shaders
|
||||
# Base
|
||||
for file in glob.glob("../../data/shaders/base/*.spv"):
|
||||
shutil.copy(file, "./assets/shaders/base")
|
||||
# Sample
|
||||
for file in glob.glob("../../data/shaders/%s/*.spv" %SHADER_DIR):
|
||||
shutil.copy(file, "./assets/shaders/%s" % SHADER_DIR)
|
||||
# Textures
|
||||
for file in ASSETS_TEXTURES:
|
||||
shutil.copy("../../data/textures/%s" % file, "./assets/textures")
|
||||
# Models
|
||||
for file in ASSETS_MODELS:
|
||||
shutil.copy("../../data/models/%s" % file, "./assets/models")
|
||||
|
||||
# Icon
|
||||
shutil.copy("../../android/images/icon.png", "./res/drawable")
|
||||
|
||||
if subprocess.call("ant debug -Dout.final.file=%s.apk" % APK_NAME, shell=True) == 0:
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == "-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!")
|
||||
17
android/subpasses/example.json
Normal file
17
android/subpasses/example.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"apkname": "vulkanSubpasses",
|
||||
"directories": {
|
||||
"shaders": "subpasses"
|
||||
},
|
||||
"assets": {
|
||||
"models": [
|
||||
"samplebuilding.dae",
|
||||
"samplebuilding_glass.dae"
|
||||
],
|
||||
"textures": [
|
||||
"colored_glass_bc3_unorm.ktx",
|
||||
"colored_glass_etc2_unorm.ktx",
|
||||
"colored_glass_astc_8x8_unorm.ktx"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue