1 # Copyright 2023 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//third_party/protobuf/proto_library.gni")
7 config("sentencepiece_config") {
12 "$root_gen_dir/third_party/sentencepiece/src",
16 "DARTS_DISABLE_EXCEPTIONS=1",
17 "SENTENCEPIECE_DISABLE_EXCEPTIONS=1",
21 config("sentencepiece_flags") {
23 "-Wno-deprecated-anon-enum-enum-conversion",
24 "-Wno-macro-redefined",
28 proto_library("sentencepiece_proto") {
29 proto_in_dir = "src/src"
30 cc_generator_options = "lite=true:"
32 "src/src/sentencepiece.proto",
33 "src/src/sentencepiece_model.proto",
37 static_library("sentencepiece") {
38 include_dirs = [ "$target_gen_dir/src/src" ]
40 "src/src/bpe_model.cc",
41 "src/src/bpe_model.h",
44 "src/src/char_model.cc",
45 "src/src/char_model.h",
48 "src/src/filesystem.cc",
49 "src/src/filesystem.h",
52 "src/src/model_factory.cc",
53 "src/src/model_factory.h",
54 "src/src/model_interface.cc",
55 "src/src/model_interface.h",
56 "src/src/normalization_rule.h",
57 "src/src/normalizer.cc",
58 "src/src/normalizer.h",
59 "src/src/sentencepiece_processor.cc",
60 "src/src/sentencepiece_processor.h",
61 "src/src/spec_parser.h",
62 "src/src/unicode_script.cc",
63 "src/src/unicode_script.h",
64 "src/src/unicode_script_map.h",
65 "src/src/unigram_model.cc",
66 "src/src/unigram_model.h",
69 "src/src/word_model.cc",
70 "src/src/word_model.h",
74 ":sentencepiece_proto",
75 "//third_party/abseil-cpp:absl",
76 "//third_party/protobuf:protobuf_lite",
79 configs -= [ "//build/config/compiler:chromium_code" ]
80 configs += [ "//build/config/compiler:no_chromium_code" ]
83 ":sentencepiece_config",
87 ":sentencepiece_flags",