|
1 | 1 | # Any targets that should be shared between fbcode and xplat must be defined in |
2 | | -# targets.bzl. This file can contain xplat-only targets. |
| 2 | +# targets.bzl. |
3 | 3 |
|
4 | | -load( |
5 | | - "@fbsource//tools/build_defs:default_platform_defs.bzl", |
6 | | - "APPLE", |
7 | | -) |
8 | | -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") |
9 | | -load("@fbsource//xplat/executorch/runtime/core:targets.bzl", "build_sdk") |
| 4 | +load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode") |
| 5 | +load(":targets.bzl", "define_common_targets") |
10 | 6 |
|
11 | 7 | oncall("executorch") |
12 | 8 |
|
13 | | -runtime.cxx_library( |
14 | | - name = "coreml", |
15 | | - srcs = [ |
16 | | - "runtime/delegate/ETCoreMLAsset.mm", |
17 | | - "runtime/delegate/ETCoreMLAssetManager.mm", |
18 | | - "runtime/delegate/ETCoreMLDefaultModelExecutor.mm", |
19 | | - "runtime/delegate/ETCoreMLLogging.mm", |
20 | | - "runtime/delegate/ETCoreMLModel.mm", |
21 | | - "runtime/delegate/ETCoreMLModelCache.mm", |
22 | | - "runtime/delegate/ETCoreMLModelCompiler.mm", |
23 | | - "runtime/delegate/ETCoreMLModelLoader.mm", |
24 | | - "runtime/delegate/ETCoreMLModelManager.mm", |
25 | | - "runtime/delegate/ETCoreMLStrings.mm", |
26 | | - "runtime/delegate/MLModel_Prewarm.mm", |
27 | | - "runtime/delegate/MLMultiArray_Copy.mm", |
28 | | - "runtime/delegate/asset.mm", |
29 | | - "runtime/delegate/backend_delegate.mm", |
30 | | - "runtime/delegate/coreml_backend_delegate.mm", |
31 | | - "runtime/delegate/multiarray.mm", |
32 | | - "runtime/delegate/executorch_operations.mm", |
33 | | - "runtime/delegate/serde_json.mm", |
34 | | - "runtime/inmemoryfs/inmemory_filesystem.cpp", |
35 | | - "runtime/inmemoryfs/inmemory_filesystem_utils.mm", |
36 | | - "runtime/inmemoryfs/memory_buffer.cpp", |
37 | | - "runtime/inmemoryfs/memory_stream.cpp", |
38 | | - "runtime/inmemoryfs/reversed_memory_stream.cpp", |
39 | | - "runtime/kvstore/database.cpp", |
40 | | - "runtime/kvstore/json_key_value_store.cpp", |
41 | | - "runtime/kvstore/key_value_store.cpp", |
42 | | - "runtime/kvstore/sqlite_error.cpp", |
43 | | - "runtime/kvstore/statement.cpp", |
44 | | - "runtime/util/json_util.cpp", |
45 | | - "runtime/util/objc_json_serde.mm", |
46 | | - ] + (glob([ |
47 | | - "runtime/sdk/*.mm", |
48 | | - ]) if build_sdk() else []), |
49 | | - headers = glob([ |
50 | | - "runtime/include/coreml_backend/delegate.h", |
51 | | - "runtime/kvstore/*.hpp", |
52 | | - "runtime/inmemoryfs/*.hpp", |
53 | | - "runtime/delegate/*.h", |
54 | | - "runtime/delegate/*.hpp", |
55 | | - "runtime/util/*.h", |
56 | | - "runtime/util/*.hpp", |
57 | | - ]) + (glob([ |
58 | | - "runtime/sdk/*.h", |
59 | | - ]) if build_sdk() else []), |
60 | | - compiler_flags = [ |
61 | | - "-fobjc-arc", |
62 | | - "-fno-exceptions", |
63 | | - "-fno-rtti", |
64 | | - "-Wno-null-character", |
65 | | - "-Wno-receiver-expr", |
66 | | - "-Wno-error", |
67 | | - ], |
68 | | - define_static_target = True, |
69 | | - header_namespace = "backends/apple/coreml", |
70 | | - exported_headers = ["runtime/delegate/executorch_operations.h", "runtime/include/coreml_backend/delegate.h"], |
71 | | - fbobjc_ios_target_sdk_version = "13.0", |
72 | | - fbobjc_frameworks = [ |
73 | | - "Accelerate", |
74 | | - "CoreML", |
75 | | - "Foundation", |
76 | | - ], |
77 | | - include_directories = [ |
78 | | - "runtime/include", |
79 | | - "runtime/kvstore", |
80 | | - "runtime/inmemoryfs", |
81 | | - "runtime/delegate", |
82 | | - "runtime/util", |
83 | | - ] + ([ |
84 | | - "runtime/sdk", |
85 | | - ] if build_sdk() else []), |
86 | | - fbobjc_libraries = [ |
87 | | - "libsqlite3", |
88 | | - ], |
89 | | - link_whole = True, |
90 | | - platforms = [APPLE], |
91 | | - visibility = ["PUBLIC"], |
92 | | - deps = [ |
93 | | - "//executorch/runtime/backend:backend_options", |
94 | | - "//executorch/runtime/backend:interface", |
95 | | - "//executorch/runtime/core:core", |
96 | | - "//executorch/runtime/kernel:kernel_includes", |
97 | | - ] + ([ |
98 | | - ":proto", |
99 | | - ] if build_sdk() else []), |
100 | | -) |
101 | | - |
102 | | -_PROTOS = [ |
103 | | - "ArrayFeatureExtractor", |
104 | | - "AudioFeaturePrint", |
105 | | - "BayesianProbitRegressor", |
106 | | - "CategoricalMapping", |
107 | | - "ClassConfidenceThresholding", |
108 | | - "CustomModel", |
109 | | - "DataStructures", |
110 | | - "DictVectorizer", |
111 | | - "FeatureTypes", |
112 | | - "FeatureVectorizer", |
113 | | - "Gazetteer", |
114 | | - "GLMClassifier", |
115 | | - "GLMRegressor", |
116 | | - "Identity", |
117 | | - "Imputer", |
118 | | - "ItemSimilarityRecommender", |
119 | | - "LinkedModel", |
120 | | - "MIL", |
121 | | - "Model", |
122 | | - "NearestNeighbors", |
123 | | - "NeuralNetwork", |
124 | | - "NonMaximumSuppression", |
125 | | - "Normalizer", |
126 | | - "OneHotEncoder", |
127 | | - "Parameters", |
128 | | - "Scaler", |
129 | | - "SoundAnalysisPreprocessing", |
130 | | - "SVM", |
131 | | - "TextClassifier", |
132 | | - "TreeEnsemble", |
133 | | - "VisionFeaturePrint", |
134 | | - "WordEmbedding", |
135 | | - "WordTagger", |
136 | | -] |
137 | | - |
138 | | -runtime.cxx_test( |
139 | | - name = "coreml_backend_options_test", |
140 | | - srcs = [ |
141 | | - "runtime/test/coreml_backend_options_test.cpp", |
142 | | - ], |
143 | | - deps = [ |
144 | | - ":coreml_backend_options", |
145 | | - "//executorch/runtime/backend:backend_options", |
146 | | - "//executorch/runtime/backend:backend_options_map", |
147 | | - "//executorch/runtime/core:core", |
148 | | - ], |
149 | | -) |
150 | | - |
151 | | -# Header-only library for CoreML backend options |
152 | | -runtime.cxx_library( |
153 | | - name = "coreml_backend_options", |
154 | | - exported_headers = [ |
155 | | - "runtime/include/coreml_backend/coreml_backend_options.h", |
156 | | - ], |
157 | | - header_namespace = "executorch/backends/apple/coreml", |
158 | | - visibility = ["PUBLIC"], |
159 | | - exported_deps = [ |
160 | | - "//executorch/runtime/backend:backend_options", |
161 | | - ], |
162 | | -) |
163 | | - |
164 | | -runtime.cxx_library( |
165 | | - name = "proto", |
166 | | - srcs = [ |
167 | | - "fbsource//third-party/pypi/coremltools:exported-cpp-protoc[{}.pb.cc]".format(name) |
168 | | - for name in _PROTOS |
169 | | - ], |
170 | | - exported_headers = { |
171 | | - "format/{}.pb.h".format(name): "fbsource//third-party/pypi/coremltools:exported-cpp-protoc[{}.pb.h]".format(name) |
172 | | - for name in _PROTOS |
173 | | - }, |
174 | | - header_namespace = "", |
175 | | - compiler_flags = [ |
176 | | - "-Wno-global-constructors", |
177 | | - ], |
178 | | - public_include_directories = [ |
179 | | - "", |
180 | | - ], |
181 | | - deps = [ |
182 | | - "//third-party/protobuf:fb-protobuf-lite", |
183 | | - ], |
184 | | -) |
| 9 | +define_common_targets(is_fbcode = is_fbcode()) |
0 commit comments