Skip to content

Commit

Permalink
Support qnn_home on build_aar_package
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Aug 22, 2024
1 parent 620fbac commit 7d79d7a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tools/ci_build/github/android/build_aar_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ def _parse_build_settings(args):

return build_settings

def _filter_build_params(abi, build_params):
if abi == "arm64-v8a":
return build_params
return [arg for arg in build_params if 'qnn' not in arg and 'snpe' not in arg]

def _build_aar(args):
build_settings = _parse_build_settings(args)
Expand All @@ -104,8 +100,12 @@ def _build_aar(args):
abi_build_dir = os.path.join(intermediates_dir, abi)
abi_build_command = [*base_build_command, "--android_abi=" + abi, "--build_dir=" + abi_build_dir]

# drop --use_qnn / --use_snpe for non-ARM64 abis
abi_build_command = _filter_build_params(abi, abi_build_command)
if abi == "arm64-v8a":
if "--use_qnn" in abi_build_command:
abi_build_command.append(f"--qnn_home={args.qnn_home}")
else:
if "--use_qnn" in abi_build_command:
abi_build_command.remove("--use_qnn")

if ops_config_path is not None:
abi_build_command += ["--include_ops_by_config=" + ops_config_path]
Expand Down Expand Up @@ -192,6 +192,10 @@ def parse_args():
"--android_ndk_path", type=str, default=os.environ.get("ANDROID_NDK_HOME", ""), help="Path to the Android NDK"
)

parser.add_argument(
"--qnn_home", type=str, default=os.environ.get("QNN_SDK_ROOT", ""), help="Path to the QNN library"
)

parser.add_argument(
"--build_dir",
type=str,
Expand Down

0 comments on commit 7d79d7a

Please sign in to comment.