# 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") { _configs = configs configs = [] configs = [ "//third_party/tflite:tflite_shim_config" ] + _configs sources = [ "background_file.cc", "background_file.h", "chinese_script_classifier.cc", "chinese_script_classifier.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/icu", "//third_party/tflite", "//third_party/tflite_support", "//third_party/tflite_support:tflite_support_proto", ] defines = [ "IS_LANGUAGE_DETECTION_IMPL" ] } static_library("internals") { _configs = configs configs = [] configs = [ "//third_party/tflite:tflite_shim_config" ] + _configs 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", "chinese_script_classifier_test.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", ] }