chromium/third_party/tensorflow_models/BUILD.gn

# Copyright 2022 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/sanitizers/sanitizers.gni")

config("tensorflow-models-config") {
  include_dirs = [
    "src/research/seq_flow_lite",

    # Include the "libutf" and "icu4c" subdirectories which redirects the
    # includes for those libraries to their Chromium versions without needing
    # patches.
    "shims",
  ]
}

static_library("tflite_custom_ops") {
  sources = [
    # Shim headers.
    "shims/icu4c/source/common/unicode/uchar.h",
    "shims/icu4c/source/common/unicode/utf8.h",

    # When adding/removing entries from this list, also change |update.sh| in
    # this directory.
    "src/research/seq_flow_lite/tf_ops/projection_normalizer_util.cc",
    "src/research/seq_flow_lite/tf_ops/projection_normalizer_util.h",
    "src/research/seq_flow_lite/tf_ops/projection_util.cc",
    "src/research/seq_flow_lite/tf_ops/projection_util.h",
    "src/research/seq_flow_lite/tf_ops/skipgram_finder.cc",
    "src/research/seq_flow_lite/tf_ops/skipgram_finder.h",
    "src/research/seq_flow_lite/tflite_ops/denylist.cc",
    "src/research/seq_flow_lite/tflite_ops/denylist.h",
    "src/research/seq_flow_lite/tflite_ops/denylist_skipgram.cc",
    "src/research/seq_flow_lite/tflite_ops/denylist_skipgram.h",
    "src/research/seq_flow_lite/tflite_ops/quantization_util.h",
    "src/research/seq_flow_lite/tflite_ops/sequence_string_projection.cc",
    "src/research/seq_flow_lite/tflite_ops/sequence_string_projection.h",
    "src/research/seq_flow_lite/tflite_ops/tflite_qrnn_pooling.cc",
    "src/research/seq_flow_lite/tflite_ops/tflite_qrnn_pooling.h",
  ]

  deps = [
    "//third_party/abseil-cpp:absl",
    "//third_party/flatbuffers",
    "//third_party/icu",
    "//third_party/tflite",
  ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]

  public_configs = [ ":tensorflow-models-config" ]
}