|
| 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. |
| 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") |
| 10 | + |
| 11 | +oncall("executorch") |
| 12 | + |
| 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/ETCoreMLModelCompiler.mm", |
| 22 | + "runtime/delegate/ETCoreMLModelLoader.mm", |
| 23 | + "runtime/delegate/ETCoreMLModelManager.mm", |
| 24 | + "runtime/delegate/ETCoreMLStrings.mm", |
| 25 | + "runtime/delegate/MLModel_Prewarm.mm", |
| 26 | + "runtime/delegate/MLMultiArray_Copy.mm", |
| 27 | + "runtime/delegate/asset.mm", |
| 28 | + "runtime/delegate/backend_delegate.mm", |
| 29 | + "runtime/delegate/coreml_backend_delegate.mm", |
| 30 | + "runtime/delegate/multiarray.mm", |
| 31 | + "runtime/delegate/executorch_operations.mm", |
| 32 | + "runtime/delegate/serde_json.mm", |
| 33 | + "runtime/inmemoryfs/inmemory_filesystem.cpp", |
| 34 | + "runtime/inmemoryfs/inmemory_filesystem_utils.mm", |
| 35 | + "runtime/inmemoryfs/memory_buffer.cpp", |
| 36 | + "runtime/inmemoryfs/memory_stream.cpp", |
| 37 | + "runtime/inmemoryfs/reversed_memory_stream.cpp", |
| 38 | + "runtime/kvstore/database.cpp", |
| 39 | + "runtime/kvstore/json_key_value_store.cpp", |
| 40 | + "runtime/kvstore/key_value_store.cpp", |
| 41 | + "runtime/kvstore/sqlite_error.cpp", |
| 42 | + "runtime/kvstore/statement.cpp", |
| 43 | + "runtime/util/json_util.cpp", |
| 44 | + "runtime/util/objc_json_serde.mm", |
| 45 | + ] + (glob([ |
| 46 | + "runtime/sdk/*.mm", |
| 47 | + ]) if build_sdk() else []), |
| 48 | + headers = glob([ |
| 49 | + "runtime/include/coreml_backend/delegate.h", |
| 50 | + "runtime/kvstore/*.hpp", |
| 51 | + "runtime/inmemoryfs/*.hpp", |
| 52 | + "runtime/delegate/*.h", |
| 53 | + "runtime/delegate/*.hpp", |
| 54 | + "runtime/util/*.h", |
| 55 | + "runtime/util/*.hpp", |
| 56 | + ]) + (glob([ |
| 57 | + "runtime/sdk/*.h", |
| 58 | + ]) if build_sdk() else []), |
| 59 | + compiler_flags = [ |
| 60 | + "-fobjc-arc", |
| 61 | + "-fno-exceptions", |
| 62 | + "-fno-rtti", |
| 63 | + "-Wno-null-character", |
| 64 | + "-Wno-receiver-expr", |
| 65 | + "-Wno-error", |
| 66 | + ], |
| 67 | + define_static_target = True, |
| 68 | + header_namespace = "backends/apple/coreml", |
| 69 | + exported_headers = ["runtime/delegate/executorch_operations.h", "runtime/include/coreml_backend/delegate.h"], |
| 70 | + fbobjc_ios_target_sdk_version = "13.0", |
| 71 | + fbobjc_frameworks = [ |
| 72 | + "Accelerate", |
| 73 | + "CoreML", |
| 74 | + "Foundation", |
| 75 | + ], |
| 76 | + include_directories = [ |
| 77 | + "runtime/include", |
| 78 | + "runtime/kvstore", |
| 79 | + "runtime/inmemoryfs", |
| 80 | + "runtime/delegate", |
| 81 | + "runtime/util", |
| 82 | + ] + ([ |
| 83 | + "runtime/sdk", |
| 84 | + ] if build_sdk() else []), |
| 85 | + fbobjc_libraries = [ |
| 86 | + "libsqlite3", |
| 87 | + ], |
| 88 | + link_whole = True, |
| 89 | + platforms = [APPLE], |
| 90 | + visibility = ["PUBLIC"], |
| 91 | + deps = [ |
| 92 | + "//executorch/runtime/backend:interface", |
| 93 | + "//executorch/runtime/core:core", |
| 94 | + "//executorch/runtime/kernel:kernel_includes", |
| 95 | + ] + ([ |
| 96 | + ":proto", |
| 97 | + ] if build_sdk() else []), |
| 98 | +) |
| 99 | + |
| 100 | +_PROTOS = [ |
| 101 | + "ArrayFeatureExtractor", |
| 102 | + "AudioFeaturePrint", |
| 103 | + "BayesianProbitRegressor", |
| 104 | + "CategoricalMapping", |
| 105 | + "ClassConfidenceThresholding", |
| 106 | + "CustomModel", |
| 107 | + "DataStructures", |
| 108 | + "DictVectorizer", |
| 109 | + "FeatureTypes", |
| 110 | + "FeatureVectorizer", |
| 111 | + "Gazetteer", |
| 112 | + "GLMClassifier", |
| 113 | + "GLMRegressor", |
| 114 | + "Identity", |
| 115 | + "Imputer", |
| 116 | + "ItemSimilarityRecommender", |
| 117 | + "LinkedModel", |
| 118 | + "MIL", |
| 119 | + "Model", |
| 120 | + "NearestNeighbors", |
| 121 | + "NeuralNetwork", |
| 122 | + "NonMaximumSuppression", |
| 123 | + "Normalizer", |
| 124 | + "OneHotEncoder", |
| 125 | + "Parameters", |
| 126 | + "Scaler", |
| 127 | + "SoundAnalysisPreprocessing", |
| 128 | + "SVM", |
| 129 | + "TextClassifier", |
| 130 | + "TreeEnsemble", |
| 131 | + "VisionFeaturePrint", |
| 132 | + "WordEmbedding", |
| 133 | + "WordTagger", |
| 134 | +] |
| 135 | + |
| 136 | +runtime.cxx_library( |
| 137 | + name = "proto", |
| 138 | + srcs = [ |
| 139 | + "fbsource//third-party/pypi/coremltools:exported-cpp-protoc[{}.pb.cc]".format(name) |
| 140 | + for name in _PROTOS |
| 141 | + ], |
| 142 | + exported_headers = { |
| 143 | + "format/{}.pb.h".format(name): "fbsource//third-party/pypi/coremltools:exported-cpp-protoc[{}.pb.h]".format(name) |
| 144 | + for name in _PROTOS |
| 145 | + }, |
| 146 | + compiler_flags = [ |
| 147 | + "-Wno-global-constructors", |
| 148 | + ], |
| 149 | + public_include_directories = [ |
| 150 | + "", |
| 151 | + ], |
| 152 | + deps = [ |
| 153 | + "//third-party/protobuf:fb-protobuf-lite", |
| 154 | + ], |
| 155 | +) |
0 commit comments