xref: /aosp_15_r20/external/executorch/extension/module/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 = "module" + aten_suffix,
15            srcs = [
16                "module.cpp",
17            ],
18            exported_headers = [
19                "module.h",
20            ],
21            visibility = [
22                "@EXECUTORCH_CLIENTS",
23            ],
24            deps = [
25                "//executorch/extension/memory_allocator:malloc_memory_allocator",
26                "//executorch/extension/data_loader:file_data_loader",
27                "//executorch/extension/data_loader:mmap_data_loader",
28            ],
29            exported_deps = [
30                "//executorch/runtime/executor:program" + aten_suffix,
31            ],
32        )
33