BUILD.gn 5.63 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config("gtest_config") {
  visibility = [ ":*" ]  # gmock also shares this config.

  defines = [
    # Chromium always links googletest statically, so no API qualifier is
    # necessary. The definition in gtest-port.h at the time of this writing
    # causes crashes in content_browsertests.
    "GTEST_API_=",

    # In order to allow regex matches in gtest to be shared between Windows
    # and other systems, we tell gtest to always use its internal engine.
    "GTEST_HAS_POSIX_RE=0",

18
    # Enables C++11 features.
Michael Achenbach's avatar
Michael Achenbach committed
19
    "GTEST_LANG_CXX11=1",
20 21 22

    # Prevents gtest from including both <tr1/tuple> and <tuple>.
    "GTEST_HAS_TR1_TUPLE=0",
23 24 25
  ]

  # Gtest headers need to be able to find themselves.
Michael Achenbach's avatar
Michael Achenbach committed
26 27 28 29 30 31
  include_dirs = [
    # TODO(crbug.com/829773): Remove this after transitioning off <tr1/tuple>.
    "custom",

    "src/googletest/include",
  ]
32 33 34 35 36 37 38 39 40

  if (is_win) {
    cflags = [ "/wd4800" ]  # Unused variable warning.
  }
}

config("gmock_config") {
  # Gmock headers need to be able to find themselves.
  include_dirs = [
Michael Achenbach's avatar
Michael Achenbach committed
41 42
    # TODO(crbug.com/829773): Add "custom" here after transitioning off
    #                         <tr1/tuple>.
43 44 45 46 47 48 49 50 51
    "src/googlemock/include",
  ]
}

# Do NOT depend on this directly. Use //testing/gtest instead.
# See README.chromium for details.
source_set("gtest") {
  testonly = true
  sources = [
Michael Achenbach's avatar
Michael Achenbach committed
52 53
    # TODO(crbug.com/829773): Remove this after transitioning off <tr1/tuple>.
    "custom/gmock/internal/custom/gmock-port.h",
54
    "src/googletest/include/gtest/gtest-death-test.h",
Sergiy Belozorov's avatar
Sergiy Belozorov committed
55
    "src/googletest/include/gtest/gtest-matchers.h",
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
    "src/googletest/include/gtest/gtest-message.h",
    "src/googletest/include/gtest/gtest-param-test.h",
    "src/googletest/include/gtest/gtest-printers.h",
    "src/googletest/include/gtest/gtest-spi.h",
    "src/googletest/include/gtest/gtest-test-part.h",
    "src/googletest/include/gtest/gtest-typed-test.h",
    "src/googletest/include/gtest/gtest.h",
    "src/googletest/include/gtest/gtest_pred_impl.h",
    "src/googletest/include/gtest/internal/gtest-death-test-internal.h",
    "src/googletest/include/gtest/internal/gtest-filepath.h",
    "src/googletest/include/gtest/internal/gtest-internal.h",
    "src/googletest/include/gtest/internal/gtest-linked_ptr.h",
    "src/googletest/include/gtest/internal/gtest-param-util-generated.h",
    "src/googletest/include/gtest/internal/gtest-param-util.h",
    "src/googletest/include/gtest/internal/gtest-port.h",
    "src/googletest/include/gtest/internal/gtest-string.h",
    "src/googletest/include/gtest/internal/gtest-tuple.h",
    "src/googletest/include/gtest/internal/gtest-type-util.h",

    #"src/googletest/src/gtest-all.cc",  # Not needed by our build.
    "src/googletest/src/gtest-death-test.cc",
    "src/googletest/src/gtest-filepath.cc",
    "src/googletest/src/gtest-internal-inl.h",
Sergiy Belozorov's avatar
Sergiy Belozorov committed
79
    "src/googletest/src/gtest-matchers.cc",
80 81 82 83 84 85 86 87 88 89 90 91 92 93
    "src/googletest/src/gtest-port.cc",
    "src/googletest/src/gtest-printers.cc",
    "src/googletest/src/gtest-test-part.cc",
    "src/googletest/src/gtest-typed-test.cc",
    "src/googletest/src/gtest.cc",
  ]

  # Some files include "src/gtest-internal-inl.h".
  include_dirs = [ "src/googletest" ]

  all_dependent_configs = [ ":gtest_config" ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]
Michael Achenbach's avatar
Michael Achenbach committed
94 95 96 97

  deps = []

  if (is_fuchsia) {
Sergiy Byelozyorov's avatar
Sergiy Byelozyorov committed
98 99 100 101
    deps += [
      "//third_party/fuchsia-sdk/sdk:fdio",
      "//third_party/fuchsia-sdk/sdk:zx",
    ]
Michael Achenbach's avatar
Michael Achenbach committed
102
  }
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
}

# Do NOT depend on this directly. Use //testing/gtest:gtest_main instead.
# See README.chromium for details.
source_set("gtest_main") {
  testonly = true
  sources = [
    "src/googletest/src/gtest_main.cc",
  ]
  deps = [
    ":gtest",
  ]
}

# Do NOT depend on this directly. Use //testing/gmock:gmock_main instead.
# See README.chromium for details.
source_set("gmock") {
  testonly = true
  sources = [
    "src/googlemock/include/gmock/gmock-actions.h",
    "src/googlemock/include/gmock/gmock-cardinalities.h",
Sergiy Belozorov's avatar
Sergiy Belozorov committed
124
    "src/googlemock/include/gmock/gmock-function-mocker.h",
125 126 127
    "src/googlemock/include/gmock/gmock-generated-actions.h",
    "src/googlemock/include/gmock/gmock-generated-function-mockers.h",
    "src/googlemock/include/gmock/gmock-generated-matchers.h",
Michael Achenbach's avatar
Michael Achenbach committed
128
    "src/googlemock/include/gmock/gmock-generated-nice-strict.h",
129
    "src/googlemock/include/gmock/gmock-matchers.h",
Sergiy Belozorov's avatar
Sergiy Belozorov committed
130 131 132
    "src/googlemock/include/gmock/gmock-more-actions.h",
    "src/googlemock/include/gmock/gmock-more-matchers.h",
    "src/googlemock/include/gmock/gmock-nice-strict.h",
133 134 135 136 137
    "src/googlemock/include/gmock/gmock-spec-builders.h",
    "src/googlemock/include/gmock/gmock.h",
    "src/googlemock/include/gmock/internal/gmock-generated-internal-utils.h",
    "src/googlemock/include/gmock/internal/gmock-internal-utils.h",
    "src/googlemock/include/gmock/internal/gmock-port.h",
Sergiy Belozorov's avatar
Sergiy Belozorov committed
138
    "src/googlemock/include/gmock/internal/gmock-pp.h",
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167

    # gmock helpers.
    "custom/gmock/internal/custom/gmock-port.h",

    #"src/googlemock/src/gmock-all.cc",  # Not needed by our build.
    "src/googlemock/src/gmock-cardinalities.cc",
    "src/googlemock/src/gmock-internal-utils.cc",
    "src/googlemock/src/gmock-matchers.cc",
    "src/googlemock/src/gmock-spec-builders.cc",
    "src/googlemock/src/gmock.cc",
  ]

  public_configs = [
    ":gmock_config",
    ":gtest_config",
  ]
}

# Do NOT depend on this directly. Use //testing/gmock:gmock_main instead.
# See README.chromium for details.
static_library("gmock_main") {
  testonly = true
  sources = [
    "src/googlemock/src/gmock_main.cc",
  ]
  deps = [
    ":gmock",
  ]
}