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