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.
5 config("gtest_config") {
8 "//testing/gmock:*", # gmock also shares this config.
12 # In order to allow regex matches in gtest to be shared between Windows
13 # and other systems, we tell gtest to always use it's internal engine.
14 "GTEST_HAS_POSIX_RE=0",
16 # Chrome doesn't support / require C++11, yet.
20 # Gtest headers need to be able to find themselves.
21 include_dirs = [ "include" ]
24 cflags = [ "/wd4800" ] # Unused variable warning.
29 # gtest isn't able to figure out when RTTI is disabled for gcc
30 # versions older than 4.3.2, and assumes it's enabled. Our Mac
31 # and Linux builds disable RTTI, and cannot guarantee that the
32 # compiler will be 4.3.2. or newer. The Mac, for example, uses
33 # 4.2.1 as that is the latest available on that platform. gtest
34 # must be instructed that RTTI is disabled here, and for any
35 # direct dependents that might include gtest headers.
42 # We want gtest features that use tr1::tuple, but we currently
43 # don't support the variadic templates used by libstdc++'s
44 # implementation. gtest supports this scenario by providing its
45 # own implementation but we must opt in to it.
46 "GTEST_USE_OWN_TR1_TUPLE=1",
48 # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set.
49 # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0
50 # automatically on android, so it has to be set explicitly here.
51 "GTEST_HAS_TR1_TUPLE=1",
56 config("gtest_direct_config") {
58 defines = [ "UNIT_TEST" ]
61 static_library("gtest") {
62 # TODO http://crbug.com/412064 enable this flag all the time.
63 testonly = !is_component_build
65 "include/gtest/gtest-death-test.h",
66 "include/gtest/gtest-message.h",
67 "include/gtest/gtest-param-test.h",
68 "include/gtest/gtest-printers.h",
69 "include/gtest/gtest-spi.h",
70 "include/gtest/gtest-test-part.h",
71 "include/gtest/gtest-typed-test.h",
72 "include/gtest/gtest.h",
73 "include/gtest/gtest_pred_impl.h",
74 "include/gtest/internal/gtest-death-test-internal.h",
75 "include/gtest/internal/gtest-filepath.h",
76 "include/gtest/internal/gtest-internal.h",
77 "include/gtest/internal/gtest-linked_ptr.h",
78 "include/gtest/internal/gtest-param-util-generated.h",
79 "include/gtest/internal/gtest-param-util.h",
80 "include/gtest/internal/gtest-port.h",
81 "include/gtest/internal/gtest-string.h",
82 "include/gtest/internal/gtest-tuple.h",
83 "include/gtest/internal/gtest-type-util.h",
85 #"gtest/src/gtest-all.cc", # Not needed by our build.
86 "../multiprocess_func_list.cc",
87 "../multiprocess_func_list.h",
89 "src/gtest-death-test.cc",
90 "src/gtest-filepath.cc",
91 "src/gtest-internal-inl.h",
93 "src/gtest-printers.cc",
94 "src/gtest-test-part.cc",
95 "src/gtest-typed-test.cc",
99 if (is_mac || is_ios) {
101 set_sources_assignment_filter([])
106 "../platform_test_mac.mm",
108 set_sources_assignment_filter(sources_assignment_filter)
113 "../coverage_util_ios.cc",
114 "../coverage_util_ios.h",
118 include_dirs = [ "." ]
120 all_dependent_configs = [ ":gtest_config" ]
121 public_configs = [ ":gtest_direct_config" ]
123 configs -= [ "//build/config/compiler:chromium_code" ]
124 configs += [ "//build/config/compiler:no_chromium_code" ]
126 config("gtest_warnings") {
127 if (is_win && is_clang) {
128 # The Mutex constructor initializer list in gtest-port.cc is incorrectly
130 # https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ.
131 cflags = [ "-Wno-reorder" ]
134 configs += [ ":gtest_warnings" ]
137 source_set("gtest_main") {
138 # TODO http://crbug.com/412064 enable this flag all the time.
139 testonly = !is_component_build