[android_compat_fixes] added support for non-NDK distributed Vulkan validation layer library paths (required for Android NDK r23+)

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
AMZN-ScottR
2021-11-08 11:01:56 -08:00
parent 27d354b1f3
commit aabbf51d3a
3 changed files with 24 additions and 3 deletions
+9 -1
View File
@@ -6,4 +6,12 @@
#
#
set(VKVALIDATION_RUNTIME_DEPENDENCIES $<$<NOT:$<CONFIG:Release>>:${LY_NDK_DIR}/sources/third_party/vulkan/src/build-android/jniLibs/arm64-v8a/libVkLayer_khronos_validation.so>)
set(LY_ANDROID_VULKAN_VALIDATION_PATH "${LY_NDK_DIR}/sources/third_party/vulkan/src/build-android/jniLibs" CACHE PATH "Path to the Vulkan Validation Layers libs for Android")
if(NOT EXISTS ${LY_ANDROID_VULKAN_VALIDATION_PATH})
message(FATAL_ERROR
"Unable to locate the Android Vulkan validation layer libs at ${LY_ANDROID_VULKAN_VALIDATION_PATH}. "
"If using NDK r23 or above, these libs are distributed separately via https://github.com/KhronosGroup/Vulkan-ValidationLayers")
endif()
set(VKVALIDATION_RUNTIME_DEPENDENCIES $<$<NOT:$<CONFIG:Release>>:${LY_ANDROID_VULKAN_VALIDATION_PATH}/arm64-v8a/libVkLayer_khronos_validation.so>)
@@ -471,7 +471,7 @@ class AndroidProjectGenerator(object):
def __init__(self, engine_root, build_dir, android_sdk_path, build_tool, android_sdk_platform, android_native_api_level, android_ndk,
project_path, third_party_path, cmake_version, override_cmake_path, override_gradle_path, gradle_version, gradle_plugin_version,
override_ninja_path, include_assets_in_apk, asset_mode, asset_type, signing_config, native_build_path, is_test_project=False,
override_ninja_path, include_assets_in_apk, asset_mode, asset_type, signing_config, native_build_path, vulkan_validation_path, is_test_project=False,
overwrite_existing=True, unity_build_enabled=False):
"""
Initialize the object with all the required parameters needed to create an Android Project. The parameters should be verified before initializing this object
@@ -495,6 +495,8 @@ class AndroidProjectGenerator(object):
:param asset_mode:
:param asset_type:
:param signing_config: Optional signing configuration arguments
:param native_build_path: Override the native build staging path in gradle
:param vulkan_validation_path: Override the path to where the Vulkan Validation Layers libraries are (required when using NDK r23+)
:param is_test_project: Flag to indicate if this is a unit test runner project. (If true, project_path, asset_mode, asset_type, and include_assets_in_apk are ignored)
:param overwrite_existing: Flag to overwrite existing project files when being generated, or skip if they already exist.
"""
@@ -535,6 +537,8 @@ class AndroidProjectGenerator(object):
self.native_build_path = native_build_path
self.vulkan_validation_path = vulkan_validation_path
self.asset_mode = asset_mode
self.asset_type = asset_type
@@ -820,6 +824,9 @@ class AndroidProjectGenerator(object):
f'"-DLY_3RDPARTY_PATH={template_third_party_path}"',
f'"-DLY_UNITY_BUILD={template_unity_build}"']
if self.vulkan_validation_path:
cmake_argument_list.append(f'"-DLY_ANDROID_VULKAN_VALIDATION_PATH={pathlib.PurePath(self.vulkan_validation_path).as_posix()}"')
if not self.is_test_project:
cmake_argument_list.append(f'"-DLY_PROJECTS={pathlib.PurePath(self.project_path).as_posix()}"')
else:
@@ -223,6 +223,11 @@ def main(args):
default=None,
required=False)
parser.add_argument('--vulkan-validation-path',
help='Override path to where the Vulkan Validation Layers libraries are. Required for use with NDK r23+',
default=None,
required=False)
# Asset Options
parser.add_argument(INCLUDE_APK_ASSETS_ARGUMENT_NAME,
action='store_true',
@@ -409,7 +414,8 @@ def main(args):
is_test_project=is_test_project,
overwrite_existing=parsed_args.overwrite_existing,
unity_build_enabled=parsed_args.enable_unity_build,
native_build_path=parsed_args.native_build_path)
native_build_path=parsed_args.native_build_path,
vulkan_validation_path=parsed_args.vulkan_validation_path)
generator.execute()