-
Notifications
You must be signed in to change notification settings - Fork 525
/
Copy pathtargets.bzl
99 lines (92 loc) · 3.04 KB
/
targets.bzl
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#
# Copyright (c) 2023 Apple Inc. All rights reserved.
# Provided subject to the LICENSE file in the top level directory.
#
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
def define_common_targets(is_xplat = False, platforms = []):
"""Defines targets that should be shared between fbcode and xplat.
The directory containing this targets.bzl file should also contain both
TARGETS and BUCK files that call this function.
"""
kwargs = {
"name": "mps",
"compiler_flags": [
"-DEXIR_MPS_DELEGATE=1",
"-Wno-global-constructors",
"-Wno-missing-prototypes",
"-Wno-nullable-to-nonnull-conversion",
"-Wno-undeclared-selector",
"-Wno-unused-const-variable",
"-Wno-unused-variable",
"-fno-objc-arc",
"-std=c++17",
],
"deps": [
"//executorch/runtime/core:core",
"//executorch/runtime/core/exec_aten/util:tensor_util",
":mps_schema",
],
"exported_deps": [
"//executorch/runtime/backend:interface",
":mps_schema",
],
"headers": native.glob([
"runtime/*.h",
"runtime/operations/*.h",
]),
"srcs": native.glob([
"runtime/*.mm",
"runtime/operations/*.mm",
]),
"visibility": [
"//executorch/backends/apple/...",
"//executorch/examples/...",
"//executorch/exir/backend:backend_lib",
"//executorch/extension/pybindings/...",
"//executorch/runtime/backend/...",
"//executorch/devtools/runners/...",
"//executorch/test/...",
"@EXECUTORCH_CLIENTS",
],
"link_whole": True,
}
if is_xplat:
kwargs["fbobjc_frameworks"] = [
"Foundation",
"Metal",
"MetalPerformanceShaders",
"MetalPerformanceShadersGraph",
]
kwargs["platforms"] = platforms
if runtime.is_oss or is_xplat:
runtime.genrule(
name = "gen_mps_schema",
srcs = [
"serialization/schema.fbs",
],
outs = {
"schema_generated.h": ["schema_generated.h"],
},
cmd = " ".join([
"$(exe {})".format(runtime.external_dep_location("flatc")),
"--cpp",
"--cpp-std c++11",
"--scoped-enums",
"-o ${OUT}",
"${SRCS}",
]),
default_outs = ["."],
)
runtime.cxx_library(
name = "mps_schema",
srcs = [],
exported_headers = {
"schema_generated.h": ":gen_mps_schema[schema_generated.h]",
},
exported_external_deps = ["flatbuffers-api"],
visibility = [
"//executorch/backends/apple/...",
"//executorch/examples/...",
],
)
runtime.cxx_library(**kwargs)