Disable content detection tests on Android
[chromium-blink-merge.git] / testing / gtest.gyp
blob7d57d0d0a6f41acccbfcb967e57c6baac704ba4d
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.
6   'targets': [
7     {
8       'target_name': 'gtest',
9       'type': 'static_library',
10       'sources': [
11         'gtest/include/gtest/gtest-death-test.h',
12         'gtest/include/gtest/gtest-message.h',
13         'gtest/include/gtest/gtest-param-test.h',
14         'gtest/include/gtest/gtest-printers.h',
15         'gtest/include/gtest/gtest-spi.h',
16         'gtest/include/gtest/gtest-test-part.h',
17         'gtest/include/gtest/gtest-typed-test.h',
18         'gtest/include/gtest/gtest.h',
19         'gtest/include/gtest/gtest_pred_impl.h',
20         'gtest/include/gtest/internal/gtest-death-test-internal.h',
21         'gtest/include/gtest/internal/gtest-filepath.h',
22         'gtest/include/gtest/internal/gtest-internal.h',
23         'gtest/include/gtest/internal/gtest-linked_ptr.h',
24         'gtest/include/gtest/internal/gtest-param-util-generated.h',
25         'gtest/include/gtest/internal/gtest-param-util.h',
26         'gtest/include/gtest/internal/gtest-port.h',
27         'gtest/include/gtest/internal/gtest-string.h',
28         'gtest/include/gtest/internal/gtest-tuple.h',
29         'gtest/include/gtest/internal/gtest-type-util.h',
30         'gtest/src/gtest-all.cc',
31         'gtest/src/gtest-death-test.cc',
32         'gtest/src/gtest-filepath.cc',
33         'gtest/src/gtest-internal-inl.h',
34         'gtest/src/gtest-port.cc',
35         'gtest/src/gtest-printers.cc',
36         'gtest/src/gtest-test-part.cc',
37         'gtest/src/gtest-typed-test.cc',
38         'gtest/src/gtest.cc',
39         'multiprocess_func_list.cc',
40         'multiprocess_func_list.h',
41         'platform_test.h',
42       ],
43       'sources!': [
44         'gtest/src/gtest-all.cc',  # Not needed by our build.
45       ],
46       'include_dirs': [
47         'gtest',
48         'gtest/include',
49       ],
50       'dependencies': [
51         'gtest_prod',
52       ],
53       'conditions': [
54         ['OS == "mac" or OS == "ios"', {
55           'sources': [
56             'gtest_mac.h',
57             'gtest_mac.mm',
58             'platform_test_mac.mm'
59           ],
60           'link_settings': {
61             'libraries': [
62               '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
63             ],
64           },
65         }],
66         ['OS == "ios"', {
67           'dependencies' : [
68             '<(DEPTH)/testing/iossim/iossim.gyp:iossim',
69           ],
70           'direct_dependent_settings': {
71             'target_conditions': [
72               # Turn all tests into bundles on iOS because that's the only
73               # type of executable supported for iOS.
74               ['_type=="executable"', {
75                 'variables': {
76                   # Use a variable so the path gets fixed up so it is always
77                   # correct when INFOPLIST_FILE finally gets set.
78                   'ios_unittest_info_plist_path':
79                     '<(DEPTH)/testing/gtest_ios/unittest-Info.plist',
80                 },
81                 'mac_bundle': 1,
82                 'xcode_settings': {
83                   'BUNDLE_ID_TEST_NAME':
84                     '>!(echo ">(_target_name)" | sed -e "s/_//g")',
85                   'INFOPLIST_FILE': '>(ios_unittest_info_plist_path)',
86                 },
87                 'mac_bundle_resources': [
88                   '<(ios_unittest_info_plist_path)',
89                 ],
90                 'mac_bundle_resources!': [
91                   '<(ios_unittest_info_plist_path)',
92                 ],
93               }],
94             ],
95           },
96         }],
97         ['os_posix == 1', {
98           'defines': [
99             # gtest isn't able to figure out when RTTI is disabled for gcc
100             # versions older than 4.3.2, and assumes it's enabled.  Our Mac
101             # and Linux builds disable RTTI, and cannot guarantee that the
102             # compiler will be 4.3.2. or newer.  The Mac, for example, uses
103             # 4.2.1 as that is the latest available on that platform.  gtest
104             # must be instructed that RTTI is disabled here, and for any
105             # direct dependents that might include gtest headers.
106             'GTEST_HAS_RTTI=0',
107           ],
108           'direct_dependent_settings': {
109             'defines': [
110               'GTEST_HAS_RTTI=0',
111             ],
112           },
113         }],
114         ['OS=="android" and android_app_abi=="x86"', {
115           'defines': [
116             'GTEST_HAS_CLONE=0',
117           ],
118           'direct_dependent_settings': {
119             'defines': [
120               'GTEST_HAS_CLONE=0',
121             ],
122           },
123         }],
124         ['OS=="android"', {
125           # We want gtest features that use tr1::tuple, but we currently
126           # don't support the variadic templates used by libstdc++'s
127           # implementation. gtest supports this scenario by providing its
128           # own implementation but we must opt in to it.
129           'defines': [
130             'GTEST_USE_OWN_TR1_TUPLE=1',
131             # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set.
132             # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0
133             # automatically on android, so it has to be set explicitly here.
134             'GTEST_HAS_TR1_TUPLE=1',
135           ],
136           'direct_dependent_settings': {
137             'defines': [
138               'GTEST_USE_OWN_TR1_TUPLE=1',
139               'GTEST_HAS_TR1_TUPLE=1',
140             ],
141           },
142         }],
143         ['OS=="win" and (MSVS_VERSION=="2012" or MSVS_VERSION=="2012e")', {
144           'defines': [
145             '_VARIADIC_MAX=10',
146           ],
147           'direct_dependent_settings': {
148             'defines': [
149               '_VARIADIC_MAX=10',
150             ],
151           },
152         }],
153       ],
154       'direct_dependent_settings': {
155         'defines': [
156           'UNIT_TEST',
157         ],
158         'include_dirs': [
159           'gtest/include',  # So that gtest headers can find themselves.
160         ],
161         'target_conditions': [
162           ['_type=="executable"', {
163             'test': 1,
164             'conditions': [
165               ['OS=="mac"', {
166                 'run_as': {
167                   'action????': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}'],
168                 },
169               }],
170               ['OS=="ios"', {
171                 'variables': {
172                   # Use a variable so the path gets fixed up so it is always
173                   # correct when the action finally gets used.
174                   'ios_run_unittest_script_path':
175                     '<(DEPTH)/testing/gtest_ios/run-unittest.sh',
176                 },
177                 'run_as': {
178                   'action????': ['>(ios_run_unittest_script_path)'],
179                 },
180               }],
181               ['OS=="win"', {
182                 'run_as': {
183                   'action????': ['$(TargetPath)', '--gtest_print_time'],
184                 },
185               }],
186             ],
187           }],
188         ],
189         'msvs_disabled_warnings': [4800],
190       },
191     },
192     {
193       'target_name': 'gtest_main',
194       'type': 'static_library',
195       'dependencies': [
196         'gtest',
197       ],
198       'sources': [
199         'gtest/src/gtest_main.cc',
200       ],
201     },
202     {
203       'target_name': 'gtest_prod',
204       'toolsets': ['host', 'target'],
205       'type': 'none',
206       'sources': [
207         'gtest/include/gtest/gtest_prod.h',
208       ],
209     },
210   ],