chromium/services/on_device_model/ml/BUILD.gn

# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/features.gni")
import("//services/on_device_model/on_device_model.gni")

source_set("api") {
  public = [ "chrome_ml_api.h" ]
  deps = [ "//third_party/dawn/src/dawn/native:headers" ]
}

component("ml_no_internal") {
  public = [
    "chrome_ml.h",
    "on_device_model_executor.h",
    "on_device_model_internal.h",
    "session_accessor.h",
    "utils.h",
  ]

  defines = [ "IS_ON_DEVICE_MODEL_ML_IMPL" ]

  sources = [
    "chrome_ml.cc",
    "gpu_blocklist.cc",
    "gpu_blocklist.h",
    "on_device_model_executor.cc",
    "on_device_model_internal.cc",
    "session_accessor.cc",
    "ts_model.cc",
    "ts_model.h",
    "utils.cc",
  ]

  deps = [
    "//components/language_detection/core:language_detection",
    "//components/optimization_guide/core:features",
    "//components/translate/core/language_detection",
    "//third_party/angle:includes",
    "//third_party/dawn/src/dawn:proc",
    "//third_party/dawn/src/dawn/native",
  ]
  if (use_blink) {
    deps += [ "//gpu/config" ]
  }
  public_deps = [
    ":api",
    "//base",
    "//mojo/public/cpp/bindings",
    "//services/on_device_model/public/cpp",
    "//services/on_device_model/public/mojom",
  ]
  if (use_blink) {
    deps += [ "//gpu/config:webgpu_blocklist_impl" ]
  }
}

if (enable_ml_internal) {
  source_set("ml") {
    public_deps = [ ":ml_no_internal" ]
    data_deps = [
      "//components/optimization_guide/internal:optimization_guide_internal",
    ]
  }
}