1# Copyright 2018 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
5import("//build_overrides/build.gni")
6
7if (build_with_chromium) {
8  source_set("gmock") {
9    testonly = true
10    public_configs = [
11      "//build/config/compiler:default_include_dirs",
12      "../../build:openscreen_include_dirs",
13    ]
14    public_deps = [
15      "//third_party/googletest:gmock",
16    ]
17  }
18
19  source_set("gtest") {
20    testonly = true
21    public_configs = [
22      "//build/config/compiler:default_include_dirs",
23      "../../build:openscreen_include_dirs",
24    ]
25    public_deps = [
26      "//third_party/googletest:gtest",
27    ]
28  }
29
30  source_set("gtest_main") {
31    testonly = true
32    public_configs = [
33      "//build/config/compiler:default_include_dirs",
34      "../../build:openscreen_include_dirs",
35    ]
36    public_deps = [
37      "//third_party/googletest:gtest_main",
38    ]
39  }
40} else {
41  config("gmock_config") {
42    visibility = [ ":*" ]
43
44    cflags_cc = []
45    if (is_clang) {
46      # NOTE(crbug.com/openscreen/15): GMock does not support the override
47      # keyword.
48      cflags_cc += [
49        "-Wno-exit-time-destructors",
50        "-Wno-inconsistent-missing-override",
51      ]
52    }
53
54    include_dirs = [ "src/googlemock/include" ]
55  }
56
57  config("gtest_config") {
58    visibility = [ ":*" ]
59
60    include_dirs = [ "src/googletest/include" ]
61
62    cflags_cc = []
63    if (is_clang) {
64      cflags_cc += [ "-Wno-exit-time-destructors" ]
65    }
66  }
67
68  source_set("gmock") {
69    testonly = true
70    sources = [
71      "src/googlemock/include/gmock.h",
72      "src/googlemock/src/gmock-all.cc",
73    ]
74
75    public_configs = [
76      ":gmock_config",
77      ":gtest_config",
78    ]
79
80    public_deps = [
81      ":gtest",
82    ]
83
84    include_dirs = [ "src/googlemock" ]
85  }
86
87  source_set("gtest") {
88    testonly = true
89    sources = [
90      "src/googletest/include/gtest.h",
91      "src/googletest/src/gtest-all.cc",
92    ]
93
94    public_configs = [ ":gtest_config" ]
95
96    include_dirs = [ "src/googletest" ]
97  }
98
99  source_set("gtest_main") {
100    testonly = true
101    sources = [
102      "src/googletest/src/gtest_main.cc",
103    ]
104    deps = [
105      ":gtest",
106    ]
107  }
108}
109