diff --git a/backends/qualcomm/aot/wrappers/targets.bzl b/backends/qualcomm/aot/wrappers/targets.bzl index 89f8efdea3e..1ea7e6679d5 100644 --- a/backends/qualcomm/aot/wrappers/targets.bzl +++ b/backends/qualcomm/aot/wrappers/targets.bzl @@ -1,6 +1,7 @@ load( "@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", + "CXX", ) load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load("@fbsource//xplat/executorch/backends/qualcomm/third-party:third_party_libs.bzl", "qnn_third_party_dep") @@ -20,7 +21,7 @@ def define_common_targets(): "*.h", ]), define_static_target = True, - platforms = [ANDROID], + platforms = [ANDROID, CXX], visibility = ["PUBLIC"], deps = [ qnn_third_party_dep("api"), diff --git a/backends/qualcomm/runtime/targets.bzl b/backends/qualcomm/runtime/targets.bzl index e84d080f5dd..9ba87b51779 100644 --- a/backends/qualcomm/runtime/targets.bzl +++ b/backends/qualcomm/runtime/targets.bzl @@ -1,6 +1,7 @@ load( "@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", + "CXX", ) load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load("@fbsource//xplat/executorch/backends/qualcomm/third-party:third_party_libs.bzl", "qnn_third_party_dep") @@ -21,7 +22,7 @@ def define_common_targets(): "Logging.h", ], define_static_target = True, - platforms = [ANDROID], + platforms = [ANDROID, CXX], visibility = ["PUBLIC"], deps = [ qnn_third_party_dep("api"), @@ -68,7 +69,7 @@ def define_common_targets(): ), define_static_target = True, link_whole = True, # needed for executorch/examples/models/llama:main to register QnnBackend - platforms = [ANDROID], + platforms = [ANDROID, CXX], visibility = ["PUBLIC"], resources = ({ "qnn_lib": qnn_third_party_dep("qnn_offline_compile_libs"), diff --git a/backends/qualcomm/targets.bzl b/backends/qualcomm/targets.bzl index a53e5823aff..c98a8bc83ac 100644 --- a/backends/qualcomm/targets.bzl +++ b/backends/qualcomm/targets.bzl @@ -1,6 +1,7 @@ load( "@fbsource//tools/build_defs:default_platform_defs.bzl", "ANDROID", + "CXX", ) load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") load("@fbsource//xplat/executorch/backends/qualcomm/third-party:third_party_libs.bzl", "qnn_third_party_dep") @@ -69,7 +70,7 @@ def define_common_targets(): }, exported_external_deps = ["flatbuffers-api"], define_static_target = True, - platforms = [ANDROID], + platforms = [ANDROID, CXX], ) runtime.cxx_library( @@ -87,5 +88,32 @@ def define_common_targets(): exported_deps = [ ":schema", ], - platforms = [ANDROID], + platforms = [ANDROID, CXX], + ) + + # Host-side AOT variant of qnn_executorch_backend. Pulls in the QNN + # offline-compile libraries as a Buck resource (via :runtime, which + # itself depends on qnn_third_party_dep("qnn_offline_compile_libs")), + # so a host-side gtest or runner can dlopen the QNN libraries + # without a manual path setup. + # + # Mirrors qnn_executorch_backend's structure but swaps the on-device + # runtime_android_build dep for the host runtime which bundles the + # x86 simulator libraries as a Buck resource. + runtime.cxx_library( + name = "qnn_executorch_backend_aot", + srcs = [], + headers = [], + define_static_target = True, + visibility = ["PUBLIC"], + deps = [ + qnn_third_party_dep("api"), + "//executorch/runtime/backend:interface", + "//executorch/runtime/core:core", + "//executorch/backends/qualcomm/runtime:runtime", + ], + exported_deps = [ + ":schema", + ], + platforms = [ANDROID, CXX], )