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_data.cc', 35 'src/address_field.cc', 36 'src/address_problem.cc', 37 'src/address_ui.cc', 38 'src/address_validator.cc', 39 'src/country_rules_aggregator.cc', 40 'src/fallback_data_store.cc', 41 'src/region_data_constants.cc', 42 'src/retriever.cc', 43 'src/rule.cc', 44 'src/ruleset.cc', 45 'src/util/canonicalize_string.cc', 46 'src/util/json.cc', 47 'src/util/md5.cc', 48 'src/util/string_util.cc', 49 'src/util/trie.cc', 50 ], 51 'defines': [ 52 'VALIDATION_DATA_URL="https://i18napis.appspot.com/ssl-aggregate-address/"', 53 ], 54 'dependencies': [ 55 'grit.gyp:generated_messages', 56 'rapidjson.gyp:rapidjson', 57 're2.gyp:re2', 58 ], 59 }, 60 { 61 'target_name': 'unit_tests', 62 'type': 'executable', 63 'sources': [ 64 'test/address_data_test.cc', 65 'test/address_ui_test.cc', 66 'test/address_validator_test.cc', 67 'test/country_rules_aggregator_test.cc', 68 'test/fake_downloader.cc', 69 'test/fake_downloader_test.cc', 70 'test/fake_storage.cc', 71 'test/fake_storage_test.cc', 72 'test/fallback_data_store_test.cc', 73 'test/region_data_constants_test.cc', 74 'test/retriever_test.cc', 75 'test/rule_test.cc', 76 'test/storage_test_runner.cc', 77 'test/util/json_test.cc', 78 'test/util/md5_unittest.cc', 79 'test/util/scoped_ptr_unittest.cc', 80 'test/util/stl_util_unittest.cc', 81 'test/util/string_util_test.cc', 82 'test/util/trie_test.cc', 83 ], 84 'defines': [ 85 'TEST_DATA_DIR="../testdata"', 86 ], 87 'include_dirs': [ 88 'src', 89 ], 90 'dependencies': [ 91 'libaddressinput', 92 'gtest.gyp:main', 93 ], 94 'conditions': [ 95 [ 'OS == "mac"', { 96 'postbuilds': [ 97 { 98 # To make it possible to execute the unit tests directly from the 99 # build directory, without first installing the library, the path 100 # to the library is set to be relative to the unit test executable 101 # (so that also the library will be loaded directly from the build 102 # directory). 103 'postbuild_name': 'Make dylib path relative to executable', 104 'action': [ 105 'install_name_tool', 106 '-change', 107 '/usr/local/lib/libaddressinput.dylib', 108 '@executable_path/libaddressinput.dylib', 109 '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' 110 ], 111 }, 112 ], 113 }], 114 ], 115 }, 116 ], 117 } 118