Home | History | Annotate | Download | only in libphonenumber
      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       '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     },
     70     'includes': [ '../../build/protoc.gypi' ],
     71     'direct_dependent_settings': {
     72       'include_dirs': [
     73         '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
     74         'src',
     75       ],
     76       'defines': [
     77         'I18N_PHONENUMBERS_USE_ICU_REGEXP=1',
     78       ],
     79       'conditions': [
     80         ['OS != "android"', {
     81           'defines': [
     82             'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1',
     83           ],
     84         }],
     85       ],
     86     },
     87     'conditions': [
     88       ['OS=="win"', {
     89         'action': [
     90           '/wo4309',
     91         ],
     92       }],
     93     ],
     94   },
     95   {
     96     # Library used by clients that includes production metadata.
     97     # GN version: //third_party/libphonenumber
     98     'target_name': 'libphonenumber',
     99     'type': 'static_library',
    100     'dependencies': [
    101       'libphonenumber_without_metadata',
    102     ],
    103     'export_dependent_settings': [
    104       'libphonenumber_without_metadata',
    105     ],
    106     'sources': [
    107       # Comment next line and uncomment the line after, if complete metadata
    108       # (with examples) is needed.
    109       'src/phonenumbers/lite_metadata.cc',
    110       #'src/phonenumbers/metadata.cc',
    111     ],
    112   },
    113   {
    114     # GN version: //third_party/libphonenumber:libphonenumber_unittests
    115     'target_name': 'libphonenumber_unittests',
    116     'type': 'executable',
    117     'sources': [
    118       'src/phonenumbers/test_metadata.cc',
    119       'src/test/phonenumbers/asyoutypeformatter_test.cc',
    120       'src/test/phonenumbers/phonenumbermatch_test.cc',
    121       'src/test/phonenumbers/phonenumbermatcher_test.cc',
    122       'src/test/phonenumbers/phonenumberutil_test.cc',
    123       'src/test/phonenumbers/regexp_adapter_test.cc',
    124       'src/test/phonenumbers/stringutil_test.cc',
    125       'src/test/phonenumbers/test_util.cc',
    126       'src/test/phonenumbers/unicodestring_test.cc',
    127     ],
    128     'dependencies': [
    129       '../icu/icu.gyp:icui18n',
    130       '../icu/icu.gyp:icuuc',
    131       '../../base/base.gyp:run_all_unittests',
    132       '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
    133       '../../testing/gmock.gyp:gmock',
    134       '../../testing/gtest.gyp:gtest',
    135       'libphonenumber_without_metadata',
    136     ],
    137     'conditions': [
    138       ['OS=="win"', {
    139         'action': [
    140           '/wo4309',
    141         ],
    142       }],
    143     ],
    144   }]
    145 }
    146