Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / tools / gn / secondary / testing / gtest / BUILD.gn
1 # Copyright (c) 2013 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     "UNIT_TEST",
13
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
19   # Gtest headers need to be able to find themselves.
20   include_dirs = [ "include" ]
21
22   if (is_win) {
23     cflags = [ "/wd4800" ]  # Unused variable warning.
24   }
25
26   if (is_posix) {
27     defines += [
28       # gtest isn't able to figure out when RTTI is disabled for gcc
29       # versions older than 4.3.2, and assumes it's enabled.  Our Mac
30       # and Linux builds disable RTTI, and cannot guarantee that the
31       # compiler will be 4.3.2. or newer.  The Mac, for example, uses
32       # 4.2.1 as that is the latest available on that platform.  gtest
33       # must be instructed that RTTI is disabled here, and for any
34       # direct dependents that might include gtest headers.
35       "GTEST_HAS_RTTI=0",
36     ]
37   }
38
39   if (is_android) {
40     defines += [
41       # We want gtest features that use tr1::tuple, but we currently
42       # don't support the variadic templates used by libstdc++'s
43       # implementation. gtest supports this scenario by providing its
44       # own implementation but we must opt in to it.
45       "GTEST_USE_OWN_TR1_TUPLE=1",
46
47       # GTEST_USE_OWN_TR1_TUPLE only works if GTEST_HAS_TR1_TUPLE is set.
48       # gtest r625 made it so that GTEST_HAS_TR1_TUPLE is set to 0
49       # automatically on android, so it has to be set explicitly here.
50       "GTEST_HAS_TR1_TUPLE=1",
51     ]
52   }
53 }
54
55 static_library("gtest") {
56   sources = [
57     "include/gtest/gtest-death-test.h",
58     "include/gtest/gtest-message.h",
59     "include/gtest/gtest-param-test.h",
60     "include/gtest/gtest-printers.h",
61     "include/gtest/gtest-spi.h",
62     "include/gtest/gtest-test-part.h",
63     "include/gtest/gtest-typed-test.h",
64     "include/gtest/gtest.h",
65     "include/gtest/gtest_pred_impl.h",
66     "include/gtest/internal/gtest-death-test-internal.h",
67     "include/gtest/internal/gtest-filepath.h",
68     "include/gtest/internal/gtest-internal.h",
69     "include/gtest/internal/gtest-linked_ptr.h",
70     "include/gtest/internal/gtest-param-util-generated.h",
71     "include/gtest/internal/gtest-param-util.h",
72     "include/gtest/internal/gtest-port.h",
73     "include/gtest/internal/gtest-string.h",
74     "include/gtest/internal/gtest-tuple.h",
75     "include/gtest/internal/gtest-type-util.h",
76     #"gtest/src/gtest-all.cc",  # Not needed by our build.
77     "src/gtest-death-test.cc",
78     "src/gtest-filepath.cc",
79     "src/gtest-internal-inl.h",
80     "src/gtest-port.cc",
81     "src/gtest-printers.cc",
82     "src/gtest-test-part.cc",
83     "src/gtest-typed-test.cc",
84     "src/gtest.cc",
85     "../multiprocess_func_list.cc",
86     "../multiprocess_func_list.h",
87     "../platform_test.h",
88   ]
89
90   if (is_mac) {
91     sources += [
92       "../gtest_mac.h",
93       "../gtest_mac.mm",
94       "../platform_test_mac.mm",
95     ]
96   }
97
98   include_dirs = [ "." ]
99
100   all_dependent_configs = [ ":gtest_config" ]
101
102   configs -= [ "//build/config/compiler:chromium_code" ]
103   configs += [ "//build/config/compiler:no_chromium_code" ]
104 }