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 config("gtest_config") { |
| 6 visibility = [ |
| 7 ":*", |
| 8 "//testing/gmock:*", # gmock also shares this config. |
| 9 ] |
| 10 |
| 11 defines = [ |
| 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", |
| 15 |
| 16 # Chrome doesn't support / require C++11, yet. |
| 17 "GTEST_LANG_CXX11=0", |
| 18 ] |
| 19 |
| 20 # Gtest headers need to be able to find themselves. |
| 21 include_dirs = [ "include" ] |
| 22 |
| 23 if (is_win) { |
| 24 cflags = [ "/wd4800" ] # Unused variable warning. |
| 25 } |
| 26 |
| 27 if (is_posix) { |
| 28 defines += [ |
| 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. |
| 36 "GTEST_HAS_RTTI=0", |
| 37 ] |
| 38 } |
| 39 |
| 40 if (is_android) { |
| 41 defines += [ |
| 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", |
| 47 |
| 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", |
| 52 ] |
| 53 } |
| 54 } |
| 55 |
| 56 config("gtest_direct_config") { |
| 57 visibility = [ ":*" ] |
| 58 defines = [ "UNIT_TEST" ] |
| 59 } |
| 60 |
| 61 static_library("gtest") { |
| 62 # TODO http://crbug.com/412064 enable this flag all the time. |
| 63 testonly = !is_component_build |
| 64 sources = [ |
| 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", |
| 84 |
| 85 #"gtest/src/gtest-all.cc", # Not needed by our build. |
| 86 "../multiprocess_func_list.cc", |
| 87 "../multiprocess_func_list.h", |
| 88 "../platform_test.h", |
| 89 "src/gtest-death-test.cc", |
| 90 "src/gtest-filepath.cc", |
| 91 "src/gtest-internal-inl.h", |
| 92 "src/gtest-port.cc", |
| 93 "src/gtest-printers.cc", |
| 94 "src/gtest-test-part.cc", |
| 95 "src/gtest-typed-test.cc", |
| 96 "src/gtest.cc", |
| 97 ] |
| 98 |
| 99 if (is_mac) { |
| 100 sources += [ |
| 101 "../gtest_mac.h", |
| 102 "../gtest_mac.mm", |
| 103 "../platform_test_mac.mm", |
| 104 ] |
| 105 } |
| 106 |
| 107 include_dirs = [ "." ] |
| 108 |
| 109 all_dependent_configs = [ ":gtest_config" ] |
| 110 public_configs = [ ":gtest_direct_config" ] |
| 111 |
| 112 configs -= [ "//build/config/compiler:chromium_code" ] |
| 113 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 114 |
| 115 config("gtest_warnings") { |
| 116 if (is_win && is_clang) { |
| 117 # The Mutex constructor initializer list in gtest-port.cc is incorrectly |
| 118 # ordered. See |
| 119 # https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6
J6sJ. |
| 120 cflags = [ "-Wno-reorder" ] |
| 121 } |
| 122 } |
| 123 configs += [ ":gtest_warnings" ] |
| 124 } |
| 125 |
| 126 source_set("gtest_main") { |
| 127 # TODO http://crbug.com/412064 enable this flag all the time. |
| 128 testonly = !is_component_build |
| 129 sources = [ |
| 130 "src/gtest_main.cc", |
| 131 ] |
| 132 deps = [ |
| 133 ":gtest", |
| 134 ] |
| 135 } |
OLD | NEW |