Commit 7098cff5 by Jamie Madill Committed by Commit Bot

Make BUILD.gn targets into templates.

This allows us to "globally" add and remove certain configs as long as we use the new templates. This simplifies the logic of adding configs for stuff like extra warnings and default include dirs. As well it simplifies removing certain common unwanted configs. Generally simplifies the logic in BUILD.gn. Will allow for easily suppressing the clang-plugins config instead of using a global setting in .gn. Then we can enable the additional warnings config-by-config. Also fixes some warnings that turned up after we enabled the extra warnings config in our tests. Also moves the dEQP tests main to be consistent with the other test main files. Bug: angleproject:3069 Change-Id: I5a8166cd0f5a7926822c171fcaf473fc86b3ffc1 Reviewed-on: https://chromium-review.googlesource.com/c/1409871 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent c8be560b
...@@ -152,22 +152,14 @@ if (is_win && target_cpu != "arm64") { ...@@ -152,22 +152,14 @@ if (is_win && target_cpu != "arm64") {
} }
} }
angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ]
# Holds the shared includes so we only need to list them once. # Holds the shared includes so we only need to list them once.
source_set("includes") { angle_source_set("includes") {
sources = libangle_includes sources = libangle_includes
} }
static_library("preprocessor") { angle_static_library("preprocessor") {
sources = angle_preprocessor_sources sources = angle_preprocessor_sources
configs -= angle_undefine_configs
configs += [
":extra_warnings",
":internal_config",
]
public_deps = [ public_deps = [
":angle_common", ":angle_common",
] ]
...@@ -196,25 +188,16 @@ config("angle_common_config") { ...@@ -196,25 +188,16 @@ config("angle_common_config") {
} }
} }
source_set("angle_system_utils") { angle_source_set("angle_system_utils") {
sources = angle_system_utils_sources sources = angle_system_utils_sources
configs -= angle_undefine_configs
configs += [
":extra_warnings",
":internal_config",
]
} }
static_library("angle_common") { angle_static_library("angle_common") {
sources = libangle_common_sources sources = libangle_common_sources
configs -= angle_undefine_configs
configs += [ configs += [
":angle_common_config", ":angle_common_config",
":debug_annotations_config", ":debug_annotations_config",
":extra_warnings",
":internal_config",
] ]
public_deps = [ public_deps = [
...@@ -222,7 +205,7 @@ static_library("angle_common") { ...@@ -222,7 +205,7 @@ static_library("angle_common") {
":angle_version", ":angle_version",
":includes", ":includes",
] ]
public_configs = [ ":angle_common_config" ] public_configs += [ ":angle_common_config" ]
all_dependent_configs = [ ":angle_release_asserts_config" ] all_dependent_configs = [ ":angle_release_asserts_config" ]
} }
...@@ -233,17 +216,9 @@ config("angle_image_util_config") { ...@@ -233,17 +216,9 @@ config("angle_image_util_config") {
] ]
} }
static_library("angle_image_util") { angle_static_library("angle_image_util") {
sources = libangle_image_util_sources sources = libangle_image_util_sources
public_configs += [ ":angle_image_util_config" ]
configs -= angle_undefine_configs
configs += [
":internal_config",
":extra_warnings",
]
public_configs = [ ":angle_image_util_config" ]
public_deps = [ public_deps = [
":angle_common", ":angle_common",
] ]
...@@ -270,19 +245,11 @@ config("angle_gpu_info_util_config") { ...@@ -270,19 +245,11 @@ config("angle_gpu_info_util_config") {
] ]
} }
static_library("angle_gpu_info_util") { angle_static_library("angle_gpu_info_util") {
configs -= angle_undefine_configs public_configs += [ ":angle_gpu_info_util_config" ]
configs += [
":internal_config",
":extra_warnings",
]
public_configs = [ ":angle_gpu_info_util_config" ]
public_deps = [ public_deps = [
":angle_common", ":angle_common",
] ]
sources = libangle_gpu_info_util_sources sources = libangle_gpu_info_util_sources
deps = [] deps = []
libs = [] libs = []
...@@ -329,7 +296,7 @@ static_library("angle_gpu_info_util") { ...@@ -329,7 +296,7 @@ static_library("angle_gpu_info_util") {
} }
} }
static_library("translator") { angle_static_library("translator") {
sources = angle_translator_sources sources = angle_translator_sources
defines = [] defines = []
...@@ -353,12 +320,7 @@ static_library("translator") { ...@@ -353,12 +320,7 @@ static_library("translator") {
defines += [ "ANGLE_ENABLE_VULKAN" ] defines += [ "ANGLE_ENABLE_VULKAN" ]
} }
configs -= angle_undefine_configs public_configs += [ ":external_config" ]
configs += [
":internal_config",
":extra_warnings",
]
public_configs = [ ":external_config" ]
if (use_fuzzing_engine) { if (use_fuzzing_engine) {
all_dependent_configs = [ ":translator_disable_pool_alloc" ] all_dependent_configs = [ ":translator_disable_pool_alloc" ]
} }
...@@ -379,7 +341,7 @@ static_library("translator") { ...@@ -379,7 +341,7 @@ static_library("translator") {
} }
} }
source_set("translator_fuzzer") { angle_source_set("translator_fuzzer") {
sources = [ sources = [
"src/compiler/fuzz/translator_fuzzer.cpp", "src/compiler/fuzz/translator_fuzzer.cpp",
] ]
...@@ -432,7 +394,7 @@ if (angle_use_commit_id) { ...@@ -432,7 +394,7 @@ if (angle_use_commit_id) {
} }
} }
source_set("angle_version") { angle_source_set("angle_version") {
sources = [ sources = [
"src/common/version.h", "src/common/version.h",
] ]
...@@ -511,7 +473,7 @@ if (angle_enable_vulkan) { ...@@ -511,7 +473,7 @@ if (angle_enable_vulkan) {
} }
} }
static_library("libANGLE") { angle_static_library("libANGLE") {
sources = libangle_sources sources = libangle_sources
include_dirs = [] include_dirs = []
...@@ -623,15 +585,8 @@ static_library("libANGLE") { ...@@ -623,15 +585,8 @@ static_library("libANGLE") {
defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ] defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ]
} }
configs -= angle_undefine_configs configs += [ ":debug_annotations_config" ]
public_configs += [ ":libANGLE_config" ]
configs += [
":debug_annotations_config",
":extra_warnings",
":internal_config",
]
public_configs = [ ":libANGLE_config" ]
# Windows ARM64 is available since 10.0.16299 so no need to copy # Windows ARM64 is available since 10.0.16299 so no need to copy
# d3dcompiler_47.dll because this file is available as inbox. # d3dcompiler_47.dll because this file is available as inbox.
...@@ -671,33 +626,17 @@ config("angle_static") { ...@@ -671,33 +626,17 @@ config("angle_static") {
] ]
} }
shared_library("libGLESv2${angle_libs_suffix}") { angle_shared_library("libGLESv2${angle_libs_suffix}") {
sources = libglesv2_sources sources = libglesv2_sources
if (is_android) {
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ ":build_id_config" ]
}
if (is_win) { if (is_win) {
sources += [ "src/libGLESv2/libGLESv2_autogen.def" ] sources += [ "src/libGLESv2/libGLESv2_autogen.def" ]
} }
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs = [ ":shared_library_public_config" ]
}
configs -= angle_undefine_configs
configs += [ configs += [
":angle_gl_visibility_config", ":angle_gl_visibility_config",
":debug_annotations_config", ":debug_annotations_config",
":extra_warnings",
":gl_prototypes", ":gl_prototypes",
":internal_config",
] ]
defines = [ "LIBGLESV2_IMPLEMENTATION" ] defines = [ "LIBGLESV2_IMPLEMENTATION" ]
...@@ -712,50 +651,25 @@ shared_library("libGLESv2${angle_libs_suffix}") { ...@@ -712,50 +651,25 @@ shared_library("libGLESv2${angle_libs_suffix}") {
] ]
} }
static_library("libGLESv2_static") { angle_static_library("libGLESv2_static") {
sources = libglesv2_sources sources = libglesv2_sources
configs += [ ":debug_annotations_config" ]
configs -= angle_undefine_configs public_configs += [ ":angle_static" ]
configs += [
":debug_annotations_config",
":extra_warnings",
":internal_config",
]
public_configs = [ ":angle_static" ]
deps = [ deps = [
":includes", ":includes",
] ]
public_deps = [ public_deps = [
":libANGLE", ":libANGLE",
] ]
} }
shared_library("libGLESv1_CM${angle_libs_suffix}") { angle_shared_library("libGLESv1_CM${angle_libs_suffix}") {
sources = libglesv1_cm_sources sources = libglesv1_cm_sources
if (is_android) {
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ ":build_id_config" ]
}
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs = [ ":shared_library_public_config" ]
}
configs -= angle_undefine_configs
configs += [ configs += [
":angle_gl_visibility_config", ":angle_gl_visibility_config",
":debug_annotations_config", ":debug_annotations_config",
":extra_warnings",
":gl_prototypes", ":gl_prototypes",
":internal_config",
] ]
defines = [] defines = []
...@@ -766,18 +680,10 @@ shared_library("libGLESv1_CM${angle_libs_suffix}") { ...@@ -766,18 +680,10 @@ shared_library("libGLESv1_CM${angle_libs_suffix}") {
] ]
} }
static_library("libGLESv1_CM_static") { angle_static_library("libGLESv1_CM_static") {
sources = libglesv1_cm_sources sources = libglesv1_cm_sources
configs += [ ":debug_annotations_config" ]
configs -= angle_undefine_configs public_configs += [ ":angle_static" ]
configs += [
":debug_annotations_config",
":extra_warnings",
":internal_config",
]
public_configs = [ ":angle_static" ]
deps = [ deps = [
":includes", ":includes",
":libGLESv2_static", ":libGLESv2_static",
...@@ -788,17 +694,15 @@ config("libEGL_egl_loader_config") { ...@@ -788,17 +694,15 @@ config("libEGL_egl_loader_config") {
defines = [ "ANGLE_USE_EGL_LOADER" ] defines = [ "ANGLE_USE_EGL_LOADER" ]
} }
source_set("libEGL_egl_loader") { angle_source_set("libEGL_egl_loader") {
sources = [ sources = [
"src/libEGL/egl_loader_autogen.cpp", "src/libEGL/egl_loader_autogen.cpp",
"src/libEGL/egl_loader_autogen.h", "src/libEGL/egl_loader_autogen.h",
] ]
public_configs = [ public_configs += [
":libEGL_egl_loader_config", ":libEGL_egl_loader_config",
":gl_prototypes", ":gl_prototypes",
":extra_warnings",
":internal_config",
] ]
deps = [ deps = [
...@@ -806,18 +710,11 @@ source_set("libEGL_egl_loader") { ...@@ -806,18 +710,11 @@ source_set("libEGL_egl_loader") {
] ]
} }
shared_library("libEGL${angle_libs_suffix}") { angle_shared_library("libEGL${angle_libs_suffix}") {
sources = libegl_sources sources = libegl_sources
if (is_android) {
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ ":build_id_config" ]
}
configs -= angle_undefine_configs
configs += [ configs += [
":debug_annotations_config", ":debug_annotations_config",
":extra_warnings",
":internal_config",
":library_name_config", ":library_name_config",
] ]
...@@ -832,14 +729,6 @@ shared_library("libEGL${angle_libs_suffix}") { ...@@ -832,14 +729,6 @@ shared_library("libEGL${angle_libs_suffix}") {
sources += [ "src/libEGL/libEGL.def" ] sources += [ "src/libEGL/libEGL.def" ]
} }
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs = [ ":shared_library_public_config" ]
}
deps = [ deps = [
":angle_system_utils", ":angle_system_utils",
":angle_version", ":angle_version",
...@@ -855,18 +744,15 @@ shared_library("libEGL${angle_libs_suffix}") { ...@@ -855,18 +744,15 @@ shared_library("libEGL${angle_libs_suffix}") {
] ]
} }
static_library("libEGL_static") { angle_static_library("libEGL_static") {
sources = libegl_sources sources = libegl_sources
configs -= angle_undefine_configs
configs += [ configs += [
":debug_annotations_config", ":debug_annotations_config",
":extra_warnings",
":internal_config",
":library_name_config", ":library_name_config",
] ]
public_configs = [ ":angle_static" ] public_configs += [ ":angle_static" ]
deps = [ deps = [
":includes", ":includes",
...@@ -880,7 +766,7 @@ config("angle_util_loader_config") { ...@@ -880,7 +766,7 @@ config("angle_util_loader_config") {
defines = [ "ANGLE_USE_UTIL_LOADER" ] defines = [ "ANGLE_USE_UTIL_LOADER" ]
} }
source_set("angle_util_loader_headers") { angle_source_set("angle_util_loader_headers") {
sources = [ sources = [
"util/egl_loader_autogen.h", "util/egl_loader_autogen.h",
"util/gles_loader_autogen.h", "util/gles_loader_autogen.h",
...@@ -896,7 +782,7 @@ source_set("angle_util_loader_headers") { ...@@ -896,7 +782,7 @@ source_set("angle_util_loader_headers") {
] ]
} }
source_set("angle_util_loader") { angle_source_set("angle_util_loader") {
defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
sources = [ sources = [
...@@ -912,14 +798,11 @@ source_set("angle_util_loader") { ...@@ -912,14 +798,11 @@ source_set("angle_util_loader") {
":angle_util_loader_headers", ":angle_util_loader_headers",
] ]
public_configs = [ public_configs += [
":angle_util_config", ":angle_util_config",
":angle_util_loader_config", ":angle_util_loader_config",
":internal_config",
":no_gl_prototypes", ":no_gl_prototypes",
] ]
configs += [ ":extra_warnings" ]
} }
config("angle_util_config") { config("angle_util_config") {
...@@ -935,11 +818,11 @@ foreach(is_shared_library, ...@@ -935,11 +818,11 @@ foreach(is_shared_library,
false, false,
]) { ]) {
if (is_shared_library) { if (is_shared_library) {
library_type = "shared_library" library_type = "angle_shared_library"
library_name = "angle_util" library_name = "angle_util"
dep_suffix = "${angle_libs_suffix}" dep_suffix = "${angle_libs_suffix}"
} else { } else {
library_type = "static_library" library_type = "angle_static_library"
library_name = "angle_util_static" library_name = "angle_util_static"
dep_suffix = "_static" dep_suffix = "_static"
} }
...@@ -973,10 +856,6 @@ foreach(is_shared_library, ...@@ -973,10 +856,6 @@ foreach(is_shared_library,
} }
if (is_android) { if (is_android) {
if (is_shared_library) {
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
}
# To prevent linux sources filtering on android # To prevent linux sources filtering on android
set_sources_assignment_filter([]) set_sources_assignment_filter([])
sources += util_linux_sources sources += util_linux_sources
...@@ -991,15 +870,9 @@ foreach(is_shared_library, ...@@ -991,15 +870,9 @@ foreach(is_shared_library,
sources += util_ozone_sources sources += util_ozone_sources
} }
configs += [ configs += [ ":debug_annotations_config" ]
":debug_annotations_config",
":extra_warnings",
]
public_configs = [ public_configs += [ ":angle_util_config" ]
":angle_util_config",
":internal_config",
]
deps = [ deps = [
":angle_common", ":angle_common",
...@@ -1009,14 +882,6 @@ foreach(is_shared_library, ...@@ -1009,14 +882,6 @@ foreach(is_shared_library,
if (is_shared_library) { if (is_shared_library) {
defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/lib${target_name}.dylib",
]
public_configs += [ ":shared_library_public_config" ]
}
if (is_win) { if (is_win) {
sources += util_win_shared_sources sources += util_win_shared_sources
} }
...@@ -1024,6 +889,13 @@ foreach(is_shared_library, ...@@ -1024,6 +889,13 @@ foreach(is_shared_library,
public_deps = [ public_deps = [
":angle_util_loader", ":angle_util_loader",
] ]
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/libangle_util.dylib",
]
}
} else { } else {
public_configs += [ public_configs += [
":angle_static", ":angle_static",
...@@ -1036,7 +908,7 @@ foreach(is_shared_library, ...@@ -1036,7 +908,7 @@ foreach(is_shared_library,
# Convenience targets for some of the samples so they can be built # Convenience targets for some of the samples so they can be built
# with Chromium's toolchain. # with Chromium's toolchain.
executable("angle_shader_translator") { angle_executable("angle_shader_translator") {
testonly = true testonly = true
sources = [ sources = [
...@@ -1059,35 +931,21 @@ config("angle_feature_support_config") { ...@@ -1059,35 +931,21 @@ config("angle_feature_support_config") {
} }
} }
shared_library("libfeature_support${angle_libs_suffix}") { angle_shared_library("libfeature_support${angle_libs_suffix}") {
if (is_android) { if (is_android) {
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ ":build_id_config" ]
libs = [ "log" ] libs = [ "log" ]
} }
configs -= angle_undefine_configs
configs += [
":extra_warnings",
":internal_config",
]
public_configs = [ public_configs += [
":angle_feature_support_config", ":angle_feature_support_config",
"third_party/jsoncpp:jsoncpp_config", "third_party/jsoncpp:jsoncpp_config",
] ]
if (is_mac && !is_component_build) {
ldflags = [
"-install_name",
"@rpath/${target_name}.dylib",
]
public_configs += [ ":shared_library_public_config" ]
}
sources = [ sources = [
"src/feature_support_util/feature_support_util.cpp", "src/feature_support_util/feature_support_util.cpp",
"src/feature_support_util/feature_support_util.h", "src/feature_support_util/feature_support_util.h",
] ]
deps = [ deps = [
":angle_gpu_info_util", ":angle_gpu_info_util",
"third_party/jsoncpp:jsoncpp", "third_party/jsoncpp:jsoncpp",
...@@ -1116,9 +974,8 @@ if (!is_component_build && is_android && symbol_level != 0) { ...@@ -1116,9 +974,8 @@ if (!is_component_build && is_android && symbol_level != 0) {
if (angle_enable_vulkan_validation_layers) { if (angle_enable_vulkan_validation_layers) {
foreach(_layer, vulkan_validation_layers) { foreach(_layer, vulkan_validation_layers) {
deps += [ deps +=
"${angle_root}/third_party/vulkan-validation-layers:${_layer}", [ "${angle_root}/third_party/vulkan-validation-layers:${_layer}" ]
]
} }
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni") # import the use_x11 variable import("//build/config/ui.gni") # import the use_x11 variable
import("//build_overrides/build.gni") import("//build_overrides/build.gni")
import("//testing/test.gni")
if (is_android) { if (is_android) {
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
} }
...@@ -86,3 +87,152 @@ declare_args() { ...@@ -86,3 +87,152 @@ declare_args() {
if (is_win) { if (is_win) {
import("//build/config/win/visual_studio_version.gni") import("//build/config/win/visual_studio_version.gni")
} }
angle_common_configs = [
angle_root + ":extra_warnings",
angle_root + ":internal_config",
]
angle_remove_configs = [ "//build/config/compiler:default_include_dirs" ]
set_defaults("angle_executable") {
configs = angle_common_configs
public_configs = []
suppressed_configs = []
}
set_defaults("angle_shared_library") {
configs = angle_common_configs
public_configs = []
suppressed_configs = []
}
set_defaults("angle_source_set") {
configs = angle_common_configs
public_configs = []
suppressed_configs = []
}
set_defaults("angle_static_library") {
configs = angle_common_configs
public_configs = []
suppressed_configs = []
}
set_defaults("angle_test") {
configs = angle_common_configs
public_configs = []
suppressed_configs = []
}
template("angle_executable") {
executable(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"suppressed_configs",
"visibility",
])
# Needed because visibility is global.
forward_variables_from(invoker, [ "visibility" ])
configs += invoker.configs
configs -= angle_remove_configs
configs -= invoker.suppressed_configs
}
}
template("angle_shared_library") {
shared_library(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"suppressed_configs",
"visibility",
])
# Needed because visibility is global.
forward_variables_from(invoker, [ "visibility" ])
configs += invoker.configs
configs -= angle_remove_configs
configs -= invoker.suppressed_configs
public_configs += [ angle_root + ":shared_library_public_config" ]
if (is_android) {
configs += [ angle_root + ":build_id_config" ]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
}
}
}
template("angle_source_set") {
source_set(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"suppressed_configs",
"visibility",
])
# Needed because visibility is global.
forward_variables_from(invoker, [ "visibility" ])
configs += invoker.configs
configs -= angle_remove_configs
configs -= invoker.suppressed_configs
}
}
template("angle_static_library") {
static_library(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"suppressed_configs",
"visibility",
])
# Needed because visibility is global.
forward_variables_from(invoker, [ "visibility" ])
configs += invoker.configs
configs -= angle_remove_configs
configs -= invoker.suppressed_configs
}
}
template("angle_test") {
test(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"suppressed_configs",
"visibility",
])
# Needed because visibility is global.
forward_variables_from(invoker, [ "visibility" ])
configs += invoker.configs
configs -= angle_remove_configs
configs -= invoker.suppressed_configs
if (is_linux && !is_component_build) {
# Set rpath to find shared libs in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
if (is_android) {
configs += [ angle_root + ":build_id_config" ]
configs -= [ "//build/config/android:hide_all_but_jni" ]
}
}
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import("../gni/angle.gni") import("../gni/angle.gni")
executable("shader_translator") { angle_executable("shader_translator") {
sources = [ sources = [
"shader_translator/shader_translator.cpp", "shader_translator/shader_translator.cpp",
] ]
...@@ -18,7 +18,7 @@ config("sample_util_config") { ...@@ -18,7 +18,7 @@ config("sample_util_config") {
include_dirs = [ "sample_util" ] include_dirs = [ "sample_util" ]
} }
static_library("sample_util") { angle_static_library("sample_util") {
sources = [ sources = [
"sample_util/SampleApplication.cpp", "sample_util/SampleApplication.cpp",
"sample_util/SampleApplication.h", "sample_util/SampleApplication.h",
...@@ -40,7 +40,6 @@ static_library("sample_util") { ...@@ -40,7 +40,6 @@ static_library("sample_util") {
configs += [ "../:library_name_config" ] configs += [ "../:library_name_config" ]
public_configs = [ public_configs = [
":sample_util_config", ":sample_util_config",
"../:internal_config",
"../:no_gl_prototypes", "../:no_gl_prototypes",
] ]
} }
...@@ -55,7 +54,7 @@ template("angle_sample") { ...@@ -55,7 +54,7 @@ template("angle_sample") {
} }
} }
executable(target_name) { angle_executable(target_name) {
deps = [ deps = [
":sample_util", ":sample_util",
] ]
......
...@@ -707,8 +707,8 @@ TEST(MatrixUtilsTest, Mat4Rotate) ...@@ -707,8 +707,8 @@ TEST(MatrixUtilsTest, Mat4Rotate)
{ {
const auto &input = rotationGoldenInputs[i]; const auto &input = rotationGoldenInputs[i];
const auto &output = rotationGoldenOutputs[i]; const auto &output = rotationGoldenOutputs[i];
Mat4 r = Mat4::Rotate(input.angle, input.axis); Mat4 rot = Mat4::Rotate(input.angle, input.axis);
CheckMatrixCloseToGolden(output, r); CheckMatrixCloseToGolden(output, rot);
} }
} }
......
...@@ -72,8 +72,10 @@ TEST_F(FenceNVTest, SetAndTestBehavior) ...@@ -72,8 +72,10 @@ TEST_F(FenceNVTest, SetAndTestBehavior)
EXPECT_TRUE(mFence->isSet()); EXPECT_TRUE(mFence->isSet());
// Fake the behavior of testing the fence before and after it's passed. // Fake the behavior of testing the fence before and after it's passed.
EXPECT_CALL(*mImpl, test(_, _)) EXPECT_CALL(*mImpl, test(_, _))
.WillOnce(DoAll(SetArgumentPointee<1>(GL_FALSE), Return(angle::Result::Continue))) .WillOnce(DoAll(SetArgumentPointee<1>(static_cast<GLboolean>(GL_FALSE)),
.WillOnce(DoAll(SetArgumentPointee<1>(GL_TRUE), Return(angle::Result::Continue))) Return(angle::Result::Continue)))
.WillOnce(DoAll(SetArgumentPointee<1>(static_cast<GLboolean>(GL_TRUE)),
Return(angle::Result::Continue)))
.RetiresOnSaturation(); .RetiresOnSaturation();
GLboolean out; GLboolean out;
EXPECT_EQ(angle::Result::Continue, mFence->test(nullptr, &out)); EXPECT_EQ(angle::Result::Continue, mFence->test(nullptr, &out));
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("../../gni/angle.gni")
import("//build/config/chromecast_build.gni") import("//build/config/chromecast_build.gni")
import("//testing/test.gni") import("//testing/test.gni")
import("../../gni/angle.gni")
import("angle_unittests.gni") import("angle_unittests.gni")
declare_args() { declare_args() {
...@@ -33,11 +33,11 @@ if (build_with_chromium) { ...@@ -33,11 +33,11 @@ if (build_with_chromium) {
] ]
} }
static_library("angle_internal_gtest") { angle_static_library("angle_internal_gtest") {
sources = [ sources = [
"//third_party/googletest/src/googletest/src/gtest-all.cc", "//third_party/googletest/src/googletest/src/gtest-all.cc",
] ]
public_configs = [ ":angle_internal_gtest_config" ] public_configs += [ ":angle_internal_gtest_config" ]
} }
config("angle_internal_gmock_config") { config("angle_internal_gmock_config") {
...@@ -53,11 +53,11 @@ if (build_with_chromium) { ...@@ -53,11 +53,11 @@ if (build_with_chromium) {
} }
} }
static_library("angle_internal_gmock") { angle_static_library("angle_internal_gmock") {
sources = [ sources = [
"//third_party/googletest/src/googlemock/src/gmock-all.cc", "//third_party/googletest/src/googlemock/src/gmock-all.cc",
] ]
public_configs = [ ":angle_internal_gmock_config" ] public_configs += [ ":angle_internal_gmock_config" ]
} }
group("all") { group("all") {
...@@ -87,67 +87,45 @@ if (build_with_chromium) { ...@@ -87,67 +87,45 @@ if (build_with_chromium) {
} }
} }
source_set("angle_unittests_main") { # Helper template for including "main" files in Chromium.
template("angle_tests_main") {
source_set(target_name) {
testonly = true testonly = true
public_deps = googletest_deps + [ angle_root + ":includes" ] public_deps = googletest_deps
public_configs = [ angle_root + ":internal_config" ] deps = [
angle_root + ":includes",
if (build_with_chromium) {
sources = [
"//gpu/angle_unittest_main.cc",
]
} else {
sources = [
"angle_unittests_main.cpp",
] ]
} configs += [ angle_root + ":internal_config" ]
}
# Ideally we would rename this. But not be worth the hassle. main = invoker.main
source_set("angle_end2end_tests_main") {
testonly = true
public_deps = googletest_deps
if (build_with_chromium) { if (build_with_chromium) {
include_dirs = [ "../.." ]
sources = [ sources = [
"//gpu/angle_end2end_tests_main.cc", "//gpu/$main.cc",
] ]
} else { } else {
sources = [ sources = [
"angle_end2end_tests_main.cpp", "$main.cpp",
] ]
} }
}
} }
source_set("angle_perftests_main") { # Should fix the naming here once we migrate away from Chromium "main" files.
testonly = true angle_tests_main("angle_unittests_main") {
public_deps = googletest_deps main = "angle_unittest_main"
if (build_with_chromium) {
sources = [
"//gpu/angle_perftests_main.cc",
]
} else {
sources = [
"angle_perftests_main.cpp",
]
}
} }
# This config adds build-ids to the associated library. angle_tests_main("angle_end2end_tests_main") {
# -Wl is a special option that indicates that clang should pass the associated main = "angle_end2end_tests_main"
# option --build-id to the linker. This will cause a build-id section to be added
# to the associated library. The build-id makes it possible for a debugger to
# find the right symbol file to use.
config("build_id_config") {
if (is_clang) {
ldflags = [ "-Wl,--build-id" ]
}
} }
test("angle_unittests") { angle_tests_main("angle_perftests_main") {
include_dirs = [ "$angle_root/src" ] main = "angle_perftests_main"
}
angle_test("angle_unittests") {
sources = angle_unittests_sources sources = angle_unittests_sources
if (angle_enable_hlsl) { if (angle_enable_hlsl) {
...@@ -155,11 +133,6 @@ test("angle_unittests") { ...@@ -155,11 +133,6 @@ test("angle_unittests") {
defines = [ "ANGLE_ENABLE_HLSL" ] defines = [ "ANGLE_ENABLE_HLSL" ]
} }
if (is_linux && !is_component_build) {
# Set rpath to find shared libs in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
deps = googletest_deps + [ deps = googletest_deps + [
angle_root + ":libANGLE", angle_root + ":libANGLE",
angle_root + ":preprocessor", angle_root + ":preprocessor",
...@@ -172,13 +145,8 @@ test("angle_unittests") { ...@@ -172,13 +145,8 @@ test("angle_unittests") {
if (is_win || is_linux || is_mac || is_android) { if (is_win || is_linux || is_mac || is_android) {
import("angle_end2end_tests.gni") import("angle_end2end_tests.gni")
test("angle_end2end_tests") { angle_test("angle_end2end_tests") {
include_dirs = [ "../../src/tests" ] include_dirs = [ "." ]
if (is_android) {
use_native_activity = true
configs += [ ":build_id_config" ]
}
sources = angle_end2end_tests_sources sources = angle_end2end_tests_sources
libs = [] libs = []
...@@ -198,16 +166,10 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -198,16 +166,10 @@ if (is_win || is_linux || is_mac || is_android) {
} }
configs += [ configs += [
angle_root + ":internal_config",
angle_root + ":libANGLE_config", angle_root + ":libANGLE_config",
angle_root + ":library_name_config", angle_root + ":library_name_config",
] ]
if (is_linux && !is_component_build) {
# Set rpath to find libEGL.so and libGLESv2.so even in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
deps = [ deps = [
angle_root + ":angle_image_util", angle_root + ":angle_image_util",
angle_root + ":angle_util", angle_root + ":angle_util",
...@@ -220,17 +182,16 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -220,17 +182,16 @@ if (is_win || is_linux || is_mac || is_android) {
angle_root + ":libGLESv1_CM${angle_libs_suffix}", angle_root + ":libGLESv1_CM${angle_libs_suffix}",
angle_root + ":libGLESv2${angle_libs_suffix}", angle_root + ":libGLESv2${angle_libs_suffix}",
] ]
}
import("angle_white_box_tests.gni")
test("angle_white_box_tests") {
include_dirs = [ "." ]
if (is_android) { if (is_android) {
use_native_activity = true use_native_activity = true
} }
}
import("angle_white_box_tests.gni")
angle_test("angle_white_box_tests") {
include_dirs = [ "." ]
sources = angle_white_box_tests_sources sources = angle_white_box_tests_sources
if (is_win) { if (is_win) {
...@@ -243,16 +204,10 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -243,16 +204,10 @@ if (is_win || is_linux || is_mac || is_android) {
} }
configs += [ configs += [
angle_root + ":internal_config",
angle_root + ":libANGLE_config", angle_root + ":libANGLE_config",
angle_root + ":library_name_config", angle_root + ":library_name_config",
] ]
if (is_linux && !is_component_build) {
# Set rpath to find libEGL.so and libGLESv2.so even in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
deps = [ deps = [
angle_root + ":angle_util_static", angle_root + ":angle_util_static",
angle_root + ":libANGLE", angle_root + ":libANGLE",
...@@ -262,6 +217,10 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -262,6 +217,10 @@ if (is_win || is_linux || is_mac || is_android) {
angle_root + ":translator", angle_root + ":translator",
":angle_end2end_tests_main", ":angle_end2end_tests_main",
] ]
if (is_android) {
use_native_activity = true
}
} }
} }
...@@ -269,12 +228,8 @@ if (is_win || is_linux || is_android || is_mac) { ...@@ -269,12 +228,8 @@ if (is_win || is_linux || is_android || is_mac) {
import("angle_perftests.gni") import("angle_perftests.gni")
# This test suite is for perf tests that use ANGLE's internals in some direct way. # This test suite is for perf tests that use ANGLE's internals in some direct way.
test("angle_white_box_perftests") { angle_test("angle_white_box_perftests") {
include_dirs = [ include_dirs = [ "." ]
".",
"../..",
]
sources = angle_white_box_perf_tests_sources sources = angle_white_box_perf_tests_sources
deps = [ deps = [
...@@ -286,11 +241,6 @@ if (is_win || is_linux || is_android || is_mac) { ...@@ -286,11 +241,6 @@ if (is_win || is_linux || is_android || is_mac) {
":angle_perftests_main", ":angle_perftests_main",
] ]
if (is_android) {
use_native_activity = true
configs -= [ "//build/config/android:hide_all_but_jni" ]
}
if (is_win) { if (is_win) {
sources += angle_white_box_perf_tests_win_sources sources += angle_white_box_perf_tests_win_sources
} }
...@@ -298,28 +248,22 @@ if (is_win || is_linux || is_android || is_mac) { ...@@ -298,28 +248,22 @@ if (is_win || is_linux || is_android || is_mac) {
if (angle_enable_vulkan) { if (angle_enable_vulkan) {
sources += angle_white_box_perf_tests_vulkan_sources sources += angle_white_box_perf_tests_vulkan_sources
deps += [ "$angle_root/third_party/glslang:glslang" ] deps += [ "$angle_root/third_party/glslang:glslang" ]
public_configs = [ "$angle_root/third_party/glslang:glslang_config" ] public_configs += [ "$angle_root/third_party/glslang:glslang_config" ]
} }
configs += [ configs += [
angle_root + ":internal_config",
angle_root + ":libANGLE_config", angle_root + ":libANGLE_config",
angle_root + ":library_name_config", angle_root + ":library_name_config",
] ]
if (is_linux && !is_component_build) { if (is_android) {
# Set rpath to find *.so files even in a non-component build. use_native_activity = true
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
} }
} }
# This test suite is designed to run against a generic GL implementation. # This test suite is designed to run against a generic GL implementation.
test("angle_perftests") { angle_test("angle_perftests") {
include_dirs = [ include_dirs = [ "." ]
".",
"../..",
]
sources = angle_perf_tests_sources sources = angle_perf_tests_sources
deps = [ deps = [
...@@ -336,20 +280,13 @@ if (is_win || is_linux || is_android || is_mac) { ...@@ -336,20 +280,13 @@ if (is_win || is_linux || is_android || is_mac) {
angle_root + ":libGLESv2${angle_libs_suffix}", angle_root + ":libGLESv2${angle_libs_suffix}",
] ]
if (is_android) {
use_native_activity = true
configs -= [ "//build/config/android:hide_all_but_jni" ]
}
configs += [ configs += [
angle_root + ":internal_config",
angle_root + ":libANGLE_config", angle_root + ":libANGLE_config",
angle_root + ":library_name_config", angle_root + ":library_name_config",
] ]
if (is_linux && !is_component_build) { if (is_android) {
# Set rpath to find *.so files even in a non-component build. use_native_activity = true
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
} }
} }
} }
...@@ -395,6 +332,7 @@ if (build_angle_gles1_conform_tests) { ...@@ -395,6 +332,7 @@ if (build_angle_gles1_conform_tests) {
} }
} }
# This source set is a bit special so we don't use angle_source_set.
source_set("angle_gles1_conformance_no_gtest") { source_set("angle_gles1_conformance_no_gtest") {
configs += [ configs += [
":angle_gles1_conform_support", ":angle_gles1_conform_support",
...@@ -545,18 +483,13 @@ if (build_angle_gles1_conform_tests) { ...@@ -545,18 +483,13 @@ if (build_angle_gles1_conform_tests) {
] ]
} }
test("angle_gles1_conformance_tests") { angle_test("angle_gles1_conformance_tests") {
testonly = true
deps = [ deps = [
":angle_end2end_tests_main", ":angle_end2end_tests_main",
":angle_gles1_conformance_no_gtest", ":angle_gles1_conformance_no_gtest",
] ]
include_dirs = [ include_dirs = [ "." ]
"../../src/tests",
angle_root,
]
sources = [ sources = [
"gles1_conformance_tests/ConformanceTests.cpp", "gles1_conformance_tests/ConformanceTests.cpp",
...@@ -570,10 +503,13 @@ if (build_angle_gles1_conform_tests) { ...@@ -570,10 +503,13 @@ if (build_angle_gles1_conform_tests) {
] ]
configs += [ configs += [
angle_root + ":internal_config",
angle_root + ":libANGLE_config", angle_root + ":libANGLE_config",
angle_root + ":library_name_config", angle_root + ":library_name_config",
] ]
if (is_android) {
use_native_activity = true
}
} }
} }
...@@ -584,19 +520,8 @@ if (build_angle_gles1_conform_tests) { ...@@ -584,19 +520,8 @@ if (build_angle_gles1_conform_tests) {
if (build_angle_deqp_tests) { if (build_angle_deqp_tests) {
import("deqp.gni") import("deqp.gni")
source_set("angle_deqp_tests_main") { angle_tests_main("angle_deqp_tests_main") {
testonly = true main = "angle_deqp_tests_main"
public_deps = googletest_deps
if (build_with_chromium) {
sources = [
"//gpu/angle_deqp_tests_main.cc",
]
} else {
sources = [
"deqp_support/angle_deqp_gtest_main.cpp",
]
}
} }
config("angle_deqp_support") { config("angle_deqp_support") {
...@@ -666,6 +591,7 @@ if (build_angle_deqp_tests) { ...@@ -666,6 +591,7 @@ if (build_angle_deqp_tests) {
"//build/config/compiler:chromium_code", "//build/config/compiler:chromium_code",
"//build/config/compiler:no_exceptions", "//build/config/compiler:no_exceptions",
"//build/config/compiler:no_rtti", "//build/config/compiler:no_rtti",
angle_root + ":extra_warnings",
] ]
if (is_win) { if (is_win) {
...@@ -676,13 +602,12 @@ if (build_angle_deqp_tests) { ...@@ -676,13 +602,12 @@ if (build_angle_deqp_tests) {
] ]
} }
static_library("angle_deqp_decpp") { angle_static_library("angle_deqp_decpp") {
configs -= deqp_undefine_configs suppressed_configs += deqp_undefine_configs
public_configs = [ public_configs += [
":angle_deqp_support", ":angle_deqp_support",
"//build/config/compiler:exceptions", "//build/config/compiler:exceptions",
"//build/config/compiler:no_chromium_code", "//build/config/compiler:no_chromium_code",
angle_root + ":internal_config",
] ]
if (is_clang) { if (is_clang) {
cflags_cc = [ cflags_cc = [
...@@ -711,7 +636,7 @@ if (build_angle_deqp_tests) { ...@@ -711,7 +636,7 @@ if (build_angle_deqp_tests) {
} }
} }
static_library("angle_deqp_libtester") { angle_static_library("angle_deqp_libtester") {
public_deps = [ public_deps = [
":angle_deqp_decpp", ":angle_deqp_decpp",
angle_root + ":angle_common", angle_root + ":angle_common",
...@@ -721,9 +646,9 @@ if (build_angle_deqp_tests) { ...@@ -721,9 +646,9 @@ if (build_angle_deqp_tests) {
"//third_party/libpng:libpng", "//third_party/libpng:libpng",
] ]
configs -= deqp_undefine_configs suppressed_configs += deqp_undefine_configs
configs += [ angle_root + ":library_name_config" ] configs += [ angle_root + ":library_name_config" ]
public_configs = [ ":angle_deqp_libtester_config" ] public_configs += [ ":angle_deqp_libtester_config" ]
sources = deqp_libtester_sources sources = deqp_libtester_sources
if (is_win) { if (is_win) {
sources += deqp_libtester_sources_win sources += deqp_libtester_sources_win
...@@ -741,7 +666,7 @@ if (build_angle_deqp_tests) { ...@@ -741,7 +666,7 @@ if (build_angle_deqp_tests) {
include_dirs = [ "third_party/gpu_test_expectations" ] include_dirs = [ "third_party/gpu_test_expectations" ]
} }
source_set("angle_deqp_gtest_support") { angle_source_set("angle_deqp_gtest_support") {
testonly = true testonly = true
public_deps = [ public_deps = [
...@@ -750,7 +675,7 @@ if (build_angle_deqp_tests) { ...@@ -750,7 +675,7 @@ if (build_angle_deqp_tests) {
":angle_deqp_tests_main", ":angle_deqp_tests_main",
] ]
public_configs = [ ":angle_deqp_gtest_support_config" ] public_configs += [ ":angle_deqp_gtest_support_config" ]
sources = deqp_gpu_test_expectations_sources sources = deqp_gpu_test_expectations_sources
if (is_mac) { if (is_mac) {
...@@ -796,18 +721,14 @@ if (build_angle_deqp_tests) { ...@@ -796,18 +721,14 @@ if (build_angle_deqp_tests) {
} }
shared_library_name = "angle_deqp_lib${api_name}" shared_library_name = "angle_deqp_lib${api_name}"
shared_library(shared_library_name) { angle_shared_library(shared_library_name) {
deps = [ deps = [
":angle_deqp_libtester", ":angle_deqp_libtester",
angle_root + ":angle_util", angle_root + ":angle_util",
] ]
configs -= deqp_undefine_configs suppressed_configs += deqp_undefine_configs
if (is_android) { public_configs += [ ":${config_name}" ]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
}
public_configs = [ ":${config_name}" ]
sources = target_sources[index] sources = target_sources[index]
sources += [ sources += [
...@@ -818,7 +739,7 @@ if (build_angle_deqp_tests) { ...@@ -818,7 +739,7 @@ if (build_angle_deqp_tests) {
} }
if (!build_with_chromium) { if (!build_with_chromium) {
executable("angle_deqp_${api_name}_no_gtest") { angle_executable("angle_deqp_${api_name}_no_gtest") {
sources = [ sources = [
"deqp_support/angle_deqp_tests_main.cpp", "deqp_support/angle_deqp_tests_main.cpp",
] ]
...@@ -829,7 +750,7 @@ if (build_angle_deqp_tests) { ...@@ -829,7 +750,7 @@ if (build_angle_deqp_tests) {
} }
test_name = "angle_deqp_${api_name}_tests" test_name = "angle_deqp_${api_name}_tests"
test(test_name) { angle_test(test_name) {
deps = [ deps = [
":${shared_library_name}", ":${shared_library_name}",
":angle_deqp_gtest_support", ":angle_deqp_gtest_support",
...@@ -846,11 +767,6 @@ if (build_angle_deqp_tests) { ...@@ -846,11 +767,6 @@ if (build_angle_deqp_tests) {
"$angle_root/third_party/deqp/src/data/", "$angle_root/third_party/deqp/src/data/",
] ]
if (is_linux && !is_component_build) {
# Set rpath to find *.so files even in a non-component build.
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
if (is_android) { if (is_android) {
use_native_activity = true use_native_activity = true
} }
......
...@@ -83,7 +83,8 @@ class EGLDirectCompositionTest : public ANGLETest ...@@ -83,7 +83,8 @@ class EGLDirectCompositionTest : public ANGLETest
ComPtr<IVisual> angleVis; ComPtr<IVisual> angleVis;
ASSERT_TRUE(SUCCEEDED(mAngleHost.As(&angleVis))); ASSERT_TRUE(SUCCEEDED(mAngleHost.As(&angleVis)));
ASSERT_TRUE(SUCCEEDED(angleVis->put_Size({WINDOWWIDTH, WINDOWHEIGHT}))); ASSERT_TRUE(SUCCEEDED(angleVis->put_Size(
{static_cast<FLOAT>(WINDOWWIDTH), static_cast<FLOAT>(WINDOWHEIGHT)})));
ASSERT_TRUE(SUCCEEDED(angleVis->put_Offset({0, 0, 0}))); ASSERT_TRUE(SUCCEEDED(angleVis->put_Offset({0, 0, 0})));
......
...@@ -112,15 +112,15 @@ class CopyTextureTest : public ANGLETest ...@@ -112,15 +112,15 @@ class CopyTextureTest : public ANGLETest
float alpha = color.A / 255.0f; float alpha = color.A / 255.0f;
if (premultiplyAlpha) if (premultiplyAlpha)
{ {
color.R *= alpha; color.R = static_cast<GLubyte>(static_cast<float>(color.R) * alpha);
color.G *= alpha; color.G = static_cast<GLubyte>(static_cast<float>(color.G) * alpha);
color.B *= alpha; color.B = static_cast<GLubyte>(static_cast<float>(color.B) * alpha);
} }
else if (unmultiplyAlpha && color.A != 0) else if (unmultiplyAlpha && color.A != 0)
{ {
color.R /= alpha; color.R = static_cast<GLubyte>(static_cast<float>(color.R) / alpha);
color.G /= alpha; color.G = static_cast<GLubyte>(static_cast<float>(color.G) / alpha);
color.B /= alpha; color.B = static_cast<GLubyte>(static_cast<float>(color.B) / alpha);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment