Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / libphonenumber / BUILD.gn
blobedd808a66d741d87e43a68671c0b84bc35de18e7
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//testing/test.gni")
6 import("//third_party/protobuf/proto_library.gni")
8 proto_library("proto") {
9   sources = [
10     "src/resources/phonemetadata.proto",
11     "src/resources/phonenumber.proto",
12   ]
13   proto_out_dir = "third_party/libphonenumber/phonenumbers"
16 config("libphonenumber_config") {
17   include_dirs = [
18     "src",
19     "$root_gen_dir/third_party/libphonenumber",
20   ]
21   defines = [ "I18N_PHONENUMBERS_USE_ICU_REGEXP=1" ]
22   if (!is_android) {
23     defines += [ "I18N_PHONENUMBERS_NO_THREAD_SAFETY=1" ]
24   }
27 config("libphonenumber_config_internal") {
28   if (is_clang) {
29     cflags = [
30       # https://github.com/googlei18n/libphonenumber/pull/741
31       "-Wno-unused-private-field",
32     ]
33   }
36 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber_without_metadata
37 static_library("libphonenumber_without_metadata") {
38   sources = [
39     "src/phonenumbers/asyoutypeformatter.cc",
40     "src/phonenumbers/base/strings/string_piece.cc",
41     "src/phonenumbers/default_logger.cc",
42     "src/phonenumbers/logger.cc",
43     "src/phonenumbers/phonenumber.cc",
44     "src/phonenumbers/phonenumbermatch.cc",
45     "src/phonenumbers/phonenumbermatcher.cc",
46     "src/phonenumbers/phonenumberutil.cc",
47     "src/phonenumbers/regexp_adapter_icu.cc",
48     "src/phonenumbers/regexp_cache.cc",
49     "src/phonenumbers/string_byte_sink.cc",
50     "src/phonenumbers/stringutil.cc",
51     "src/phonenumbers/unicodestring.cc",
52     "src/phonenumbers/utf/rune.c",
53     "src/phonenumbers/utf/unicodetext.cc",
54     "src/phonenumbers/utf/unilib.cc",
55   ]
57   # libphonenumber's base/logging.h is a minimal implementation where DCHECKs
58   # do not consume their arguments. This leads to unused variable warnings in
59   # release builds.
60   configs -= [ "//build/config/compiler:chromium_code" ]
61   configs += [
62     "//build/config/compiler:no_chromium_code",
63     ":libphonenumber_config_internal",
64   ]
66   public_configs = [ ":libphonenumber_config" ]
68   public_deps = [
69     ":proto",
70   ]
71   deps = [
72     ":proto",
73     "//third_party/icu",
74     "//third_party/protobuf:protobuf_lite",
75   ]
78 # Library used by clients that includes production metadata.
79 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber
80 static_library("libphonenumber") {
81   sources = [
82     # Comment next line and uncomment the line after, if complete metadata
83     # (with examples) is needed.
84     "src/phonenumbers/lite_metadata.cc",
85     #"src/phonenumbers/metadata.cc",
86   ]
88   public_deps = [
89     ":libphonenumber_without_metadata",
90   ]
93 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber_unittests
94 test("libphonenumber_unittests") {
95   sources = [
96     "src/phonenumbers/test_metadata.cc",
97     "src/test/phonenumbers/asyoutypeformatter_test.cc",
98     "src/test/phonenumbers/phonenumbermatch_test.cc",
99     "src/test/phonenumbers/phonenumbermatcher_test.cc",
100     "src/test/phonenumbers/phonenumberutil_test.cc",
101     "src/test/phonenumbers/regexp_adapter_test.cc",
102     "src/test/phonenumbers/stringutil_test.cc",
103     "src/test/phonenumbers/test_util.cc",
104     "src/test/phonenumbers/unicodestring_test.cc",
105   ]
107   configs += [ ":libphonenumber_config_internal" ]
109   include_dirs = [ "src/test" ]
111   deps = [
112     ":libphonenumber_without_metadata",
113     "//base",
114     "//base/test:run_all_unittests",
115     "//base/third_party/dynamic_annotations",
116     "//third_party/icu",
117     "//testing/gmock",
118     "//testing/gtest",
119   ]