1load("@fbcode_macros//build_defs:cpp_python_extension.bzl", "cpp_python_extension") 2load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 3 4oncall("executorch") 5 6# TODO(T157145817): Update other flatbuffer serializers to use flatc like 7# _flatbuffer.py does, and remove this. 8cpp_python_extension( 9 name = "_bindings", 10 srcs = [ 11 "bindings.cpp", 12 ], 13 visibility = [ 14 "//executorch/backends/fb/qnnpack/...", 15 "//executorch/backends/vulkan/...", 16 "//executorch/backends/xnnpack/...", 17 "//executorch/devtools/bundled_program/...", 18 "//executorch/devtools/etdump/...", 19 ], 20 deps = [ 21 "fbsource//third-party/flatbuffers:flatc_library", 22 "fbsource//third-party/pybind11:pybind11", 23 ], 24) 25 26# Use runtime.python_library instead of the one defined in python_library.bzl, 27# so we can have access to EXECUTORCH_CLIENTS list. 28runtime.python_library( 29 name = "lib", 30 srcs = [ 31 "__init__.py", 32 "_cord.py", 33 "_dataclass.py", 34 "_flatbuffer.py", 35 "_program.py", 36 ], 37 resources = { 38 "//executorch/schema:program.fbs": "program.fbs", 39 "//executorch/schema:scalar_type.fbs": "scalar_type.fbs", 40 "fbsource//third-party/flatbuffers:flatc-host": "flatbuffers-flatc", 41 }, 42 # Currently serialization API should only be used in some dedicated targets, 43 # to avoid ODR violation when linking with another Flatbuffers library. 44 # Please ask before changing this. 45 visibility = [ 46 "//executorch/backends/...", 47 "//executorch/codegen/...", 48 "//executorch/devtools:lib", 49 "//executorch/devtools/bundled_program/serialize:lib", 50 "//executorch/devtools/bundled_program/tests/...", 51 "//executorch/devtools/experimental/...", 52 "//executorch/examples/async_exec:emit_program_lib", 53 "//executorch/exir/...", 54 "//executorch/exir/tests/...", 55 "//executorch/extension/...", 56 "//executorch/extension/pybindings/test:test", 57 "//executorch/extension/pybindings/test:test-library", 58 "//executorch/profiler/...", 59 "//executorch/test/...", 60 "@EXECUTORCH_CLIENTS", 61 ], 62 deps = [ 63 "//executorch/exir:schema", 64 "//executorch/exir:tensor", 65 ], 66) 67