xref: /aosp_15_r20/external/executorch/runtime/backend/targets.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2
3def define_common_targets():
4    """Defines targets that should be shared between fbcode and xplat.
5
6    The directory containing this targets.bzl file should also contain both
7    TARGETS and BUCK files that call this function.
8    """
9
10    for aten_mode in (True, False):
11        aten_suffix = ("_aten" if aten_mode else "")
12        runtime.cxx_library(
13            name = "interface" + aten_suffix,
14            srcs = [
15                "interface.cpp",
16            ],
17            exported_headers = [
18                "backend_execution_context.h",
19                "backend_init_context.h",
20                "interface.h",
21            ],
22            preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else [],
23            visibility = [
24                "//executorch/...",
25                "@EXECUTORCH_CLIENTS",
26            ],
27            exported_deps = [
28                "//executorch/runtime/core:core",
29                "//executorch/runtime/core:evalue" + aten_suffix,
30                "//executorch/runtime/core:event_tracer" + aten_suffix,
31                "//executorch/runtime/core:memory_allocator",
32            ],
33        )
34