# Copyright (c) 2013 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.

# TODO(brettw) move to testing/gtest/BUILD.gn
config("gtest_config") {
  defines = [ "UNIT_TEST" ]
  include_dirs = [ "gtest/include" ]  # Gtest headers need to be able to find themselves.
  if (is_win) {
    cflags = [ "/wd4800" ]  # Unused variable warning.
  }
}

# TODO(brettw) move to testing/gtest/BUILD.gn
static_library("gtest") {
  external = true
  gyp_file = "gtest.gyp"
  sources = [
    "gtest/include/gtest/gtest-death-test.h",
    "gtest/include/gtest/gtest-message.h",
    "gtest/include/gtest/gtest-param-test.h",
    "gtest/include/gtest/gtest-printers.h",
    "gtest/include/gtest/gtest-spi.h",
    "gtest/include/gtest/gtest-test-part.h",
    "gtest/include/gtest/gtest-typed-test.h",
    "gtest/include/gtest/gtest.h",
    "gtest/include/gtest/gtest_pred_impl.h",
    "gtest/include/gtest/internal/gtest-death-test-internal.h",
    "gtest/include/gtest/internal/gtest-filepath.h",
    "gtest/include/gtest/internal/gtest-internal.h",
    "gtest/include/gtest/internal/gtest-linked_ptr.h",
    "gtest/include/gtest/internal/gtest-param-util-generated.h",
    "gtest/include/gtest/internal/gtest-param-util.h",
    "gtest/include/gtest/internal/gtest-port.h",
    "gtest/include/gtest/internal/gtest-string.h",
    "gtest/include/gtest/internal/gtest-tuple.h",
    "gtest/include/gtest/internal/gtest-type-util.h",
    #"gtest/src/gtest-all.cc",  # Not needed by our build.
    "gtest/src/gtest-death-test.cc",
    "gtest/src/gtest-filepath.cc",
    "gtest/src/gtest-internal-inl.h",
    "gtest/src/gtest-port.cc",
    "gtest/src/gtest-printers.cc",
    "gtest/src/gtest-test-part.cc",
    "gtest/src/gtest-typed-test.cc",
    "gtest/src/gtest.cc",
    "multiprocess_func_list.cc",
    "multiprocess_func_list.h",
    "platform_test.h",
  ]

    if (is_mac) {
      sources += [
        "gtest_mac.h",
        "gtest_mac.mm",
        "platform_test_mac.mm",
      ]
    }

  include_dirs = [ "gtest" ]
  direct_dependent_configs = [ ":gtest_config" ]

  configs -= "//build/config/compiler:chromium_code"
  configs += "//build/config/compiler:no_chromium_code"
}

# TODO(brettw) move to testing/gmock/BUILD.gn
config("gmock_config") {
  # Gmock headers need to be able to find themselves.
  include_dirs = [ "gmock/include" ]
}

# TODO(brettw) move to testing/gmock/BUILD.gn
static_library("gmock") {
  gyp_file = "gmock.gyp"
  external = true
  sources = [
    # Sources based on files in r173 of gmock.
    "gmock/include/gmock/gmock-actions.h",
    "gmock/include/gmock/gmock-cardinalities.h",
    "gmock/include/gmock/gmock-generated-actions.h",
    "gmock/include/gmock/gmock-generated-function-mockers.h",
    "gmock/include/gmock/gmock-generated-matchers.h",
    "gmock/include/gmock/gmock-generated-nice-strict.h",
    "gmock/include/gmock/gmock-matchers.h",
    "gmock/include/gmock/gmock-spec-builders.h",
    "gmock/include/gmock/gmock.h",
    "gmock/include/gmock/internal/gmock-generated-internal-utils.h",
    "gmock/include/gmock/internal/gmock-internal-utils.h",
    "gmock/include/gmock/internal/gmock-port.h",
    #"gmock/src/gmock-all.cc",  # Not needed by our build.
    "gmock/src/gmock-cardinalities.cc",
    "gmock/src/gmock-internal-utils.cc",
    "gmock/src/gmock-matchers.cc",
    "gmock/src/gmock-spec-builders.cc",
    "gmock/src/gmock.cc",
    "gmock_mutant.h",  # gMock helpers
  ]

  # This project includes some stuff form gtest's guts.
  include_dirs = [ "gtest/include" ]

  direct_dependent_configs = [
    ":gmock_config",
    "//testing:gtest_config",
  ]
}

# TODO(brettw) move to testing/gmock/BUILD.gn
static_library("gmock_main") {
  external = true
  gyp_file = "gmock.gyp"
  sources = [ "src/gmock_main.cc" ]
  deps = [ ":gmock" ]
}