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 'includes': ['libaddressinput.gypi'], 19 'target_defaults': { 20 'include_dirs': [ 21 'include', 22 ], 23 }, 24 'targets': [ 25 { 26 'target_name': 'libaddressinput', 27 'type': '<(component)', 28 'sources': [ 29 '<@(libaddressinput_files)', 30 ], 31 'dependencies': [ 32 'grit.gyp:generated_messages', 33 'rapidjson.gyp:rapidjson', 34 're2.gyp:re2', 35 ], 36 'conditions': [ 37 ['OS == "linux" and _type == "shared_library"', { 38 # https://code.google.com/p/gyp/issues/detail?id=374 39 'cflags': ['-fPIC'], 40 }], 41 ], 42 }, 43 { 44 'target_name': 'unit_tests', 45 'type': 'executable', 46 'sources': [ 47 '<@(libaddressinput_test_files)', 48 ], 49 'defines': [ 50 'TEST_DATA_DIR="../testdata"', 51 ], 52 'include_dirs': [ 53 'src', 54 ], 55 'dependencies': [ 56 'libaddressinput', 57 'gtest.gyp:main', 58 ], 59 'conditions': [ 60 [ 'OS == "mac"', { 61 'postbuilds': [ 62 { 63 # To make it possible to execute the unit tests directly from the 64 # build directory, without first installing the library, the path 65 # to the library is set to be relative to the unit test executable 66 # (so that also the library will be loaded directly from the build 67 # directory). 68 'postbuild_name': 'Make dylib path relative to executable', 69 'action': [ 70 'install_name_tool', 71 '-change', 72 '/usr/local/lib/libaddressinput.dylib', 73 '@executable_path/libaddressinput.dylib', 74 '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' 75 ], 76 }, 77 ], 78 }], 79 ], 80 }, 81 ], 82} 83