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") {
10 "src/resources/phonemetadata.proto",
11 "src/resources/phonenumber.proto",
13 proto_out_dir = "third_party/libphonenumber/phonenumbers"
16 config("libphonenumber_config") {
19 "$root_gen_dir/third_party/libphonenumber",
21 defines = [ "I18N_PHONENUMBERS_USE_ICU_REGEXP=1" ]
23 defines += [ "I18N_PHONENUMBERS_NO_THREAD_SAFETY=1" ]
27 config("libphonenumber_config_internal") {
30 # https://github.com/googlei18n/libphonenumber/pull/741
31 "-Wno-unused-private-field",
36 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber_without_metadata
37 static_library("libphonenumber_without_metadata") {
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",
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
60 configs -= [ "//build/config/compiler:chromium_code" ]
62 "//build/config/compiler:no_chromium_code",
63 ":libphonenumber_config_internal",
66 public_configs = [ ":libphonenumber_config" ]
74 "//third_party/protobuf:protobuf_lite",
78 # Library used by clients that includes production metadata.
79 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber
80 static_library("libphonenumber") {
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",
89 ":libphonenumber_without_metadata",
93 # GYP version: third_party/libphonenumber/libphonenumber.gyp:libphonenumber_unittests
94 test("libphonenumber_unittests") {
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",
107 configs += [ ":libphonenumber_config_internal" ]
109 include_dirs = [ "src/test" ]
112 ":libphonenumber_without_metadata",
114 "//base/test:run_all_unittests",
115 "//base/third_party/dynamic_annotations",