-
Notifications
You must be signed in to change notification settings - Fork 528
/
Copy pathTARGETS
77 lines (68 loc) · 2.94 KB
/
TARGETS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Any targets that should be shared between fbcode and xplat must be defined in
# targets.bzl. This file can contain fbcode-only targets.
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
load("@fbsource//xplat/executorch/extension/pybindings:pybindings.bzl", "ATEN_MODULE_DEPS", "MODELS_ATEN_OPS_ATEN_MODE_GENERATED_LIB", "MODELS_ATEN_OPS_LEAN_MODE_GENERATED_LIB", "PORTABLE_MODULE_DEPS", "executorch_pybindings")
oncall("executorch")
# Export this so the internal fb/ subdir can create pybindings with custom internal deps
# without forking the pybinding source.
runtime.export_file(
name = "pybindings.cpp",
visibility = ["//executorch/extension/pybindings/..."],
)
# cxx_python_extension kwarg 'types' can't take export_file rules directly and we need to rename the .pyi
# file to match the lib anyway, so we just expose the file like this and then have genrules consume and
# rename it before passing it to executorch pybindings.
runtime.filegroup(
name = "pybinding_types",
srcs = ["pybindings.pyi"],
visibility = ["//executorch/extension/pybindings/..."],
)
# In order to have pyre recognize the pybindings module, the name of the .pyi must exactly match the
# name of the lib. To avoid copy pasting the pyi file in tree a whole bunch of times we use genrules
# to do it for us
runtime.genrule(
name = "pybindings_types_gen",
srcs = [":pybinding_types"],
outs = {
"aten_lib.pyi": ["aten_lib.pyi"],
"core.pyi": ["core.pyi"],
"_portable_lib.pyi": ["_portable_lib.pyi"],
},
cmd = "cp $(location :pybinding_types)/* $OUT/_portable_lib.pyi && cp $(location :pybinding_types)/* $OUT/aten_lib.pyi && cp $(location :pybinding_types)/* $OUT/core.pyi",
visibility = ["//executorch/extension/pybindings/..."],
)
executorch_pybindings(
compiler_flags = ["-std=c++17"],
cppdeps = PORTABLE_MODULE_DEPS,
python_module_name = "core",
types = ["//executorch/extension/pybindings:pybindings_types_gen[core.pyi]"],
visibility = ["PUBLIC"],
)
executorch_pybindings(
compiler_flags = ["-std=c++17"],
cppdeps = PORTABLE_MODULE_DEPS + MODELS_ATEN_OPS_LEAN_MODE_GENERATED_LIB,
# Give this an underscore prefix because it has a pure python wrapper.
python_module_name = "_portable_lib",
types = ["//executorch/extension/pybindings:pybindings_types_gen[_portable_lib.pyi]"],
visibility = ["PUBLIC"],
)
executorch_pybindings(
compiler_flags = ["-std=c++17"],
cppdeps = ATEN_MODULE_DEPS + MODELS_ATEN_OPS_ATEN_MODE_GENERATED_LIB,
python_module_name = "aten_lib",
types = ["//executorch/extension/pybindings:pybindings_types_gen[aten_lib.pyi]"],
visibility = ["PUBLIC"],
)
runtime.python_library(
name = "portable_lib",
srcs = ["portable_lib.py"],
visibility = [
"//executorch/exir/...",
"//executorch/runtime/...",
"@EXECUTORCH_CLIENTS",
],
deps = [
":_portable_lib",
"//executorch/exir:_warnings",
],
)