OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012 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. | |
4 | |
5 { | |
6 'target_defaults': { | |
7 'include_dirs': [ | |
8 'dist/cpp/src', | |
9 'dist/cpp/test', | |
10 # The libphonenumber source (and test code) expects the | |
11 # generated protocol headers to be available with "phonenumbers" include | |
12 # path, e.g. #include "phonenumbers/foo.pb.h". | |
13 '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber', | |
14 ], | |
15 'defines': [ | |
16 'I18N_PHONENUMBERS_USE_ALTERNATE_FORMATS=1', | |
17 'I18N_PHONENUMBERS_USE_ICU_REGEXP=1', | |
18 ], | |
19 'conditions': [ | |
20 # libphonenumber can only be thread-safe on POSIX platforms. This is ok | |
21 # since Android is the only Chromium port that requires thread-safety. | |
22 # It uses the PhoneNumberUtil singleton in renderer threads as opposed to | |
23 # other platforms that only use it in the browser process (on a single | |
24 # thread). Note that any unsafe use of the library would be caught by a | |
25 # DCHECK. | |
26 ['OS != "android"', { | |
27 'defines': [ | |
28 'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1', | |
29 ], | |
30 }], | |
31 ], | |
32 }, | |
33 'includes': [ | |
34 '../../build/win_precompile.gypi', | |
35 ], | |
36 'targets': [{ | |
37 # Build a library without metadata so that we can use it with both testing | |
38 # and production metadata. This library should not be used by clients. | |
39 # GN version: //third_party/libphonenumber:libphonenumber_without_metadata | |
40 'target_name': 'libphonenumber_without_metadata', | |
41 'type': 'static_library', | |
42 'dependencies': [ | |
43 '../icu/icu.gyp:icui18n', | |
44 '../icu/icu.gyp:icuuc', | |
45 '../protobuf/protobuf.gyp:protobuf_lite', | |
46 ], | |
47 'sources': [ | |
48 'dist/cpp/src/phonenumbers/alternate_format.cc', | |
49 'dist/cpp/src/phonenumbers/asyoutypeformatter.cc', | |
50 'dist/cpp/src/phonenumbers/base/strings/string_piece.cc', | |
51 'dist/cpp/src/phonenumbers/default_logger.cc', | |
52 'dist/cpp/src/phonenumbers/logger.cc', | |
53 'dist/cpp/src/phonenumbers/phonenumber.cc', | |
54 'dist/cpp/src/phonenumbers/phonenumbermatch.cc', | |
55 'dist/cpp/src/phonenumbers/phonenumbermatcher.cc', | |
56 'dist/cpp/src/phonenumbers/phonenumberutil.cc', | |
57 'dist/cpp/src/phonenumbers/regexp_adapter_icu.cc', | |
58 'dist/cpp/src/phonenumbers/regexp_cache.cc', | |
59 'dist/cpp/src/phonenumbers/string_byte_sink.cc', | |
60 'dist/cpp/src/phonenumbers/stringutil.cc', | |
61 'dist/cpp/src/phonenumbers/unicodestring.cc', | |
62 'dist/cpp/src/phonenumbers/utf/rune.c', | |
63 'dist/cpp/src/phonenumbers/utf/unicodetext.cc', | |
64 'dist/cpp/src/phonenumbers/utf/unilib.cc', | |
65 'dist/resources/phonemetadata.proto', | |
66 'dist/resources/phonenumber.proto', | |
67 ], | |
68 'variables': { | |
69 'proto_in_dir': 'dist/resources', | |
70 'proto_out_dir': 'third_party/libphonenumber/phonenumbers', | |
71 'clang_warning_flags': [ | |
72 # https://github.com/googlei18n/libphonenumber/pull/741 | |
73 '-Wno-unused-private-field', | |
74 ], | |
75 }, | |
76 'includes': [ '../../build/protoc.gypi' ], | |
77 'direct_dependent_settings': { | |
78 'include_dirs': [ | |
79 '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber', | |
80 'dist/cpp/src', | |
81 ], | |
82 'defines': [ | |
83 'I18N_PHONENUMBERS_USE_ALTERNATE_FORMATS=1', | |
84 'I18N_PHONENUMBERS_USE_ICU_REGEXP=1', | |
85 ], | |
86 'conditions': [ | |
87 ['OS != "android"', { | |
88 'defines': [ | |
89 'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1', | |
90 ], | |
91 }], | |
92 ], | |
93 }, | |
94 'conditions': [ | |
95 ['OS=="win"', { | |
96 'action': [ | |
97 '/wo4309', | |
98 ], | |
99 }], | |
100 ], | |
101 }, | |
102 { | |
103 # Library used by clients that includes production metadata. | |
104 # GN version: //third_party/libphonenumber | |
105 'target_name': 'libphonenumber', | |
106 'type': 'static_library', | |
107 'dependencies': [ | |
108 'libphonenumber_without_metadata', | |
109 ], | |
110 'export_dependent_settings': [ | |
111 'libphonenumber_without_metadata', | |
112 ], | |
113 'sources': [ | |
114 # Comment next line and uncomment the line after, if complete metadata | |
115 # (with examples) is needed. | |
116 'dist/cpp/src/phonenumbers/lite_metadata.cc', | |
117 #'dist/cpp/src/phonenumbers/metadata.cc', | |
118 ], | |
119 }, | |
120 { | |
121 # GN version: //third_party/libphonenumber:libphonenumber_unittests | |
122 'target_name': 'libphonenumber_unittests', | |
123 'type': 'executable', | |
124 'sources': [ | |
125 'dist/cpp/src/phonenumbers/test_metadata.cc', | |
126 'dist/cpp/test/phonenumbers/asyoutypeformatter_test.cc', | |
127 'dist/cpp/test/phonenumbers/phonenumbermatch_test.cc', | |
128 'dist/cpp/test/phonenumbers/phonenumbermatcher_test.cc', | |
129 'dist/cpp/test/phonenumbers/phonenumberutil_test.cc', | |
130 'dist/cpp/test/phonenumbers/regexp_adapter_test.cc', | |
131 'dist/cpp/test/phonenumbers/stringutil_test.cc', | |
132 'dist/cpp/test/phonenumbers/test_util.cc', | |
133 'dist/cpp/test/phonenumbers/unicodestring_test.cc', | |
134 ], | |
135 'dependencies': [ | |
136 '../icu/icu.gyp:icui18n', | |
137 '../icu/icu.gyp:icuuc', | |
138 '../../base/base.gyp:run_all_unittests', | |
139 '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynami
c_annotations', | |
140 '../../testing/gmock.gyp:gmock', | |
141 '../../testing/gtest.gyp:gtest', | |
142 'libphonenumber_without_metadata', | |
143 ], | |
144 'variables': { | |
145 'clang_warning_flags': [ | |
146 # https://github.com/googlei18n/libphonenumber/pull/741 | |
147 '-Wno-unused-private-field', | |
148 ], | |
149 }, | |
150 'conditions': [ | |
151 ['OS=="win"', { | |
152 'action': [ | |
153 '/wo4309', | |
154 ], | |
155 }], | |
156 # libphonenumber needs to fix their ODR violations. http://crbug.com/45602
1 | |
157 ['OS=="linux"', { | |
158 'ldflags!': [ | |
159 '-Wl,--detect-odr-violations', | |
160 ], | |
161 }], | |
162 ], | |
163 }] | |
164 } | |
OLD | NEW |