blob: 1d8923932386d5591292e23485fc97303602dfa3 [file] [log] [blame]
# Copyright 2014 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")
# We need a component because this gives access to a per-process
# singleton instance of the model. Without a component, we end up an
# instance in each component that uses the library.
component("core") {
sources = [
"background_file.cc",
"background_file.h",
"constants.h",
"features.cc",
"features.h",
"language_detection_model.cc",
"language_detection_model.h",
]
if (use_blink) {
sources += [
"language_detection_provider.cc",
"language_detection_provider.h",
]
}
deps = [
":internals",
"//base",
"//components/optimization_guide/core:features",
"//third_party/tflite",
"//third_party/tflite_support",
"//third_party/tflite_support:tflite_support_proto",
]
defines = [ "IS_LANGUAGE_DETECTION_IMPL" ]
}
static_library("internals") {
visibility = [
":core",
":unit_tests",
]
sources = [
"embedding_lookup.cc",
"embedding_lookup.h",
"language_detection_resolver.h",
"ngram_hash.cc",
"ngram_hash.h",
"ngram_hash_ops_utils.cc",
"ngram_hash_ops_utils.h",
"quantization_utils.cc",
"quantization_utils.h",
]
deps = [
"//base",
"//third_party/smhasher:murmurhash2",
"//third_party/tflite",
"//third_party/utf",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"background_file_unittest.cc",
"language_detection_model_unittest.cc",
"ngram_hash_ops_utils_unittest.cc",
"quantization_utils_unittest.cc",
]
if (use_blink) {
sources += [ "language_detection_provider_unittest.cc" ]
}
deps = [
":core",
":internals",
"//base",
"//base/test:test_support",
"//components/language_detection/testing",
"//components/translate/core/common:common",
]
}