Home | History | Annotate | Download | only in cpp
      1 # Copyright (C) 2013 Google Inc.
      2 #
      3 # Licensed under the Apache License, Version 2.0 (the "License");
      4 # you may not use this file except in compliance with the License.
      5 # You may obtain a copy of the License at
      6 #
      7 # http://www.apache.org/licenses/LICENSE-2.0
      8 #
      9 # Unless required by applicable law or agreed to in writing, software
     10 # distributed under the License is distributed on an "AS IS" BASIS,
     11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 # See the License for the specific language governing permissions and
     13 # limitations under the License.
     14 {
     15   'variables': {
     16     'component%': 'shared_library',
     17   },
     18   'target_defaults': {
     19     'conditions': [
     20       ['OS == "linux" and "<(component)" == "shared_library"', {
     21         # https://code.google.com/p/gyp/issues/detail?id=374
     22         'cflags': ['-fPIC'],
     23       }],
     24     ],
     25     'include_dirs': [
     26       'include',
     27     ],
     28   },
     29   'targets': [
     30     {
     31       'target_name': 'libaddressinput',
     32       'type': '<(component)',
     33       'sources': [
     34         'src/address_field.cc',
     35         'src/address_field_util.cc',
     36         'src/address_problem.cc',
     37         'src/address_ui.cc',
     38         'src/address_validator.cc',
     39         'src/localization.cc',
     40         'src/lookup_key_util.cc',
     41         'src/region_data_constants.cc',
     42         'src/retriever.cc',
     43         'src/rule.cc',
     44         'src/rule_retriever.cc',
     45         'src/util/json.cc',
     46         'src/util/md5.cc',
     47         'src/util/string_split.cc',
     48         'src/validating_storage.cc',
     49         'src/validating_util.cc',
     50       ],
     51       'defines': [
     52         'VALIDATION_DATA_URL="https://i18napis.appspot.com/ssl-address/"',
     53       ],
     54       'dependencies': [
     55         'grit.gyp:generated_messages',
     56         'rapidjson.gyp:rapidjson',
     57       ],
     58     },
     59     {
     60       'target_name': 'unit_tests',
     61       'type': 'executable',
     62       'sources': [
     63         'test/address_field_util_test.cc',
     64         'test/address_ui_test.cc',
     65         'test/fake_downloader.cc',
     66         'test/fake_downloader_test.cc',
     67         'test/fake_storage.cc',
     68         'test/fake_storage_test.cc',
     69         'test/localization_test.cc',
     70         'test/lookup_key_util_test.cc',
     71         'test/region_data_constants_test.cc',
     72         'test/retriever_test.cc',
     73         'test/rule_retriever_test.cc',
     74         'test/rule_test.cc',
     75         'test/util/json_test.cc',
     76         'test/util/md5_unittest.cc',
     77         'test/util/scoped_ptr_unittest.cc',
     78         'test/util/string_split_unittest.cc',
     79         'test/validating_storage_test.cc',
     80         'test/validating_util_test.cc',
     81       ],
     82       'defines': [
     83         'TEST_DATA_DIR="../testdata"',
     84       ],
     85       'include_dirs': [
     86         'src',
     87       ],
     88       'dependencies': [
     89         'libaddressinput',
     90         'gtest.gyp:main',
     91       ],
     92       'conditions': [
     93         [ 'OS == "mac"', {
     94           'postbuilds': [
     95             {
     96               # To make it possible to execute the unit tests directly from the
     97               # build directory, without first installing the library, the path
     98               # to the library is set to be relative to the unit test executable
     99               # (so that also the library will be loaded directly from the build
    100               # directory).
    101               'postbuild_name': 'Make dylib path relative to executable',
    102               'action': [
    103                 'install_name_tool',
    104                 '-change',
    105                 '/usr/local/lib/libaddressinput.dylib',
    106                 '@executable_path/libaddressinput.dylib',
    107                 '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
    108               ],
    109             },
    110           ],
    111         }],
    112       ],
    113     },
    114   ],
    115 }
    116