Port to ANGLE's GN files

Bug: skia:7647
Change-Id: Ic4709817804610783de8ff3d9eaa32f57fb72729
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313316
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Jamie Madill 2020-08-29 10:46:13 -04:00 committed by Skia Commit-Bot
parent ab5010493d
commit f1003a7758
3 changed files with 18 additions and 154 deletions

10
build_overrides/angle.gni Normal file
View File

@ -0,0 +1,10 @@
angle_root = "//third_party/externals/angle2"
angle_zlib_compression_utils_dir = "//third_party/zlib"
# We don't have Chromium's build/ or testing/ directories.
angle_has_build = false
# Bunch of features ANGLE's build files test for that we never set.
is_cfi = false
is_chromecast = false
is_chromeos = false

View File

@ -6,158 +6,9 @@
declare_args() {
}
angle_root = "../externals/angle2"
import("$angle_root/src/compiler.gni")
import("$angle_root/src/libGLESv2.gni")
import("../third_party.gni")
third_party("angle2") {
public_include_dirs = [ "$angle_root/include" ]
deps = [
":libEGL",
":libGLESv2",
group("angle2") {
public_deps = [
"//third_party/externals/angle2:libEGL",
"//third_party/externals/angle2:libGLESv2",
]
}
config("common") {
defines = [
"ANGLE_ENABLE_ESSL",
"ANGLE_ENABLE_GLSL",
"ANGLE_ENABLE_HLSL",
"ANGLE_ENABLE_OPENGL",
"EGL_EGLEXT_PROTOTYPES",
"GL_GLEXT_PROTOTYPES",
]
include_dirs = [
"$root_gen_dir/angle2",
"$angle_root/include",
"$angle_root/src",
"$angle_root/src/common/third_party/base",
"$angle_root/src/third_party/khronos",
]
cflags_cc = []
assert(is_linux || is_win) # TODO: is_mac?
if (is_linux) {
defines += [
"ANGLE_USE_X11",
"GL_APICALL=__attribute__((visibility(\"default\")))",
"GL_API=__attribute__((visibility(\"default\")))",
"EGLAPI=__attribute__((visibility(\"default\")))",
]
cflags_cc += [ "-std=c++14" ]
} else if (is_win) {
defines += [
"ANGLE_ENABLE_D3D11",
"ANGLE_ENABLE_D3D9",
"GL_APICALL=",
"GL_API=",
"EGLAPI=",
]
# Allow noexcept, even though we build without exceptions
cflags_cc += [ "/wd4577" ]
# Warnings are just noise if we're not maintaining the code.
if (is_win) {
cflags = [ "/w" ]
} else {
cflags = [ "-w" ]
}
}
}
commit_id_output_file = "$root_gen_dir/angle2/commit.h"
action("commit_id") {
script = "$angle_root/src/commit_id.py"
outputs = [ commit_id_output_file ]
# Add ANGLE git as a dependency if it is available.
angle_git_is_present =
exec_script("$angle_root/src/commit_id.py", [ "check" ], "value") == 1
if (angle_git_is_present) {
# commit id should depend on angle's HEAD revision
inputs = [ "$angle_root/.git/HEAD" ]
}
args = [
"gen",
rebase_path(commit_id_output_file, root_build_dir),
]
}
shared_library("libGLESv2") {
configs += [ ":common" ]
configs -= [ "//gn:warnings" ]
defines = [
"LIBANGLE_IMPLEMENTATION",
"LIBGLESV2_IMPLEMENTATION",
]
deps = [
":commit_id",
"../zlib:compression_utils_portable",
]
libs = []
sources =
rebase_path(
angle_preprocessor_sources + angle_translator_sources +
angle_translator_essl_sources + angle_translator_glsl_sources +
angle_translator_hlsl_sources + libangle_sources +
libangle_gpu_info_util_sources + libangle_headers +
libangle_common_sources + libangle_image_util_sources +
libglesv2_sources + libangle_gl_sources +
angle_system_utils_sources + xxhash_sources,
".",
angle_root) + [ "$angle_root/src/libANGLE/FrameCapture_mock.cpp" ]
if (is_win) {
sources += [ "$angle_root/src/libGLESv2/libGLESv2_autogen.def" ]
}
if (is_linux) {
libs += [
"X11",
"Xi",
"Xext",
]
defines += [ "GPU_INFO_USE_X11" ]
sources +=
rebase_path(
libangle_gl_glx_sources + libangle_gl_egl_sources +
libangle_gpu_info_util_linux_sources +
libangle_gpu_info_util_x11_sources + libangle_gl_egl_dl_sources,
".",
angle_root) + [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ]
} else if (is_win) {
defines += [
# TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
]
sources += rebase_path(
libangle_gl_wgl_sources + libangle_d3d_shared_sources +
libangle_d3d9_sources + libangle_d3d11_sources +
libangle_d3d11_win32_sources +
libangle_gl_wgl_d3d11_common_sources +
libangle_gpu_info_util_win_sources + libangle_d3d_win32_sources,
".",
angle_root)
libs += [
"d3d9.lib",
"dxgi.lib",
"dxguid.lib",
"gdi32.lib",
"user32.lib",
]
deps += [
# TODO: copy_compiler_dll?
]
}
}
shared_library("libEGL") {
configs += [ ":common" ]
configs -= [ "//gn:warnings" ]
defines = [ "LIBEGL_IMPLEMENTATION" ]
deps = [ ":libGLESv2" ]
sources = rebase_path(libegl_sources, ".", angle_root)
if (is_win) {
sources += [ "$angle_root/src/libEGL/libEGL.def" ]
}
}

View File

@ -193,8 +193,11 @@ if (skia_use_system_zlib) {
}
}
config("zlib_config") {
}
third_party("compression_utils_portable") {
visibility = [ "//third_party/angle2:*" ]
visibility = [ "//third_party/externals/angle2:*" ]
public_include_dirs = [ "../externals/zlib/google" ]
sources = [
"../externals/zlib/google/compression_utils_portable.cc",