2016-09-23 20:18:41 +00:00
|
|
|
# Copyright 2016 Google Inc.
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
declare_args() {
|
|
|
|
}
|
|
|
|
|
|
|
|
angle_root = "../externals/angle2"
|
|
|
|
|
2018-08-30 15:30:01 +00:00
|
|
|
import("$angle_root/src/compiler.gni")
|
|
|
|
import("$angle_root/src/libGLESv2.gni")
|
2019-09-26 21:14:07 +00:00
|
|
|
import("../third_party.gni")
|
2016-09-23 20:18:41 +00:00
|
|
|
|
|
|
|
third_party("angle2") {
|
|
|
|
public_include_dirs = [ "$angle_root/include" ]
|
|
|
|
deps = [
|
|
|
|
":libEGL",
|
|
|
|
":libGLESv2",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
config("common") {
|
|
|
|
defines = [
|
|
|
|
"ANGLE_ENABLE_ESSL",
|
|
|
|
"ANGLE_ENABLE_GLSL",
|
2016-10-17 16:34:38 +00:00
|
|
|
"ANGLE_ENABLE_HLSL",
|
2016-10-17 15:51:11 +00:00
|
|
|
"ANGLE_ENABLE_OPENGL",
|
2016-09-23 20:18:41 +00:00
|
|
|
"EGL_EGLEXT_PROTOTYPES",
|
2016-10-17 15:51:11 +00:00
|
|
|
"GL_GLEXT_PROTOTYPES",
|
2016-09-23 20:18:41 +00:00
|
|
|
]
|
|
|
|
include_dirs = [
|
|
|
|
"$root_gen_dir/angle2",
|
|
|
|
"$angle_root/include",
|
|
|
|
"$angle_root/src",
|
2017-06-12 12:40:56 +00:00
|
|
|
"$angle_root/src/common/third_party/base",
|
2016-10-17 15:51:11 +00:00
|
|
|
"$angle_root/src/third_party/khronos",
|
2016-09-23 20:18:41 +00:00
|
|
|
]
|
2017-08-18 15:44:28 +00:00
|
|
|
cflags_cc = []
|
2016-10-17 15:51:11 +00:00
|
|
|
assert(is_linux || is_win) # TODO: is_mac?
|
2016-09-23 20:18:41 +00:00
|
|
|
if (is_linux) {
|
|
|
|
defines += [
|
|
|
|
"ANGLE_USE_X11",
|
|
|
|
"GL_APICALL=__attribute__((visibility(\"default\")))",
|
2018-01-22 22:37:57 +00:00
|
|
|
"GL_API=__attribute__((visibility(\"default\")))",
|
2016-09-23 20:18:41 +00:00
|
|
|
"EGLAPI=__attribute__((visibility(\"default\")))",
|
|
|
|
]
|
2017-08-18 15:44:28 +00:00
|
|
|
cflags_cc += [ "-std=c++14" ]
|
2016-10-17 15:51:11 +00:00
|
|
|
} else if (is_win) {
|
|
|
|
defines += [
|
|
|
|
"ANGLE_ENABLE_D3D11",
|
|
|
|
"ANGLE_ENABLE_D3D9",
|
|
|
|
"GL_APICALL=",
|
2018-01-22 22:37:57 +00:00
|
|
|
"GL_API=",
|
2016-10-17 15:51:11 +00:00
|
|
|
"EGLAPI=",
|
|
|
|
]
|
2017-11-12 18:53:26 +00:00
|
|
|
|
|
|
|
# Allow noexcept, even though we build without exceptions
|
|
|
|
cflags_cc += [ "/wd4577" ]
|
2019-05-07 15:15:29 +00:00
|
|
|
|
2019-12-18 18:56:10 +00:00
|
|
|
# Warnings are just noise if we're not maintaining the code.
|
|
|
|
if (is_win) {
|
|
|
|
cflags = [ "/w" ]
|
|
|
|
} else {
|
|
|
|
cflags = [ "-w" ]
|
2017-12-08 16:33:52 +00:00
|
|
|
}
|
2016-09-23 20:18:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-25 19:14:45 +00:00
|
|
|
commit_id_output_file = "$root_gen_dir/angle2/commit.h"
|
|
|
|
action("commit_id") {
|
|
|
|
script = "$angle_root/src/commit_id.py"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs = [ commit_id_output_file ]
|
2020-02-25 19:14:45 +00:00
|
|
|
|
2020-03-02 19:10:34 +00:00
|
|
|
# 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
|
2020-04-01 18:47:34 +00:00
|
|
|
inputs = [ "$angle_root/.git/HEAD" ]
|
2020-03-02 19:10:34 +00:00
|
|
|
}
|
|
|
|
|
2020-02-25 19:14:45 +00:00
|
|
|
args = [
|
|
|
|
"gen",
|
|
|
|
rebase_path(commit_id_output_file, root_build_dir),
|
2016-09-23 20:18:41 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
shared_library("libGLESv2") {
|
|
|
|
configs += [ ":common" ]
|
2016-10-17 15:51:11 +00:00
|
|
|
configs -= [ "//gn:warnings" ]
|
2016-10-17 16:34:38 +00:00
|
|
|
defines = [
|
|
|
|
"LIBANGLE_IMPLEMENTATION",
|
|
|
|
"LIBGLESV2_IMPLEMENTATION",
|
|
|
|
]
|
2020-06-17 19:27:07 +00:00
|
|
|
deps = [
|
|
|
|
":commit_id",
|
|
|
|
"../zlib:compression_utils_portable",
|
|
|
|
]
|
2016-09-23 20:18:41 +00:00
|
|
|
libs = []
|
2019-08-01 04:01:19 +00:00
|
|
|
sources =
|
|
|
|
rebase_path(
|
2018-08-30 15:30:01 +00:00
|
|
|
angle_preprocessor_sources + angle_translator_sources +
|
|
|
|
angle_translator_essl_sources + angle_translator_glsl_sources +
|
|
|
|
angle_translator_hlsl_sources + libangle_sources +
|
2020-06-17 19:27:07 +00:00
|
|
|
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,
|
2016-10-17 15:51:11 +00:00
|
|
|
".",
|
2019-09-23 13:29:10 +00:00
|
|
|
angle_root) + [ "$angle_root/src/libANGLE/FrameCapture_mock.cpp" ]
|
2018-05-15 14:43:08 +00:00
|
|
|
if (is_win) {
|
|
|
|
sources += [ "$angle_root/src/libGLESv2/libGLESv2_autogen.def" ]
|
2016-09-23 20:18:41 +00:00
|
|
|
}
|
|
|
|
if (is_linux) {
|
|
|
|
libs += [
|
|
|
|
"X11",
|
|
|
|
"Xi",
|
|
|
|
"Xext",
|
|
|
|
]
|
2020-06-17 19:27:07 +00:00
|
|
|
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" ]
|
2016-10-17 15:51:11 +00:00
|
|
|
} else if (is_win) {
|
|
|
|
defines += [
|
|
|
|
# TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
|
|
|
|
]
|
2020-07-23 14:16:10 +00:00
|
|
|
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)
|
2016-10-17 15:51:11 +00:00
|
|
|
libs += [
|
|
|
|
"d3d9.lib",
|
2019-10-10 12:43:25 +00:00
|
|
|
"dxgi.lib",
|
2016-10-17 15:51:11 +00:00
|
|
|
"dxguid.lib",
|
2016-10-17 16:34:38 +00:00
|
|
|
"gdi32.lib",
|
|
|
|
"user32.lib",
|
2016-10-17 15:51:11 +00:00
|
|
|
]
|
|
|
|
deps += [
|
|
|
|
# TODO: copy_compiler_dll?
|
|
|
|
]
|
2016-09-23 20:18:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
shared_library("libEGL") {
|
|
|
|
configs += [ ":common" ]
|
2016-10-17 15:51:11 +00:00
|
|
|
configs -= [ "//gn:warnings" ]
|
2016-09-23 20:18:41 +00:00
|
|
|
defines = [ "LIBEGL_IMPLEMENTATION" ]
|
2020-04-01 18:47:34 +00:00
|
|
|
deps = [ ":libGLESv2" ]
|
2018-08-30 20:40:55 +00:00
|
|
|
sources = rebase_path(libegl_sources, ".", angle_root)
|
2018-05-15 14:43:08 +00:00
|
|
|
if (is_win) {
|
|
|
|
sources += [ "$angle_root/src/libEGL/libEGL.def" ]
|
2016-09-23 20:18:41 +00:00
|
|
|
}
|
|
|
|
}
|