xref: /aosp_15_r20/external/executorch/kernels/aten/targets.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2load("@fbsource//xplat/executorch/codegen:codegen.bzl", "et_operator_library", "executorch_generated_lib")
3
4def define_common_targets():
5    """Defines targets that should be shared between fbcode and xplat.
6
7    The directory containing this targets.bzl file should also contain both
8    TARGETS and BUCK files that call this function.
9    """
10
11    runtime.export_file(
12        name = "functions.yaml",
13        visibility = [
14            "//executorch/...",
15            "@EXECUTORCH_CLIENTS",
16        ],
17    )
18
19    runtime.export_file(
20        name = "edge_dialect_aten_op.yaml",
21        visibility = [
22            "//executorch/...",
23            "@EXECUTORCH_CLIENTS",
24        ],
25    )
26
27    et_operator_library(
28        name = "executorch_aten_ops",
29        ops_schema_yaml_target = ":functions.yaml",
30        define_static_targets = True,
31    )
32
33    runtime.cxx_library(
34        name = "operators_edge_dialect_aten",
35        srcs = [],
36        visibility = [
37            "//executorch/...",
38            "@EXECUTORCH_CLIENTS",
39        ],
40        exported_deps = [
41            "//executorch/kernels/aten/cpu:cpu",
42        ],
43    )
44
45    et_operator_library(
46        name = "edge_dialect_aten_ops",
47        ops_schema_yaml_target = ":edge_dialect_aten_op.yaml",
48        define_static_targets = True,
49    )
50
51    executorch_generated_lib(
52        name = "generated_lib",
53        aten_mode = True,
54        deps = [
55            ":executorch_aten_ops",
56            ":edge_dialect_aten_ops",
57        ],
58        kernel_deps = [
59            ":operators_edge_dialect_aten",
60        ],
61        custom_ops_yaml_target = "//executorch/kernels/aten:edge_dialect_aten_op.yaml",
62        define_static_targets = True,
63        custom_ops_requires_aot_registration = False,
64        visibility = [
65            "//executorch/...",
66            "@EXECUTORCH_CLIENTS",
67        ],
68    )
69