Fix leaks in the embedder tests themselves.
[pdfium.git] / testing / gtest.gyp
1 # Copyright 2014 PDFium 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.
4 #
5 # Original code from V8, original license was:
6 # Copyright 2014 the V8 project authors. All rights reserved.
7 # Use of this source code is governed by a BSD-style license that can be
8 # found in the LICENSE file.
9 #
10 # This file is used only by the standalone PDFium build.  Under a chromium
11 # checkout, the src/testing/gtest.gyp file is used instead.
12 {
13   'targets': [
14     {
15       'target_name': 'gtest',
16       'toolsets': ['host', 'target'],
17       'type': 'static_library',
18       'sources': [
19         'gtest/include/gtest/gtest-death-test.h',
20         'gtest/include/gtest/gtest-message.h',
21         'gtest/include/gtest/gtest-param-test.h',
22         'gtest/include/gtest/gtest-printers.h',
23         'gtest/include/gtest/gtest-spi.h',
24         'gtest/include/gtest/gtest-test-part.h',
25         'gtest/include/gtest/gtest-typed-test.h',
26         'gtest/include/gtest/gtest.h',
27         'gtest/include/gtest/gtest_pred_impl.h',
28         'gtest/include/gtest/internal/gtest-death-test-internal.h',
29         'gtest/include/gtest/internal/gtest-filepath.h',
30         'gtest/include/gtest/internal/gtest-internal.h',
31         'gtest/include/gtest/internal/gtest-linked_ptr.h',
32         'gtest/include/gtest/internal/gtest-param-util-generated.h',
33         'gtest/include/gtest/internal/gtest-param-util.h',
34         'gtest/include/gtest/internal/gtest-port.h',
35         'gtest/include/gtest/internal/gtest-string.h',
36         'gtest/include/gtest/internal/gtest-tuple.h',
37         'gtest/include/gtest/internal/gtest-type-util.h',
38         'gtest/src/gtest-all.cc',
39         'gtest/src/gtest-death-test.cc',
40         'gtest/src/gtest-filepath.cc',
41         'gtest/src/gtest-internal-inl.h',
42         'gtest/src/gtest-port.cc',
43         'gtest/src/gtest-printers.cc',
44         'gtest/src/gtest-test-part.cc',
45         'gtest/src/gtest-typed-test.cc',
46         'gtest/src/gtest.cc',
47         'gtest-support.h',
48       ],
49       'sources!': [
50         'gtest/src/gtest-all.cc',  # Not needed by our build.
51       ],
52       'include_dirs': [
53         'gtest',
54         'gtest/include',
55       ],
56       'dependencies': [
57         'gtest_prod',
58       ],
59       'defines': [
60         # In order to allow regex matches in gtest to be shared between Windows
61         # and other systems, we tell gtest to always use it's internal engine.
62         'GTEST_HAS_POSIX_RE=0',
63         # Unit tests don't require C++11, yet.
64         'GTEST_LANG_CXX11=0',
65       ],
66       'all_dependent_settings': {
67         'defines': [
68           'GTEST_HAS_POSIX_RE=0',
69           'GTEST_LANG_CXX11=0',
70         ],
71       },
72       'conditions': [
73         ['os_posix == 1', {
74           'defines': [
75             # gtest isn't able to figure out when RTTI is disabled for gcc
76             # versions older than 4.3.2, and assumes it's enabled.  Our Mac
77             # and Linux builds disable RTTI, and cannot guarantee that the
78             # compiler will be 4.3.2. or newer.  The Mac, for example, uses
79             # 4.2.1 as that is the latest available on that platform.  gtest
80             # must be instructed that RTTI is disabled here, and for any
81             # direct dependents that might include gtest headers.
82             'GTEST_HAS_RTTI=0',
83           ],
84           'direct_dependent_settings': {
85             'defines': [
86               'GTEST_HAS_RTTI=0',
87             ],
88           },
89         }],
90         ['OS=="android"', {
91           'defines': [
92             'GTEST_HAS_CLONE=0',
93           ],
94           'direct_dependent_settings': {
95             'defines': [
96               'GTEST_HAS_CLONE=0',
97             ],
98           },
99         }],
100         ['OS=="android"', {
101           # We want gtest features that use tr1::tuple, but we currently
102           # don't support the variadic templates used by libstdc++'s
103           # implementation. gtest supports this scenario by providing its
104           # own implementation but we must opt in to it.
105           'defines': [
106             'GTEST_USE_OWN_TR1_TUPLE=1',
107             # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set.
108             # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0
109             # automatically on android, so it has to be set explicitly here.
110             'GTEST_HAS_TR1_TUPLE=1',
111           ],
112           'direct_dependent_settings': {
113             'defines': [
114               'GTEST_USE_OWN_TR1_TUPLE=1',
115               'GTEST_HAS_TR1_TUPLE=1',
116             ],
117           },
118         }],
119       ],
120       'direct_dependent_settings': {
121         'defines': [
122           'UNIT_TEST',
123         ],
124         'include_dirs': [
125           'gtest/include',  # So that gtest headers can find themselves.
126         ],
127         'target_conditions': [
128           ['_type=="executable"', {
129             'test': 1,
130             'conditions': [
131               ['OS=="mac"', {
132                 'run_as': {
133                   'action????': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}'],
134                 },
135               }],
136               ['OS=="win"', {
137                 'run_as': {
138                   'action????': ['$(TargetPath)', '--gtest_print_time'],
139                 },
140               }],
141             ],
142           }],
143         ],
144         'msvs_disabled_warnings': [4800],
145       },
146     },
147     {
148       'target_name': 'gtest_main',
149       'type': 'static_library',
150       'dependencies': [
151         'gtest',
152       ],
153       'sources': [
154         'gtest/src/gtest_main.cc',
155       ],
156     },
157     {
158       'target_name': 'gtest_prod',
159       'toolsets': ['host', 'target'],
160       'type': 'none',
161       'sources': [
162         'gtest/include/gtest/gtest_prod.h',
163       ],
164     },
165   ],
166 }