mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-10-18 11:10:05 +00:00
BUILD.gn: Only build tests in Chromium. (#2392)
The prior GoogleTest integration was incomplete and produced errors when building with 'gn check' enabled. Fix this by scoping the test integration to Chromium. Fixes Issue #2382
This commit is contained in:
parent
6d20f62570
commit
4b42cd19d3
63
BUILD.gn
63
BUILD.gn
@ -657,47 +657,10 @@ group("SPIRV-Tools") {
|
||||
]
|
||||
}
|
||||
|
||||
if (!build_with_chromium) {
|
||||
googletest_dir = spirv_tools_googletest_dir
|
||||
|
||||
config("gtest_config") {
|
||||
include_dirs = [
|
||||
"${googletest_dir}/googletest",
|
||||
"${googletest_dir}/googletest/include",
|
||||
]
|
||||
}
|
||||
|
||||
static_library("gtest") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"${googletest_dir}/googletest/src/gtest-all.cc",
|
||||
]
|
||||
public_configs = [ ":gtest_config" ]
|
||||
}
|
||||
|
||||
config("gmock_config") {
|
||||
include_dirs = [
|
||||
"${googletest_dir}/googlemock",
|
||||
"${googletest_dir}/googlemock/include",
|
||||
"${googletest_dir}/googletest/include",
|
||||
]
|
||||
if (is_clang) {
|
||||
# TODO: Can remove this if/when the issue is fixed.
|
||||
# https://github.com/google/googletest/issues/533
|
||||
cflags = [ "-Wno-inconsistent-missing-override" ]
|
||||
}
|
||||
}
|
||||
|
||||
static_library("gmock") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"${googletest_dir}/googlemock/src/gmock-all.cc",
|
||||
]
|
||||
public_configs = [ ":gmock_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
test("spvtools_test") {
|
||||
# The tests are scoped to Chromium to avoid needing to write gtest integration.
|
||||
# See Chromium's third_party/googletest/BUILD.gn for a complete integration.
|
||||
if (build_with_chromium) {
|
||||
test("spvtools_test") {
|
||||
sources = [
|
||||
"test/assembly_context_test.cpp",
|
||||
"test/assembly_format_test.cpp",
|
||||
@ -759,30 +722,20 @@ test("spvtools_test") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//testing/gtest:gtest_main",
|
||||
":spvtools",
|
||||
":spvtools_language_header_unified1",
|
||||
":spvtools_val",
|
||||
]
|
||||
|
||||
if (build_with_chromium) {
|
||||
deps += [
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//testing/gtest:gtest_main",
|
||||
]
|
||||
} else {
|
||||
deps += [
|
||||
":gmock",
|
||||
":gtest",
|
||||
]
|
||||
sources += [ "${googletest_dir}/googletest/src/gtest_main.cc" ]
|
||||
}
|
||||
|
||||
if (is_clang) {
|
||||
cflags_cc = [ "-Wno-self-assign" ]
|
||||
}
|
||||
|
||||
configs += [ ":spvtools_internal_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (spirv_tools_standalone) {
|
||||
|
Loading…
Reference in New Issue
Block a user