summaryrefslogtreecommitdiffstats
path: root/third_party/libphonenumber/libphonenumber.gyp
blob: c0e26b6271a410ef883e603efb7913154c03b04e (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
# Copyright (c) 2011 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.

{
  'variables': {
    'protoc_out_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
  },
  'target_defaults': {
    'include_dirs': [
      '../..',  # add it first, so src/base headers are used instead of the ones
                # brought with the library as cc files would be taken from the
                # main chrome tree as well.
      'cpp/src',
      '<(protoc_out_dir)',
      '../protobuf/src',
      '../icu/public/common',
      '../icu/public/i18n',
    ],
    'defines': [
      'U_USING_ICU_NAMESPACE=0',
    ],
    'conditions': [
      ['OS!="win" or component=="static_library"', {
        'defines': [
          'U_STATIC_IMPLEMENTATION',
        ],
      }],
    ],
  },
  'targets': [{
    'target_name': 'libphonenumber',
    'type': 'static_library',
    'dependencies': [
      '../icu/icu.gyp:icui18n',
      '../icu/icu.gyp:icuuc',
      '../protobuf/protobuf.gyp:protobuf_lite',
      '../../base/base.gyp:base',
      '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
      'phonenumber_proto',
    ],
    'sources': [
      'chrome/regexp_adapter_icuregexp.cc',
      'cpp/src/default_logger.cc',
      'cpp/src/logger_adapter.cc',
      'cpp/src/metadata.cc',
      'cpp/src/phonenumber.cc',
      'cpp/src/phonenumberutil.cc',
      'cpp/src/stringutil.cc',
      'cpp/src/utf/rune.c',
      'cpp/src/utf/unicodetext.cc',
      'cpp/src/utf/unilib.cc',
      # Generated by phonenumber_proto.
      '<(protoc_out_dir)/phonemetadata.pb.cc',
      '<(protoc_out_dir)/phonenumber.pb.cc',
    ],
    'conditions': [
      ['OS=="win"', {
        'action': [
          '/wo4309',
        ],
      }],
    ],
  },
  {
    # Protobuf compiler / generate rule for the phones
    'target_name': 'phonenumber_proto',
    'type': 'none',
    'sources': [
      'resources/phonemetadata.proto',
      'resources/phonenumber.proto',
    ],
    'rules': [{
      'rule_name': 'genproto',
      'extension': 'proto',
      'inputs': [
        '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
      ],
      'variables': {
        # The protoc compiler requires a proto_path argument with the
        # directory containing the .proto file.
        # There's no generator variable that corresponds to this, so fake it.
        'rule_input_relpath': 'resources',
      },
      'outputs': [
        '<(protoc_out_dir)/<(RULE_INPUT_ROOT).pb.h',
        '<(protoc_out_dir)/<(RULE_INPUT_ROOT).pb.cc',
      ],
      'action': [
        '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
        '--proto_path=<(rule_input_relpath)',
        '<(rule_input_relpath)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
        '--cpp_out=<(protoc_out_dir)',
      ],
      'message': 'Generating C++ code from <(RULE_INPUT_PATH)',
    }],
    'dependencies': [
      '../protobuf/protobuf.gyp:protobuf_lite',
      '../protobuf/protobuf.gyp:protoc#host',
    ],
    'direct_dependent_settings': {
      'include_dirs': [
        '<(protoc_out_dir)',
      ]
    },
    'export_dependent_settings': [
      '../../third_party/protobuf/protobuf.gyp:protobuf_lite',
    ],
  },
  {
    'target_name': 'libphonenumber_unittests',
    'type': 'executable',
    'sources': [
      '../../base/test/run_all_unittests.cc',
      'cpp/src/phonenumberutil_test.cc',
      'cpp/src/regexp_adapter_unittest.cc',
      'cpp/src/stringutil_test.cc',
      'cpp/src/test_metadata.cc',
    ],
    'dependencies': [
      '../icu/icu.gyp:icui18n',
      '../icu/icu.gyp:icuuc',
      '../protobuf/protobuf.gyp:protobuf_lite',
      '../../base/base.gyp:base',
      '../../base/base.gyp:test_support_base',
      '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
      '../../testing/gmock.gyp:gmock',
      '../../testing/gtest.gyp:gtest',
      'libphonenumber',
    ],
    'conditions': [
      ['OS=="win"', {
        'action': [
          '/wo4309',
        ],
      }],
    ],
  }]
}