OLD | NEW |
| (Empty) |
1 # Copyright 2014 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. | |
4 | |
5 import("//build_overrides/gtest.gni") | |
6 | |
7 config("gtest_config") { | |
8 visibility = [ | |
9 ":*", | |
10 "//testing/gmock:*", # gmock also shares this config. | |
11 ] | |
12 | |
13 defines = [ | |
14 # In order to allow regex matches in gtest to be shared between Windows | |
15 # and other systems, we tell gtest to always use it's internal engine. | |
16 "GTEST_HAS_POSIX_RE=0", | |
17 | |
18 # Chrome doesn't support / require C++11, yet. | |
19 "GTEST_LANG_CXX11=0", | |
20 ] | |
21 | |
22 # Gtest headers need to be able to find themselves. | |
23 include_dirs = [ "../third_party/googletest/googletest/include" ] | |
24 | |
25 if (is_win) { | |
26 cflags = [ "/wd4800" ] # Unused variable warning. | |
27 } | |
28 | |
29 if (is_posix) { | |
30 defines += [ | |
31 # gtest isn't able to figure out when RTTI is disabled for gcc | |
32 # versions older than 4.3.2, and assumes it's enabled. Our Mac | |
33 # and Linux builds disable RTTI, and cannot guarantee that the | |
34 # compiler will be 4.3.2. or newer. The Mac, for example, uses | |
35 # 4.2.1 as that is the latest available on that platform. gtest | |
36 # must be instructed that RTTI is disabled here, and for any | |
37 # direct dependents that might include gtest headers. | |
38 "GTEST_HAS_RTTI=0", | |
39 ] | |
40 } | |
41 | |
42 if (is_android) { | |
43 defines += [ | |
44 # We want gtest features that use tr1::tuple, but we currently | |
45 # don't support the variadic templates used by libstdc++'s | |
46 # implementation. gtest supports this scenario by providing its | |
47 # own implementation but we must opt in to it. | |
48 "GTEST_USE_OWN_TR1_TUPLE=1", | |
49 | |
50 # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set. | |
51 # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0 | |
52 # automatically on android, so it has to be set explicitly here. | |
53 "GTEST_HAS_TR1_TUPLE=1", | |
54 ] | |
55 } | |
56 } | |
57 | |
58 config("gtest_direct_config") { | |
59 visibility = [ ":*" ] | |
60 defines = [ "UNIT_TEST" ] | |
61 } | |
62 | |
63 static_library("gtest") { | |
64 testonly = true | |
65 sources = [ | |
66 "../third_party/googletest/googletest/include/gtest/gtest-death-test.h", | |
67 "../third_party/googletest/googletest/include/gtest/gtest-message.h", | |
68 "../third_party/googletest/googletest/include/gtest/gtest-param-test.h", | |
69 "../third_party/googletest/googletest/include/gtest/gtest-printers.h", | |
70 "../third_party/googletest/googletest/include/gtest/gtest-spi.h", | |
71 "../third_party/googletest/googletest/include/gtest/gtest-test-part.h", | |
72 "../third_party/googletest/googletest/include/gtest/gtest-typed-test.h", | |
73 "../third_party/googletest/googletest/include/gtest/gtest.h", | |
74 "../third_party/googletest/googletest/include/gtest/gtest_pred_impl.h", | |
75 "../third_party/googletest/googletest/include/gtest/internal/gtest-death-tes
t-internal.h", | |
76 "../third_party/googletest/googletest/include/gtest/internal/gtest-filepath.
h", | |
77 "../third_party/googletest/googletest/include/gtest/internal/gtest-internal.
h", | |
78 "../third_party/googletest/googletest/include/gtest/internal/gtest-linked_pt
r.h", | |
79 "../third_party/googletest/googletest/include/gtest/internal/gtest-param-uti
l-generated.h", | |
80 "../third_party/googletest/googletest/include/gtest/internal/gtest-param-uti
l.h", | |
81 "../third_party/googletest/googletest/include/gtest/internal/gtest-port.h", | |
82 "../third_party/googletest/googletest/include/gtest/internal/gtest-string.h"
, | |
83 "../third_party/googletest/googletest/include/gtest/internal/gtest-tuple.h", | |
84 "../third_party/googletest/googletest/include/gtest/internal/gtest-type-util
.h", | |
85 "include/gtest/gtest-death-test.h", | |
86 "include/gtest/gtest-message.h", | |
87 "include/gtest/gtest-param-test.h", | |
88 "include/gtest/gtest-printers.h", | |
89 "include/gtest/gtest-spi.h", | |
90 "include/gtest/gtest-test-part.h", | |
91 "include/gtest/gtest-typed-test.h", | |
92 "include/gtest/gtest.h", | |
93 "include/gtest/gtest_pred_impl.h", | |
94 "include/gtest/internal/gtest-death-test-internal.h", | |
95 "include/gtest/internal/gtest-filepath.h", | |
96 "include/gtest/internal/gtest-internal.h", | |
97 "include/gtest/internal/gtest-linked_ptr.h", | |
98 "include/gtest/internal/gtest-param-util-generated.h", | |
99 "include/gtest/internal/gtest-param-util.h", | |
100 "include/gtest/internal/gtest-port.h", | |
101 "include/gtest/internal/gtest-string.h", | |
102 "include/gtest/internal/gtest-tuple.h", | |
103 "include/gtest/internal/gtest-type-util.h", | |
104 | |
105 #"gtest/src/gtest-all.cc", # Not needed by our build. | |
106 "../third_party/googletest/googletest/src/gtest-death-test.cc", | |
107 "../third_party/googletest/googletest/src/gtest-filepath.cc", | |
108 "../third_party/googletest/googletest/src/gtest-internal-inl.h", | |
109 "../third_party/googletest/googletest/src/gtest-port.cc", | |
110 "../third_party/googletest/googletest/src/gtest-printers.cc", | |
111 "../third_party/googletest/googletest/src/gtest-test-part.cc", | |
112 "../third_party/googletest/googletest/src/gtest-typed-test.cc", | |
113 "../third_party/googletest/googletest/src/gtest.cc", | |
114 ] | |
115 | |
116 if (gtest_include_multiprocess) { | |
117 sources += [ | |
118 "../multiprocess_func_list.cc", | |
119 "../multiprocess_func_list.h", | |
120 ] | |
121 } | |
122 | |
123 if (gtest_include_platform_test) { | |
124 sources += [ "../platform_test.h" ] | |
125 } | |
126 | |
127 if ((is_mac || is_ios) && gtest_include_objc_support) { | |
128 if (is_ios) { | |
129 set_sources_assignment_filter([]) | |
130 } | |
131 sources += [ | |
132 "../gtest_mac.h", | |
133 "../gtest_mac.mm", | |
134 ] | |
135 if (gtest_include_platform_test) { | |
136 sources += [ "../platform_test_mac.mm" ] | |
137 } | |
138 set_sources_assignment_filter(sources_assignment_filter) | |
139 } | |
140 | |
141 if (is_ios && gtest_include_ios_coverage) { | |
142 sources += [ | |
143 "../coverage_util_ios.cc", | |
144 "../coverage_util_ios.h", | |
145 ] | |
146 } | |
147 | |
148 include_dirs = [ "../third_party/googletest/googletest" ] | |
149 | |
150 all_dependent_configs = [ ":gtest_config" ] | |
151 public_configs = [ ":gtest_direct_config" ] | |
152 | |
153 configs -= [ "//build/config/compiler:chromium_code" ] | |
154 configs += [ "//build/config/compiler:no_chromium_code" ] | |
155 } | |
156 | |
157 source_set("gtest_main") { | |
158 testonly = true | |
159 sources = [ | |
160 "../third_party/googletest/googletest/src/gtest_main.cc", | |
161 ] | |
162 deps = [ | |
163 ":gtest", | |
164 ] | |
165 } | |
OLD | NEW |