|
| 1 | +load( |
| 2 | + "@fbsource//tools/build_defs:default_platform_defs.bzl", |
| 3 | + "ANDROID", |
| 4 | +) |
| 5 | +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") |
| 6 | + |
| 7 | +PYTHON_MODULE_NAME = "PyQnnManagerAdaptor" |
| 8 | + |
| 9 | +def define_common_targets(): |
| 10 | + """Defines targets that should be shared between fbcode and xplat. |
| 11 | + The directory containing this targets.bzl file should also contain both |
| 12 | + TARGETS and BUCK files that call this function. |
| 13 | + """ |
| 14 | + |
| 15 | + runtime.cxx_python_extension( |
| 16 | + name = "PyQnnManagerAdaptor", |
| 17 | + srcs = [ |
| 18 | + "PyQnnManagerAdaptor.cpp", |
| 19 | + ], |
| 20 | + headers = [ |
| 21 | + "PyQnnManagerAdaptor.h", |
| 22 | + ], |
| 23 | + base_module = "executorch.backends.qualcomm.python", |
| 24 | + preprocessor_flags = [ |
| 25 | + "-DEXECUTORCH_PYTHON_MODULE_NAME={}".format(PYTHON_MODULE_NAME), |
| 26 | + ], |
| 27 | + deps = [ |
| 28 | + "//executorch/runtime/core:core", |
| 29 | + "//executorch/backends/qualcomm/aot/python:python_lib", |
| 30 | + "//executorch/backends/qualcomm/aot/wrappers:wrappers", |
| 31 | + "//executorch/backends/qualcomm/runtime:logging", |
| 32 | + "//executorch/backends/qualcomm:schema", |
| 33 | + "//executorch/backends/qualcomm/aot/ir:qcir_utils", |
| 34 | + "//executorch/backends/qualcomm/runtime:runtime", |
| 35 | + "fbsource//third-party/qualcomm/qnn:api", |
| 36 | + ], |
| 37 | + external_deps = [ |
| 38 | + "pybind11", |
| 39 | + "libtorch_python", |
| 40 | + ], |
| 41 | + use_static_deps = True, |
| 42 | + visibility = [ |
| 43 | + "//executorch/backends/qualcomm/...", |
| 44 | + ], |
| 45 | + ) |
| 46 | + |
| 47 | + |
| 48 | + runtime.cxx_python_extension( |
| 49 | + name = "PyQnnWrapperAdaptor", |
| 50 | + srcs = [ |
| 51 | + "PyQnnWrapperAdaptor.cpp", |
| 52 | + ], |
| 53 | + headers = [ |
| 54 | + "PyQnnWrapperAdaptor.h", |
| 55 | + ], |
| 56 | + base_module = "executorch.backends.qualcomm.python", |
| 57 | + preprocessor_flags = [ |
| 58 | + "-DEXECUTORCH_PYTHON_MODULE_NAME={}".format(PYTHON_MODULE_NAME), |
| 59 | + ], |
| 60 | + deps = [ |
| 61 | + "//executorch/runtime/core:core", |
| 62 | + "//executorch/backends/qualcomm/aot/python:python_lib", |
| 63 | + "//executorch/backends/qualcomm/aot/wrappers:wrappers", |
| 64 | + "//executorch/backends/qualcomm/runtime:logging", |
| 65 | + "//executorch/backends/qualcomm:schema", |
| 66 | + "//executorch/backends/qualcomm/aot/ir:qcir_utils", |
| 67 | + "//executorch/backends/qualcomm/runtime:runtime", |
| 68 | + "fbsource//third-party/qualcomm/qnn:api", |
| 69 | + ], |
| 70 | + external_deps = [ |
| 71 | + "pybind11", |
| 72 | + "libtorch_python", |
| 73 | + ], |
| 74 | + use_static_deps = True, |
| 75 | + visibility = [ |
| 76 | + "//executorch/backends/qualcomm/...", |
| 77 | + ], |
| 78 | + ) |
| 79 | + |
| 80 | + runtime.cxx_library( |
| 81 | + name = "python_lib", |
| 82 | + srcs = glob([ |
| 83 | + "*.cpp", |
| 84 | + ]), |
| 85 | + exported_headers = glob([ |
| 86 | + "*.h", |
| 87 | + ]), |
| 88 | + visibility = ["@EXECUTORCH_CLIENTS"], |
| 89 | + deps = [ |
| 90 | + "//executorch/backends/qualcomm/aot/wrappers:wrappers", |
| 91 | + "//executorch/backends/qualcomm/runtime:logging", |
| 92 | + "//executorch/backends/qualcomm:schema", |
| 93 | + "//executorch/backends/qualcomm/aot/ir:qcir_utils", |
| 94 | + "//executorch/backends/qualcomm/runtime:runtime", |
| 95 | + "fbsource//third-party/qualcomm/qnn:api", |
| 96 | + ], |
| 97 | + external_deps = [ |
| 98 | + "pybind11", |
| 99 | + ], |
| 100 | + ) |
0 commit comments