blob: 93e54a7fd2a2e1b5415a39fdb6bbcbdb72051ce4 [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
}
config("gtest_private_config") {
visibility = [ ":*" ]
include_dirs = [ "googletest" ]
}
config("gtest_config") {
include_dirs = [ "googletest/include" ]
}
static_library("gtest") {
testonly = true
public = [
"googletest/include/gtest/gtest-spi.h",
"googletest/include/gtest/gtest.h",
]
# Only add the "*-all.cc" files (and no headers) to improve maintainability
# from upstream refactoring. The "*-all.cc" files include the respective
# source files.
sources = [ "googletest/src/gtest-all.cc" ]
public_configs = [ ":gtest_config" ]
configs += [ ":gtest_private_config" ]
if (is_fuchsia) {
if (using_fuchsia_sdk) {
deps = [
"$fuchsia_sdk_root/pkg:fdio",
"$fuchsia_sdk_root/pkg:zx",
]
} else {
deps = [
"//zircon/public/lib/fdio",
"//zircon/public/lib/zx",
]
}
}
}
# Library that defines the FRIEND_TEST macro.
source_set("gtest_prod") {
testonly = false
public = [ "googletest/include/gtest/gtest_prod.h" ]
public_configs = [ ":gtest_config" ]
}
static_library("gtest_main") {
testonly = true
sources = [ "googletest/src/gtest_main.cc" ]
public_deps = [ ":gtest" ]
}
executable("gtest_all_test") {
testonly = true
sources = [
"googletest/test/gtest-death-test_test.cc",
"googletest/test/gtest-filepath_test.cc",
"googletest/test/gtest-linked_ptr_test.cc",
"googletest/test/gtest-message_test.cc",
"googletest/test/gtest-options_test.cc",
"googletest/test/gtest-port_test.cc",
"googletest/test/gtest-printers_test.cc",
"googletest/test/gtest-test-part_test.cc",
"googletest/test/gtest-typed-test2_test.cc",
"googletest/test/gtest-typed-test_test.cc",
"googletest/test/gtest-typed-test_test.h",
"googletest/test/gtest_main_unittest.cc",
"googletest/test/gtest_pred_impl_unittest.cc",
"googletest/test/gtest_prod_test.cc",
"googletest/test/gtest_unittest.cc",
"googletest/test/production.cc",
"googletest/test/production.h",
]
configs += [ ":gtest_private_config" ]
deps = [
":gtest",
":gtest_main",
]
}
executable("gtest_environment_test") {
testonly = true
sources = [ "googletest/test/gtest_environment_test.cc" ]
configs += [ ":gtest_private_config" ]
deps = [ ":gtest" ]
}
executable("gtest_listener_test") {
testonly = true
sources = [ "googletest/test/gtest-listener_test.cc" ]
deps = [ ":gtest" ]
}
executable("gtest_no_test") {
testonly = true
sources = [ "googletest/test/gtest_no_test_unittest.cc" ]
deps = [ ":gtest" ]
}
executable("gtest_param_test") {
testonly = true
sources = [
"googletest/test/gtest-param-test2_test.cc",
"googletest/test/gtest-param-test_test.cc",
"googletest/test/gtest-param-test_test.h",
]
configs += [ ":gtest_private_config" ]
deps = [ ":gtest" ]
}
executable("gtest_premature_exit_test") {
testonly = true
sources = [ "googletest/test/gtest_premature_exit_test.cc" ]
deps = [ ":gtest" ]
}
executable("gtest_repeat_test") {
testonly = true
sources = [ "googletest/test/gtest_repeat_test.cc" ]
configs += [ ":gtest_private_config" ]
deps = [ ":gtest" ]
}
executable("gtest_sole_header_test") {
testonly = true
sources = [ "googletest/test/gtest_sole_header_test.cc" ]
deps = [
":gtest",
":gtest_main",
]
}
executable("gtest_stress_test") {
testonly = true
sources = [ "googletest/test/gtest_stress_test.cc" ]
configs += [ ":gtest_private_config" ]
deps = [ ":gtest" ]
}
executable("gtest_unittest_api_test") {
testonly = true
sources = [ "googletest/test/gtest-unittest-api_test.cc" ]
deps = [ ":gtest" ]
}
group("gtest_all_tests") {
testonly = true
deps = [
":gtest_all_test",
":gtest_environment_test",
":gtest_listener_test",
":gtest_no_test",
":gtest_param_test",
":gtest_premature_exit_test",
":gtest_repeat_test",
":gtest_sole_header_test",
":gtest_stress_test",
":gtest_unittest_api_test",
]
}
config("gmock_private_config") {
visibility = [ ":*" ]
include_dirs = [ "googlemock" ]
}
config("gmock_config") {
include_dirs = [ "googlemock/include" ]
cflags_cc = [
# The MOCK_METHODn() macros do not specify "override", which triggers this
# warning in users: "error: 'Method' overrides a member function but is not
# marked 'override' [-Werror,-Winconsistent-missing-override]". Suppress
# these warnings until https://github.com/google/googletest/issues/533 is
# fixed.
"-Wno-inconsistent-missing-override",
]
}
static_library("gmock") {
testonly = true
public = [ "googlemock/include/gmock/gmock.h" ]
sources = [ "googlemock/src/gmock-all.cc" ]
public_configs = [ ":gmock_config" ]
configs += [ ":gmock_private_config" ]
deps = [ ":gtest" ]
}
static_library("gmock_main") {
testonly = true
sources = [ "googlemock/src/gmock_main.cc" ]
public_deps = [
":gmock",
":gtest",
]
}
executable("gmock_all_test") {
testonly = true
sources = [
"googlemock/test/gmock-actions_test.cc",
"googlemock/test/gmock-cardinalities_test.cc",
"googlemock/test/gmock-generated-actions_test.cc",
"googlemock/test/gmock-generated-function-mockers_test.cc",
"googlemock/test/gmock-generated-internal-utils_test.cc",
"googlemock/test/gmock-generated-matchers_test.cc",
"googlemock/test/gmock-internal-utils_test.cc",
"googlemock/test/gmock-matchers_test.cc",
"googlemock/test/gmock-more-actions_test.cc",
"googlemock/test/gmock-nice-strict_test.cc",
"googlemock/test/gmock-port_test.cc",
"googlemock/test/gmock-spec-builders_test.cc",
"googlemock/test/gmock_test.cc",
]
configs += [
":gmock_private_config",
":gtest_private_config",
]
deps = [
":gmock",
":gmock_main",
":gtest",
]
}
executable("gmock_link_test") {
testonly = true
sources = [
"googlemock/test/gmock_link2_test.cc",
"googlemock/test/gmock_link_test.cc",
"googlemock/test/gmock_link_test.h",
]
configs += [ ":gmock_private_config" ]
deps = [
":gmock",
":gmock_main",
":gtest",
]
}
executable("gmock_stress_test") {
testonly = true
sources = [ "googlemock/test/gmock_stress_test.cc" ]
configs += [ ":gmock_private_config" ]
deps = [
":gmock",
":gtest",
]
}
group("gmock_all_tests") {
testonly = true
deps = [
":gmock_all_test",
":gmock_link_test",
":gmock_stress_test",
]
}