Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / third_party / libphonenumber / BUILD.gn
blob2f04ff53735d758a6775553294a02a384380a09a
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("//third_party/protobuf/proto_library.gni")
7 proto_library("proto") {
8   sources = [
9     "src/resources/phonemetadata.proto",
10     "src/resources/phonenumber.proto",
11   ]
12   proto_out_dir = "third_party/libphonenumber/phonenumbers"
15 config("libphonenumber_config") {
16   include_dirs = [
17     "src",
18     "$root_gen_dir/third_party/libphonenumber",
19   ]
20   defines = [ "I18N_PHONENUMBERS_USE_ICU_REGEXP=1" ]
21   if (!is_android) {
22     defines += [ "I18N_PHONENUMBERS_NO_THREAD_SAFETY=1" ]
23   }
26 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber_without_metadata
27 static_library("libphonenumber_without_metadata") {
28   sources = [
29     "src/phonenumbers/asyoutypeformatter.cc",
30     "src/phonenumbers/base/strings/string_piece.cc",
31     "src/phonenumbers/default_logger.cc",
32     "src/phonenumbers/logger.cc",
33     "src/phonenumbers/phonenumber.cc",
34     "src/phonenumbers/phonenumbermatch.cc",
35     "src/phonenumbers/phonenumbermatcher.cc",
36     "src/phonenumbers/phonenumberutil.cc",
37     "src/phonenumbers/regexp_adapter_icu.cc",
38     "src/phonenumbers/regexp_cache.cc",
39     "src/phonenumbers/string_byte_sink.cc",
40     "src/phonenumbers/stringutil.cc",
41     "src/phonenumbers/unicodestring.cc",
42     "src/phonenumbers/utf/rune.c",
43     "src/phonenumbers/utf/unicodetext.cc",
44     "src/phonenumbers/utf/unilib.cc",
45   ]
47   # TODO(scottmg): Temporary until https://codereview.appspot.com/134650043/
48   # lands and rolls. http://crbug.com/335824
49   configs -= [ "//build/config/compiler:chromium_code" ]
50   configs += [ "//build/config/compiler:no_chromium_code" ]
52   public_configs = [ ":libphonenumber_config" ]
54   public_deps = [
55     ":proto",
56   ]
57   deps = [
58     ":proto",
59     "//third_party/icu",
60     "//third_party/protobuf:protobuf_lite",
61   ]
64 # Library used by clients that includes production metadata.
65 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber
66 static_library("libphonenumber") {
67   sources = [
68     # Comment next line and uncomment the line after, if complete metadata
69     # (with examples) is needed.
70     "src/phonenumbers/lite_metadata.cc",
71     #"src/phonenumbers/metadata.cc",
72   ]
74   public_deps = [
75     ":libphonenumber_without_metadata",
76   ]
79 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber_unittests
80 test("libphonenumber_unittests") {
81   sources = [
82     "src/phonenumbers/test_metadata.cc",
83     "src/test/phonenumbers/asyoutypeformatter_test.cc",
84     "src/test/phonenumbers/phonenumbermatch_test.cc",
85     "src/test/phonenumbers/phonenumbermatcher_test.cc",
86     "src/test/phonenumbers/phonenumberutil_test.cc",
87     "src/test/phonenumbers/regexp_adapter_test.cc",
88     "src/test/phonenumbers/stringutil_test.cc",
89     "src/test/phonenumbers/test_util.cc",
90     "src/test/phonenumbers/unicodestring_test.cc",
91   ]
93   include_dirs = [ "src/test" ]
95   # gn orders flags on a target before flags from configs. The default config
96   # adds -Wall, and these flags have to be after -Wall -- so they need to come
97   # from a config and can't be on the target directly.
98   config("libphonenumber_unittests_warnings") {
99     if (is_clang) {
100       cflags = [ "-Wno-unused-local-typedef" ]
101     }
102   }
103   configs += [ ":libphonenumber_unittests_warnings" ]
105   deps = [
106     ":libphonenumber_without_metadata",
107     "//base",
108     "//base/test:run_all_unittests",
109     "//base/third_party/dynamic_annotations",
110     "//third_party/icu",
111     "//testing/gmock",
112     "//testing/gtest",
113   ]