xref: /aosp_15_r20/external/executorch/extension/tensor/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
13        runtime.cxx_library(
14            name = "tensor" + aten_suffix,
15            srcs = [
16                "tensor_ptr.cpp",
17                "tensor_ptr_maker.cpp",
18            ],
19            exported_headers = [
20                "tensor.h",
21                "tensor_ptr.h",
22                "tensor_ptr_maker.h",
23            ],
24            visibility = [
25                "@EXECUTORCH_CLIENTS",
26            ],
27            deps = [
28                "//executorch/runtime/core/exec_aten/util:dim_order_util" + aten_suffix,
29                "//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix,
30            ],
31            exported_deps = [
32                "//executorch/runtime/core/exec_aten:lib" + aten_suffix,
33                "//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix,
34            ],
35        )
36