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