libphonenumber.gyp revision 5821806d5e7f356e8fa4b058a389a808ea183019
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      '../..',  # add it first, so src/base headers are used instead of the ones
9                # brought with the library as cc files would be taken from the
10                # main chrome tree as well.
11      'src',
12      'src/test',
13      # The libphonenumber source (and test code) expects the
14      # generated protocol headers to be available with "phonenumbers" include
15      # path, e.g. #include "phonenumbers/foo.pb.h".
16      '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
17    ],
18    'defines': [
19      'USE_HASH_MAP=1',
20      'USE_GOOGLE_BASE=1',
21      'USE_ICU_REGEXP=1',
22    ],
23  },
24  'includes': [
25    '../../build/win_precompile.gypi',
26  ],
27  'targets': [{
28    # Build a library without metadata so that we can use it with both testing
29    # and production metadata. This library should not be used by clients.
30    'target_name': 'libphonenumber_without_metadata',
31    'type': 'static_library',
32    'dependencies': [
33      '../../base/base.gyp:base',
34      '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
35      '../icu/icu.gyp:icui18n',
36      '../icu/icu.gyp:icuuc',
37      '../protobuf/protobuf.gyp:protobuf_lite',
38    ],
39    'sources': [
40      'src/phonenumbers/asyoutypeformatter.cc',
41      'src/phonenumbers/default_logger.cc',
42      'src/phonenumbers/logger.cc',
43      'src/phonenumbers/phonenumber.cc',
44      'src/phonenumbers/phonenumbermatch.cc',
45      'src/phonenumbers/phonenumbermatcher.cc',
46      'src/phonenumbers/phonenumberutil.cc',
47      'src/phonenumbers/regexp_adapter_icu.cc',
48      'src/phonenumbers/regexp_cache.cc',
49      'src/phonenumbers/string_byte_sink.cc',
50      'src/phonenumbers/stringutil.cc',
51      'src/phonenumbers/unicodestring.cc',
52      'src/phonenumbers/utf/rune.c',
53      'src/phonenumbers/utf/unicodetext.cc',
54      'src/phonenumbers/utf/unilib.cc',
55      'src/resources/phonemetadata.proto',
56      'src/resources/phonenumber.proto',
57    ],
58    'variables': {
59      'proto_in_dir': 'src/resources',
60      'proto_out_dir': 'third_party/libphonenumber/phonenumbers',
61    },
62    'includes': [ '../../build/protoc.gypi' ],
63    'direct_dependent_settings': {
64      'include_dirs': [
65        '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
66        'src',
67      ],
68    },
69    'conditions': [
70      ['OS=="win"', {
71        'action': [
72          '/wo4309',
73        ],
74      }],
75    ],
76  },
77  {
78    # Library used by clients that includes production metadata.
79    'target_name': 'libphonenumber',
80    'type': 'static_library',
81    'dependencies': [
82      'libphonenumber_without_metadata',
83    ],
84    'export_dependent_settings': [
85      'libphonenumber_without_metadata',
86    ],
87    'sources': [
88      # Comment next line and uncomment the line after, if complete metadata
89      # (with examples) is needed.
90      'src/phonenumbers/lite_metadata.cc',
91      #'src/phonenumbers/metadata.cc',
92    ],
93  },
94  {
95    'target_name': 'libphonenumber_unittests',
96    'type': 'executable',
97    'sources': [
98      'src/phonenumbers/test_metadata.cc',
99      'src/test/phonenumbers/asyoutypeformatter_test.cc',
100      'src/test/phonenumbers/phonenumbermatch_test.cc',
101      'src/test/phonenumbers/phonenumbermatcher_test.cc',
102      'src/test/phonenumbers/phonenumberutil_test.cc',
103      'src/test/phonenumbers/regexp_adapter_test.cc',
104      'src/test/phonenumbers/stringutil_test.cc',
105      'src/test/phonenumbers/test_util.cc',
106      'src/test/phonenumbers/unicodestring_test.cc',
107    ],
108    'dependencies': [
109      '../icu/icu.gyp:icui18n',
110      '../icu/icu.gyp:icuuc',
111      '../../base/base.gyp:base',
112      '../../base/base.gyp:run_all_unittests',
113      '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
114      '../../testing/gmock.gyp:gmock',
115      '../../testing/gtest.gyp:gtest',
116      'libphonenumber_without_metadata',
117    ],
118    'conditions': [
119      ['OS=="win"', {
120        'action': [
121          '/wo4309',
122        ],
123      }],
124    ],
125  }]
126}
127