[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 1 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | { |
[email protected] | 3de01399 | 2014-08-14 14:22:42 | [diff] [blame] | 6 | 'includes': [ |
| 7 | 'gtest.gypi', |
| 8 | ], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 9 | 'targets': [ |
| 10 | { |
| 11 | 'target_name': 'gtest', |
[email protected] | 603ed1e8 | 2014-06-02 15:57:33 | [diff] [blame] | 12 | 'toolsets': ['host', 'target'], |
[email protected] | 5a54733 | 2011-05-19 23:18:53 | [diff] [blame] | 13 | 'type': 'static_library', |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 14 | 'sources': [ |
[email protected] | 3de01399 | 2014-08-14 14:22:42 | [diff] [blame] | 15 | '<@(gtest_sources)', |
[email protected] | 22015c33 | 2009-06-22 18:32:21 | [diff] [blame] | 16 | ], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 17 | 'include_dirs': [ |
| 18 | 'gtest', |
| 19 | 'gtest/include', |
| 20 | ], |
[email protected] | f30ef80 | 2011-12-02 15:27:57 | [diff] [blame] | 21 | 'dependencies': [ |
| 22 | 'gtest_prod', |
| 23 | ], |
[email protected] | e260ebc | 2013-12-18 05:31:33 | [diff] [blame] | 24 | 'defines': [ |
| 25 | # In order to allow regex matches in gtest to be shared between Windows |
| 26 | # and other systems, we tell gtest to always use it's internal engine. |
| 27 | 'GTEST_HAS_POSIX_RE=0', |
[email protected] | b6bf5c32 | 2014-08-09 05:24:02 | [diff] [blame] | 28 | # Chrome doesn't support / require C++11, yet. |
| 29 | 'GTEST_LANG_CXX11=0', |
[email protected] | e260ebc | 2013-12-18 05:31:33 | [diff] [blame] | 30 | ], |
| 31 | 'all_dependent_settings': { |
| 32 | 'defines': [ |
| 33 | 'GTEST_HAS_POSIX_RE=0', |
[email protected] | b6bf5c32 | 2014-08-09 05:24:02 | [diff] [blame] | 34 | 'GTEST_LANG_CXX11=0', |
[email protected] | e260ebc | 2013-12-18 05:31:33 | [diff] [blame] | 35 | ], |
| 36 | }, |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 37 | 'conditions': [ |
[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 38 | ['OS == "mac" or OS == "ios"', { |
[email protected] | 1bba09c | 2009-08-13 12:53:16 | [diff] [blame] | 39 | 'sources': [ |
[email protected] | ecebcc9 | 2010-08-06 02:39:26 | [diff] [blame] | 40 | 'gtest_mac.h', |
| 41 | 'gtest_mac.mm', |
eugenebut | a016a7e | 2015-02-04 18:15:00 | [diff] [blame] | 42 | 'platform_test_mac.mm', |
[email protected] | 1bba09c | 2009-08-13 12:53:16 | [diff] [blame] | 43 | ], |
[email protected] | c77043fc | 2009-08-20 22:37:59 | [diff] [blame] | 44 | 'link_settings': { |
| 45 | 'libraries': [ |
| 46 | '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', |
| 47 | ], |
| 48 | }, |
[email protected] | 1bba09c | 2009-08-13 12:53:16 | [diff] [blame] | 49 | }], |
[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 50 | ['OS == "ios"', { |
[email protected] | 57871bc | 2012-08-20 16:28:12 | [diff] [blame] | 51 | 'dependencies' : [ |
[email protected] | 296bc45 | 2013-05-13 21:29:47 | [diff] [blame] | 52 | '<(DEPTH)/testing/iossim/iossim.gyp:iossim#host', |
[email protected] | 57871bc | 2012-08-20 16:28:12 | [diff] [blame] | 53 | ], |
[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 54 | 'direct_dependent_settings': { |
| 55 | 'target_conditions': [ |
| 56 | # Turn all tests into bundles on iOS because that's the only |
| 57 | # type of executable supported for iOS. |
| 58 | ['_type=="executable"', { |
| 59 | 'variables': { |
| 60 | # Use a variable so the path gets fixed up so it is always |
| 61 | # correct when INFOPLIST_FILE finally gets set. |
| 62 | 'ios_unittest_info_plist_path': |
| 63 | '<(DEPTH)/testing/gtest_ios/unittest-Info.plist', |
| 64 | }, |
| 65 | 'mac_bundle': 1, |
| 66 | 'xcode_settings': { |
| 67 | 'BUNDLE_ID_TEST_NAME': |
| 68 | '>!(echo ">(_target_name)" | sed -e "s/_//g")', |
| 69 | 'INFOPLIST_FILE': '>(ios_unittest_info_plist_path)', |
| 70 | }, |
| 71 | 'mac_bundle_resources': [ |
| 72 | '<(ios_unittest_info_plist_path)', |
rohitrao | d2f3488 | 2014-10-08 19:25:31 | [diff] [blame] | 73 | '<(DEPTH)/testing/gtest_ios/Default.png', |
[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 74 | ], |
| 75 | 'mac_bundle_resources!': [ |
| 76 | '<(ios_unittest_info_plist_path)', |
| 77 | ], |
| 78 | }], |
| 79 | ], |
| 80 | }, |
[email protected] | 9b00523e | 2014-07-10 00:41:02 | [diff] [blame] | 81 | 'sources': [ |
| 82 | 'coverage_util_ios.cc', |
| 83 | 'coverage_util_ios.h', |
[email protected] | 9b00523e | 2014-07-10 00:41:02 | [diff] [blame] | 84 | ], |
[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 85 | }], |
[email protected] | a22906d | 2013-07-03 08:26:51 | [diff] [blame] | 86 | ['OS=="ios" and asan==1', { |
| 87 | 'direct_dependent_settings': { |
| 88 | 'target_conditions': [ |
| 89 | # Package the ASan runtime dylib into the test app bundles. |
| 90 | ['_type=="executable"', { |
| 91 | 'postbuilds': [ |
| 92 | { |
| 93 | 'variables': { |
| 94 | # Define copy_asan_dylib_path in a variable ending in |
| 95 | # _path so that gyp understands it's a path and |
| 96 | # performs proper relativization during dict merging. |
| 97 | 'copy_asan_dylib_path': |
| 98 | '<(DEPTH)/build/mac/copy_asan_runtime_dylib.sh', |
| 99 | }, |
| 100 | 'postbuild_name': 'Copy ASan runtime dylib', |
| 101 | 'action': [ |
[email protected] | a5963c5 | 2013-07-09 14:19:27 | [diff] [blame] | 102 | '>(copy_asan_dylib_path)', |
[email protected] | a22906d | 2013-07-03 08:26:51 | [diff] [blame] | 103 | ], |
| 104 | }, |
| 105 | ], |
| 106 | }], |
| 107 | ], |
| 108 | }, |
| 109 | }], |
[email protected] | 6a654d45 | 2011-05-23 22:06:54 | [diff] [blame] | 110 | ['os_posix == 1', { |
[email protected] | 1bba09c | 2009-08-13 12:53:16 | [diff] [blame] | 111 | 'defines': [ |
| 112 | # gtest isn't able to figure out when RTTI is disabled for gcc |
| 113 | # versions older than 4.3.2, and assumes it's enabled. Our Mac |
| 114 | # and Linux builds disable RTTI, and cannot guarantee that the |
| 115 | # compiler will be 4.3.2. or newer. The Mac, for example, uses |
| 116 | # 4.2.1 as that is the latest available on that platform. gtest |
| 117 | # must be instructed that RTTI is disabled here, and for any |
| 118 | # direct dependents that might include gtest headers. |
| 119 | 'GTEST_HAS_RTTI=0', |
| 120 | ], |
| 121 | 'direct_dependent_settings': { |
| 122 | 'defines': [ |
| 123 | 'GTEST_HAS_RTTI=0', |
| 124 | ], |
| 125 | }, |
| 126 | }], |
[email protected] | f5c7758a | 2012-07-25 16:17:57 | [diff] [blame] | 127 | ['OS=="android" and android_app_abi=="x86"', { |
| 128 | 'defines': [ |
| 129 | 'GTEST_HAS_CLONE=0', |
| 130 | ], |
| 131 | 'direct_dependent_settings': { |
| 132 | 'defines': [ |
| 133 | 'GTEST_HAS_CLONE=0', |
| 134 | ], |
| 135 | }, |
| 136 | }], |
[email protected] | 128cb99 | 2012-10-09 23:21:44 | [diff] [blame] | 137 | ['OS=="android"', { |
[email protected] | fbf26a0 | 2011-09-05 10:03:47 | [diff] [blame] | 138 | # We want gtest features that use tr1::tuple, but we currently |
| 139 | # don't support the variadic templates used by libstdc++'s |
| 140 | # implementation. gtest supports this scenario by providing its |
[email protected] | 58680ce | 2010-09-18 00:09:15 | [diff] [blame] | 141 | # own implementation but we must opt in to it. |
| 142 | 'defines': [ |
| 143 | 'GTEST_USE_OWN_TR1_TUPLE=1', |
[email protected] | c957f418 | 2012-12-03 21:28:14 | [diff] [blame] | 144 | # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set. |
| 145 | # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0 |
| 146 | # automatically on android, so it has to be set explicitly here. |
| 147 | 'GTEST_HAS_TR1_TUPLE=1', |
[email protected] | 58680ce | 2010-09-18 00:09:15 | [diff] [blame] | 148 | ], |
| 149 | 'direct_dependent_settings': { |
| 150 | 'defines': [ |
| 151 | 'GTEST_USE_OWN_TR1_TUPLE=1', |
[email protected] | c957f418 | 2012-12-03 21:28:14 | [diff] [blame] | 152 | 'GTEST_HAS_TR1_TUPLE=1', |
[email protected] | 58680ce | 2010-09-18 00:09:15 | [diff] [blame] | 153 | ], |
| 154 | }, |
| 155 | }], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 156 | ], |
| 157 | 'direct_dependent_settings': { |
| 158 | 'defines': [ |
| 159 | 'UNIT_TEST', |
| 160 | ], |
| 161 | 'include_dirs': [ |
[email protected] | 5290aaa | 2009-05-28 06:02:56 | [diff] [blame] | 162 | 'gtest/include', # So that gtest headers can find themselves. |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 163 | ], |
| 164 | 'target_conditions': [ |
[email protected] | 8855583 | 2010-12-17 16:04:03 | [diff] [blame] | 165 | ['_type=="executable"', { |
| 166 | 'test': 1, |
| 167 | 'conditions': [ |
| 168 | ['OS=="mac"', { |
| 169 | 'run_as': { |
| 170 | 'action????': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}'], |
| 171 | }, |
| 172 | }], |
[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 173 | ['OS=="ios"', { |
| 174 | 'variables': { |
| 175 | # Use a variable so the path gets fixed up so it is always |
| 176 | # correct when the action finally gets used. |
| 177 | 'ios_run_unittest_script_path': |
[email protected] | 58cddec2 | 2012-07-26 11:52:27 | [diff] [blame] | 178 | '<(DEPTH)/testing/gtest_ios/run-unittest.sh', |
[email protected] | 17f7c434 | 2012-07-09 14:41:14 | [diff] [blame] | 179 | }, |
| 180 | 'run_as': { |
| 181 | 'action????': ['>(ios_run_unittest_script_path)'], |
| 182 | }, |
| 183 | }], |
[email protected] | 8855583 | 2010-12-17 16:04:03 | [diff] [blame] | 184 | ['OS=="win"', { |
| 185 | 'run_as': { |
| 186 | 'action????': ['$(TargetPath)', '--gtest_print_time'], |
| 187 | }, |
| 188 | }], |
| 189 | ], |
| 190 | }], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 191 | ], |
[email protected] | c836d7a0 | 2009-10-03 20:47:21 | [diff] [blame] | 192 | 'msvs_disabled_warnings': [4800], |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 193 | }, |
sammc | 5648c85 | 2015-07-02 01:25:00 | [diff] [blame] | 194 | 'variables': { |
| 195 | 'clang_warning_flags': [ |
| 196 | # The Mutex constructor initializer list in gtest-port.cc is |
| 197 | # incorrectly ordered. See |
| 198 | # https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ. |
| 199 | '-Wno-reorder', |
| 200 | ] |
| 201 | }, |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 202 | }, |
[email protected] | 4b0f963 | 2009-05-06 19:13:06 | [diff] [blame] | 203 | { |
[email protected] | 016498e | 2010-12-03 00:59:23 | [diff] [blame] | 204 | 'target_name': 'gtest_main', |
[email protected] | 5a54733 | 2011-05-19 23:18:53 | [diff] [blame] | 205 | 'type': 'static_library', |
[email protected] | 4b0f963 | 2009-05-06 19:13:06 | [diff] [blame] | 206 | 'dependencies': [ |
| 207 | 'gtest', |
| 208 | ], |
| 209 | 'sources': [ |
| 210 | 'gtest/src/gtest_main.cc', |
| 211 | ], |
| 212 | }, |
[email protected] | f30ef80 | 2011-12-02 15:27:57 | [diff] [blame] | 213 | { |
| 214 | 'target_name': 'gtest_prod', |
| 215 | 'toolsets': ['host', 'target'], |
| 216 | 'type': 'none', |
| 217 | 'sources': [ |
| 218 | 'gtest/include/gtest/gtest_prod.h', |
| 219 | ], |
| 220 | }, |
[email protected] | 2f80c31 | 2009-02-25 21:26:55 | [diff] [blame] | 221 | ], |
| 222 | } |