naiveproxy/third_party/libphonenumber/BUILD.gn

122 lines
3.6 KiB
Plaintext
Raw Normal View History

2018-01-28 21:32:06 +03:00
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//testing/test.gni")
import("//third_party/protobuf/proto_library.gni")
proto_library("proto") {
sources = [
"dist/resources/phonemetadata.proto",
"dist/resources/phonenumber.proto",
]
proto_out_dir = "third_party/libphonenumber/phonenumbers"
}
config("libphonenumber_config") {
include_dirs = [
"dist/cpp/src",
"$root_gen_dir/third_party/libphonenumber",
]
defines = [
"I18N_PHONENUMBERS_USE_ICU_REGEXP=1",
"I18N_PHONENUMBERS_USE_ALTERNATE_FORMATS=1",
]
if (!is_android) {
defines += [ "I18N_PHONENUMBERS_NO_THREAD_SAFETY=1" ]
}
}
config("libphonenumber_config_internal") {
if (is_clang) {
cflags = [
# https://github.com/googlei18n/libphonenumber/pull/741
"-Wno-unused-private-field",
]
}
}
static_library("libphonenumber_without_metadata") {
sources = [
"dist/cpp/src/phonenumbers/alternate_format.cc",
"dist/cpp/src/phonenumbers/asyoutypeformatter.cc",
"dist/cpp/src/phonenumbers/base/strings/string_piece.cc",
"dist/cpp/src/phonenumbers/default_logger.cc",
"dist/cpp/src/phonenumbers/logger.cc",
"dist/cpp/src/phonenumbers/phonenumber.cc",
"dist/cpp/src/phonenumbers/phonenumbermatch.cc",
"dist/cpp/src/phonenumbers/phonenumbermatcher.cc",
"dist/cpp/src/phonenumbers/phonenumberutil.cc",
"dist/cpp/src/phonenumbers/regexp_adapter_icu.cc",
"dist/cpp/src/phonenumbers/regexp_cache.cc",
"dist/cpp/src/phonenumbers/string_byte_sink.cc",
"dist/cpp/src/phonenumbers/stringutil.cc",
"dist/cpp/src/phonenumbers/unicodestring.cc",
"dist/cpp/src/phonenumbers/utf/rune.c",
"dist/cpp/src/phonenumbers/utf/unicodetext.cc",
"dist/cpp/src/phonenumbers/utf/unilib.cc",
]
# libphonenumber's base/logging.h is a minimal implementation where DCHECKs
# do not consume their arguments. This leads to unused variable warnings in
# release builds.
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
":libphonenumber_config_internal",
]
public_configs = [ ":libphonenumber_config" ]
public_deps = [
":proto",
]
deps = [
":proto",
"//third_party/icu",
"//third_party/protobuf:protobuf_lite",
]
}
# Library used by clients that includes production metadata.
static_library("libphonenumber") {
sources = [
# Comment next line and uncomment the line after, if complete metadata
# (with examples) is needed.
"dist/cpp/src/phonenumbers/lite_metadata.cc",
#"dist/cpp/src/phonenumbers/metadata.cc",
]
public_deps = [
":libphonenumber_without_metadata",
]
}
test("libphonenumber_unittests") {
sources = [
"dist/cpp/src/phonenumbers/test_metadata.cc",
"dist/cpp/test/phonenumbers/asyoutypeformatter_test.cc",
"dist/cpp/test/phonenumbers/phonenumbermatch_test.cc",
"dist/cpp/test/phonenumbers/phonenumbermatcher_test.cc",
"dist/cpp/test/phonenumbers/phonenumberutil_test.cc",
"dist/cpp/test/phonenumbers/regexp_adapter_test.cc",
"dist/cpp/test/phonenumbers/stringutil_test.cc",
"dist/cpp/test/phonenumbers/test_util.cc",
"dist/cpp/test/phonenumbers/unicodestring_test.cc",
]
configs += [ ":libphonenumber_config_internal" ]
include_dirs = [ "dist/cpp/test" ]
deps = [
":libphonenumber_without_metadata",
"//base",
"//base/test:run_all_unittests",
"//base/third_party/dynamic_annotations",
"//testing/gmock",
"//testing/gtest",
"//third_party/icu",
]
}