Skip to content

Commit

Permalink
Allow skipping adding FSR2 shaders to Android APK.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed May 14, 2024
1 parent bdae32d commit d03dfb3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion application/platforms/android/gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ android {
manifest.srcFile 'AndroidManifest.xml'
resources.srcDirs = ['res']
res.srcDirs = ['res']
assets.srcDirs = ['$$ASSETS$$', '$$GRANITE_ASSETS$$', '$$GRANITE_FSR2_ASSETS$$']
assets.srcDirs = ['$$ASSETS$$', '$$GRANITE_ASSETS$$']
jniLibs.srcDirs = ['$$EXTERNAL_JNI$$']
$$GRANITE_AUX_ASSETS$$
}
}

Expand Down
23 changes: 20 additions & 3 deletions tools/create_android_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,19 @@ def main():
help = 'The assets folder of the app',
type = str,
default = 'assets')
parser.add_argument('--builtin',
help = 'The builtin assets folder of the app. By default it is $GRANITE/assets.',
type = str,
default = None)
parser.add_argument('--audio',
help = 'Enable audio support',
action = 'store_true')
parser.add_argument('--physics',
help = 'Enable physics support',
action = 'store_true')
parser.add_argument('--fsr2',
help = 'Add FSR2 shaders to package',
action = 'store_true')

args = parser.parse_args()
abis = ['arm64-v8a'] if args.abis is None else args.abis
Expand Down Expand Up @@ -131,8 +138,18 @@ def main():

cmakelists = find_relative_path(target_build_gradle, args.cmake_lists_toplevel)
assets = find_relative_path(target_build_gradle, args.assets)
granite_assets = find_relative_path(target_build_gradle, os.path.join(args.granite_dir, 'assets'))
granite_fsr2_assets = find_relative_path(target_build_gradle, os.path.join(args.granite_dir, 'third_party/fsr2/src/ffx-fsr2-api/shaders'))
if args.builtin is not None:
granite_assets = find_relative_path(target_build_gradle, args.builtin)
else:
granite_assets = find_relative_path(target_build_gradle, os.path.join(args.granite_dir, 'assets'))

if args.fsr2:
granite_fsr2_assets = find_relative_path(target_build_gradle,
os.path.join(args.granite_dir, 'third_party/fsr2/src/ffx-fsr2-api/shaders'))
granite_aux_assets = "assets.srcDirs += ['" + granite_fsr2_assets + "']"
else:
granite_aux_assets = ''

external_jni = find_relative_path(target_build_gradle, os.path.join(args.granite_dir,
'application/platforms/android/external_layers'))

Expand All @@ -144,7 +161,7 @@ def main():
.replace('$$CMAKELISTS$$', cmakelists) \
.replace('$$ASSETS$$', assets) \
.replace('$$GRANITE_ASSETS$$', granite_assets) \
.replace('$$GRANITE_FSR2_ASSETS$$', granite_fsr2_assets) \
.replace('$$GRANITE_AUX_ASSETS$$', granite_aux_assets) \
.replace('$$EXTERNAL_JNI$$', external_jni) \
.replace('$$ABIS$$', target_abis) \
.replace('$$AUDIO$$', 'ON' if args.audio else 'OFF') \
Expand Down

0 comments on commit d03dfb3

Please sign in to comment.