Make the unittests compile in the GN build.

This changes angle_unittests.gypi to use a variable per list of files so
that we can grab the list of files in conditions in BUILD.gn

BUG=angleproject:929

Change-Id: I7fc73fd84d8efc1ea545fe672b1dba1c429b317f
Reviewed-on: https://chromium-review.googlesource.com/296443
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2015-09-01 10:32:30 -04:00
Родитель 94d099d0fe
Коммит d4bcfa2cd6
4 изменённых файлов: 73 добавлений и 22 удалений

Просмотреть файл

@ -1,9 +1,10 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Copyright 2014-2015 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.
# import the use_x11 variable
import("//build/config/ui.gni")
import("//third_party/angle/build/angle_common.gni")
angle_git_is_present = exec_script("src/commit_id.py",
[
@ -42,30 +43,11 @@ config("internal_config") {
]
}
angle_enable_d3d9 = false
angle_enable_d3d11 = false
angle_enable_gl = false
if (is_win) {
angle_enable_d3d9 = true
angle_enable_d3d11 = true
angle_enable_gl = true
import("//build/config/win/visual_studio_version.gni")
copy("copy_compiler_dll") {
sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
outputs = [ "$root_build_dir/d3dcompiler_47.dll" ]
}
} # is_win
if (is_linux) {
angle_enable_gl = true
}
angle_enable_hlsl = false
if (angle_enable_d3d9 || angle_enable_d3d11) {
angle_enable_hlsl = true
}
component("translator") {

25
build/angle_common.gni Normal file
Просмотреть файл

@ -0,0 +1,25 @@
# Copyright 2015 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.
angle_enable_d3d9 = false
angle_enable_d3d11 = false
angle_enable_gl = false
if (is_win) {
angle_enable_d3d9 = true
angle_enable_d3d11 = true
angle_enable_gl = true
import("//build/config/win/visual_studio_version.gni")
} # is_win
if (is_linux) {
angle_enable_gl = true
}
angle_enable_hlsl = false
if (angle_enable_d3d9 || angle_enable_d3d11) {
angle_enable_hlsl = true
}

39
src/tests/BUILD.gn Normal file
Просмотреть файл

@ -0,0 +1,39 @@
# Copyright 2015 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.
import("//testing/test.gni")
import("//third_party/angle/build/angle_common.gni")
unittests_gypi = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("angle_unittests.gypi"), "--replace=<(angle_path)=." ],
"scope",
[ "angle_unittests.gypi" ])
test("angle_unittests") {
include_dirs = [
"testing/gtest/include",
"../../src",
]
sources = rebase_path(unittests_gypi.angle_unittests_sources, ".", "../..")
if (angle_enable_hlsl) {
sources += rebase_path(unittests_gypi.angle_unittests_hlsl_sources, ".", "../..")
}
sources += [
"//gpu/angle_unittest_main.cc",
]
deps = [
"//base",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/angle:libANGLE",
"//third_party/angle:preprocessor",
"//third_party/angle:translator_static",
]
}

Просмотреть файл

@ -12,7 +12,6 @@
{
'variables':
{
# This file list will be shared with the GN build.
'angle_unittests_sources':
[
'<(angle_path)/src/common/BitSetIterator_unittest.cpp',
@ -76,7 +75,13 @@
'<(angle_path)/src/tests/test_utils/compiler_test.cpp',
'<(angle_path)/src/tests/test_utils/compiler_test.h',
],
'angle_unittests_hlsl_sources':
[
'<(angle_path)/src/tests/compiler_tests/UnrollFlatten_test.cpp',
],
},
# Everything below this but the WinRT configuration is duplicated in the GN build.
# If you change anything also change angle/BUILD.gn
'dependencies':
[
'<(angle_path)/src/angle.gyp:libANGLE',
@ -122,7 +127,7 @@
# TODO(cwallez): make this angle_enable_hlsl instead (requires gyp file refactoring)
'sources':
[
'<(angle_path)/src/tests/compiler_tests/UnrollFlatten_test.cpp',
'<@(angle_unittests_hlsl_sources)',
],
}],
],