Fix for Geolocation webTCT failures
[platform/framework/web/chromium-efl.git] / third_party / sentencepiece / BUILD.gn
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.
4
5 import("//third_party/protobuf/proto_library.gni")
6
7 config("sentencepiece_config") {
8   include_dirs = [
9     "src/src",
10     "src",
11     "shims",
12     "$root_gen_dir/third_party/sentencepiece/src",
13   ]
14
15   defines = [
16     "DARTS_DISABLE_EXCEPTIONS=1",
17     "SENTENCEPIECE_DISABLE_EXCEPTIONS=1",
18   ]
19 }
20
21 config("sentencepiece_flags") {
22   cflags = [
23     "-Wno-deprecated-anon-enum-enum-conversion",
24     "-Wno-macro-redefined",
25   ]
26 }
27
28 proto_library("sentencepiece_proto") {
29   proto_in_dir = "src/src"
30   cc_generator_options = "lite=true:"
31   sources = [
32     "src/src/sentencepiece.proto",
33     "src/src/sentencepiece_model.proto",
34   ]
35 }
36
37 static_library("sentencepiece") {
38   include_dirs = [ "$target_gen_dir/src/src" ]
39   sources = [
40     "src/src/bpe_model.cc",
41     "src/src/bpe_model.h",
42     "src/src/builder.cc",
43     "src/src/builder.h",
44     "src/src/char_model.cc",
45     "src/src/char_model.h",
46     "src/src/common.h",
47     "src/src/error.cc",
48     "src/src/filesystem.cc",
49     "src/src/filesystem.h",
50     "src/src/freelist.h",
51     "src/src/init.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",
67     "src/src/util.cc",
68     "src/src/util.h",
69     "src/src/word_model.cc",
70     "src/src/word_model.h",
71   ]
72
73   deps = [
74     ":sentencepiece_proto",
75     "//third_party/abseil-cpp:absl",
76     "//third_party/protobuf:protobuf_lite",
77   ]
78
79   configs -= [ "//build/config/compiler:chromium_code" ]
80   configs += [ "//build/config/compiler:no_chromium_code" ]
81
82   public_configs = [
83     ":sentencepiece_config",
84   ]
85
86   configs += [
87     ":sentencepiece_flags",
88   ]
89 }