summaryrefslogtreecommitdiffstats
path: root/third_party/libphonenumber/libphonenumber.gyp
blob: 229440bfaa861dcc0668834f12d75b27a4985cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright (c) 2012 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.

{
  'target_defaults': {
    'include_dirs': [
      'src',
      'src/test',
      # The libphonenumber source (and test code) expects the
      # generated protocol headers to be available with "phonenumbers" include
      # path, e.g. #include "phonenumbers/foo.pb.h".
      '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
    ],
    'defines': [
      'I18N_PHONENUMBERS_USE_ICU_REGEXP=1',
    ],
    'conditions': [
      # libphonenumber can only be thread-safe on POSIX platforms. This is ok
      # since Android is the only Chromium port that requires thread-safety.
      # It uses the PhoneNumberUtil singleton in renderer threads as opposed to
      # other platforms that only use it in the browser process (on a single
      # thread). Note that any unsafe use of the library would be caught by a
      # DCHECK.
      ['OS != "android"', {
        'defines': [
          'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1',
        ],
      }],
    ],
  },
  'includes': [
    '../../build/win_precompile.gypi',
  ],
  'targets': [{
    # Build a library without metadata so that we can use it with both testing
    # and production metadata. This library should not be used by clients.
    # GN version: //third_party/libphonenumber:libphonenumber_without_metadata
    'target_name': 'libphonenumber_without_metadata',
    'type': 'static_library',
    'dependencies': [
      '../icu/icu.gyp:icui18n',
      '../icu/icu.gyp:icuuc',
      '../protobuf/protobuf.gyp:protobuf_lite',
    ],
    'sources': [
      'src/phonenumbers/asyoutypeformatter.cc',
      'src/phonenumbers/base/strings/string_piece.cc',
      'src/phonenumbers/default_logger.cc',
      'src/phonenumbers/logger.cc',
      'src/phonenumbers/phonenumber.cc',
      'src/phonenumbers/phonenumbermatch.cc',
      'src/phonenumbers/phonenumbermatcher.cc',
      'src/phonenumbers/phonenumberutil.cc',
      'src/phonenumbers/regexp_adapter_icu.cc',
      'src/phonenumbers/regexp_cache.cc',
      'src/phonenumbers/string_byte_sink.cc',
      'src/phonenumbers/stringutil.cc',
      'src/phonenumbers/unicodestring.cc',
      'src/phonenumbers/utf/rune.c',
      'src/phonenumbers/utf/unicodetext.cc',
      'src/phonenumbers/utf/unilib.cc',
      'src/resources/phonemetadata.proto',
      'src/resources/phonenumber.proto',
    ],
    'variables': {
      'proto_in_dir': 'src/resources',
      'proto_out_dir': 'third_party/libphonenumber/phonenumbers',
    },
    'includes': [ '../../build/protoc.gypi' ],
    'direct_dependent_settings': {
      'include_dirs': [
        '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
        'src',
      ],
      'defines': [
        'I18N_PHONENUMBERS_USE_ICU_REGEXP=1',
      ],
      'conditions': [
        ['OS != "android"', {
          'defines': [
            'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1',
          ],
        }],
      ],
    },
    'conditions': [
      ['OS=="win"', {
        'action': [
          '/wo4309',
        ],
      }],
    ],
  },
  {
    # Library used by clients that includes production metadata.
    # GN version: //third_party/libphonenumber
    'target_name': 'libphonenumber',
    'type': 'static_library',
    'dependencies': [
      'libphonenumber_without_metadata',
    ],
    'export_dependent_settings': [
      'libphonenumber_without_metadata',
    ],
    'sources': [
      # Comment next line and uncomment the line after, if complete metadata
      # (with examples) is needed.
      'src/phonenumbers/lite_metadata.cc',
      #'src/phonenumbers/metadata.cc',
    ],
  },
  {
    # GN version: //third_party/libphonenumber:libphonenumber_unittests
    'target_name': 'libphonenumber_unittests',
    'type': 'executable',
    'sources': [
      'src/phonenumbers/test_metadata.cc',
      'src/test/phonenumbers/asyoutypeformatter_test.cc',
      'src/test/phonenumbers/phonenumbermatch_test.cc',
      'src/test/phonenumbers/phonenumbermatcher_test.cc',
      'src/test/phonenumbers/phonenumberutil_test.cc',
      'src/test/phonenumbers/regexp_adapter_test.cc',
      'src/test/phonenumbers/stringutil_test.cc',
      'src/test/phonenumbers/test_util.cc',
      'src/test/phonenumbers/unicodestring_test.cc',
    ],
    'dependencies': [
      '../icu/icu.gyp:icui18n',
      '../icu/icu.gyp:icuuc',
      '../../base/base.gyp:run_all_unittests',
      '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
      '../../testing/gmock.gyp:gmock',
      '../../testing/gtest.gyp:gtest',
      'libphonenumber_without_metadata',
    ],
    'conditions': [
      ['OS=="win"', {
        'action': [
          '/wo4309',
        ],
      }],
    ],
  }]
}