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     'target_name': 'libphonenumber_without_metadata',
     39     'type': 'static_library',
     40     'dependencies': [
     41       '../icu/icu.gyp:icui18n',
     42       '../icu/icu.gyp:icuuc',
     43       '../protobuf/protobuf.gyp:protobuf_lite',
     44     ],
     45     'sources': [
     46       'src/phonenumbers/asyoutypeformatter.cc',
     47       'src/phonenumbers/base/strings/string_piece.cc',
     48       'src/phonenumbers/default_logger.cc',
     49       'src/phonenumbers/logger.cc',
     50       'src/phonenumbers/phonenumber.cc',
     51       'src/phonenumbers/phonenumbermatch.cc',
     52       'src/phonenumbers/phonenumbermatcher.cc',
     53       'src/phonenumbers/phonenumberutil.cc',
     54       'src/phonenumbers/regexp_adapter_icu.cc',
     55       'src/phonenumbers/regexp_cache.cc',
     56       'src/phonenumbers/string_byte_sink.cc',
     57       'src/phonenumbers/stringutil.cc',
     58       'src/phonenumbers/unicodestring.cc',
     59       'src/phonenumbers/utf/rune.c',
     60       'src/phonenumbers/utf/unicodetext.cc',
     61       'src/phonenumbers/utf/unilib.cc',
     62       'src/resources/phonemetadata.proto',
     63       'src/resources/phonenumber.proto',
     64     ],
     65     'variables': {
     66       'proto_in_dir': 'src/resources',
     67       'proto_out_dir': 'third_party/libphonenumber/phonenumbers',
     68     },
     69     'includes': [ '../../build/protoc.gypi' ],
     70     'direct_dependent_settings': {
     71       'include_dirs': [
     72         '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
     73         'src',
     74       ],
     75       'defines': [
     76         'I18N_PHONENUMBERS_USE_ICU_REGEXP=1',
     77       ],
     78       'conditions': [
     79         ['OS != "android"', {
     80           'defines': [
     81             'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1',
     82           ],
     83         }],
     84       ],
     85     },
     86     'conditions': [
     87       ['OS=="win"', {
     88         'action': [
     89           '/wo4309',
     90         ],
     91       }],
     92     ],
     93   },
     94   {
     95     # Library used by clients that includes production metadata.
     96     'target_name': 'libphonenumber',
     97     'type': 'static_library',
     98     'dependencies': [
     99       'libphonenumber_without_metadata',
    100     ],
    101     'export_dependent_settings': [
    102       'libphonenumber_without_metadata',
    103     ],
    104     'sources': [
    105       # Comment next line and uncomment the line after, if complete metadata
    106       # (with examples) is needed.
    107       'src/phonenumbers/lite_metadata.cc',
    108       #'src/phonenumbers/metadata.cc',
    109     ],
    110   },
    111   {
    112     'target_name': 'libphonenumber_unittests',
    113     'type': 'executable',
    114     'sources': [
    115       'src/phonenumbers/test_metadata.cc',
    116       'src/test/phonenumbers/asyoutypeformatter_test.cc',
    117       'src/test/phonenumbers/phonenumbermatch_test.cc',
    118       'src/test/phonenumbers/phonenumbermatcher_test.cc',
    119       'src/test/phonenumbers/phonenumberutil_test.cc',
    120       'src/test/phonenumbers/regexp_adapter_test.cc',
    121       'src/test/phonenumbers/stringutil_test.cc',
    122       'src/test/phonenumbers/test_util.cc',
    123       'src/test/phonenumbers/unicodestring_test.cc',
    124     ],
    125     'dependencies': [
    126       '../icu/icu.gyp:icui18n',
    127       '../icu/icu.gyp:icuuc',
    128       '../../base/base.gyp:run_all_unittests',
    129       '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
    130       '../../testing/gmock.gyp:gmock',
    131       '../../testing/gtest.gyp:gtest',
    132       'libphonenumber_without_metadata',
    133     ],
    134     'conditions': [
    135       ['OS=="win"', {
    136         'action': [
    137           '/wo4309',
    138         ],
    139       }],
    140     ],
    141   }]
    142 }
    143