chromium/chrome/services/speech/soda/BUILD.gn

# Copyright 2020 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/chromeos/ui_mode.gni")
import("//components/soda/buildflags.gni")
import("//third_party/protobuf/proto_library.gni")

assert(!is_android)

proto_library("soda_api_proto") {
  sources = [ "proto/soda_api.proto" ]
}

source_set("soda") {
  sources = [
    "soda_async_impl.h",
    "soda_client.cc",
    "soda_client.h",
    "soda_test_paths.h",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  deps = [
    ":soda_api_proto",
    "//base",
    "//media/mojo/mojom",
  ]

  if (is_chromeos_ash) {
    sources += [
      "cros_soda_client.cc",
      "cros_soda_client.h",
    ]
    deps += [
      "//chromeos/services/machine_learning/public/cpp",
      "//chromeos/services/machine_learning/public/mojom",
    ]
  }
}

# TODO(robsc): add unit test for cros_soda_client.
source_set("unit_tests") {
  testonly = true

  if (enable_soda_integration_tests) {
    sources = [ "soda_client_unittest.cc" ]

    if (is_mac) {
      data_deps = [ "//third_party/soda-mac64:soda_resources" ]
    } else if (is_win && target_cpu == "x86") {
      data_deps = [ "//third_party/soda-win32:soda_resources" ]
    } else if (is_win && target_cpu == "x64") {
      data_deps = [ "//third_party/soda-win64:soda_resources" ]
    } else {
      data_deps = [ "//third_party/soda:soda_resources" ]
    }

    deps = [
      ":soda",
      "//base",
      "//chrome/services/speech/soda:soda_api_proto",
      "//media",
      "//testing/gtest",
    ]
  }
}