Bug 1690349 - Prepare for angle update for ff87. r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D103955
This commit is contained in:
Jeff Gilbert 2021-02-05 02:14:04 +00:00
Родитель cc417af149
Коммит 492754c3bd
3 изменённых файлов: 69 добавлений и 165 удалений

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

@ -1 +1 @@
chromium/3865
chromium/4324

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

@ -1,4 +1,5 @@
AllowCompilerWarnings()
if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
CXXFLAGS += [
'-Wno-final-dtor-non-final-class',
@ -6,8 +7,24 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
'-Wno-range-loop-construct',
]
if CONFIG['INTEL_ARCHITECTURE']:
CXXFLAGS += CONFIG['SSE2_FLAGS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['ANGLE_IS_WIN'] = True
# ANGLE wants NTDDI_WIN10_VB, but:
# > /builds/worker/checkouts/gecko/vs2017_15.8.4/SDK/include/10.0.17134.0/winrt/wrl/def.h(48,2):
# > #error WRL requires NTDDI_VERSION to be #defined at least to NTDDI_VISTA or greater
DEFINES['NTDDI_VERSION'] = 'NTDDI_WIN10_RS2'
if CONFIG['INTEL_ARCHITECTURE']:
DEFINES['X86_WINDOWS'] = True
else:
DEFINES['ANGLE_PLATFORM_EXPORT'] = ''
DEFINES['__NDK_FPABI__'] = ''
DEFINES['ANGLE_SKIP_DXGI_1_2_CHECK'] = True
DEFINES['ANGLE_ENABLE_KEYEDMUTEX'] = True
DEFINES['ANGLE_TRANSLATOR_ESSL_ONLY'] = True

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

@ -152,10 +152,12 @@ GN_ARGS = b"""
# See "gn args <out_dir> --list" for available build arguments.
is_clang = true
is_debug = false
angle_build_all = false
angle_enable_abseil = false
angle_enable_gl = false
angle_enable_gl_null = false
angle_enable_null = false
angle_enable_vulkan = false
use_custom_libcxx = false
"""[
1:
]
@ -169,11 +171,10 @@ except subprocess.CalledProcessError:
exit(1)
p = run_checked(
"gn",
"desc",
"--format=json",
"py",
"scripts/export_targets.py",
str(OUT_DIR),
"*",
*ROOTS,
stdout=subprocess.PIPE,
shell=True,
env=GN_ENV,
@ -182,162 +183,29 @@ p = run_checked(
# -
print("\nProcessing graph")
descs = json.loads(p.stdout.decode())
libraries = json.loads(p.stdout.decode())
# -
# HACKHACKHACK: Inject linux/mac sources instead of trying to merge graphs of different
# platforms.
descs["//:angle_common"]["sources"] += [
# descs["//:angle_common"]["sources"] +=
EXTRA_ANGLE_COMMON_SOURCES = [
"//src/common/system_utils_linux.cpp",
"//src/common/system_utils_mac.cpp",
"//src/common/system_utils_posix.cpp",
]
# Ready to traverse
# ------------------------------------------------------------------------------
LIBRARY_TYPES = ("shared_library", "static_library")
def flattened_target(target_name: str, descs: dict, stop_at_lib: bool = True) -> dict:
flattened = dict(descs[target_name])
EXPECTED_TYPES = LIBRARY_TYPES + ("source_set", "group", "action")
def pre(k):
dep = descs[k]
dep_type = dep["type"]
deps = dep["deps"]
if stop_at_lib and dep_type in LIBRARY_TYPES:
return ((),)
if dep_type == "copy":
assert not deps, (target_name, dep["deps"])
else:
assert dep_type in EXPECTED_TYPES, (k, dep_type)
for (k, v) in dep.items():
if type(v) in (list, tuple):
flattened[k] = flattened.get(k, []) + v
else:
# flattened.setdefault(k, v)
pass
return (deps,)
dag_traverse(descs[target_name]["deps"], pre)
return flattened
# ------------------------------------------------------------------------------
# Check that includes are valid. (gn's version of this check doesn't seem to work!)
INCLUDE_REGEX = re.compile(b'(?:^|\\n) *# *include +([<"])([^>"]+)[>"]')
assert INCLUDE_REGEX.match(b'#include "foo"')
assert INCLUDE_REGEX.match(b'\n#include "foo"')
IGNORED_INCLUDES = {
b"compiler/translator/TranslatorVulkan.h",
b"libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h",
b"libANGLE/renderer/gl/glx/DisplayGLX.h",
b"libANGLE/renderer/gl/cgl/DisplayCGL.h",
b"libANGLE/renderer/gl/egl/ozone/DisplayOzone.h",
b"libANGLE/renderer/gl/egl/android/DisplayAndroid.h",
b"libANGLE/renderer/gl/wgl/DisplayWGL.h",
b"libANGLE/renderer/null/DisplayNULL.h",
b"libANGLE/renderer/vulkan/android/DisplayVkAndroid.h",
b"libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h",
b"libANGLE/renderer/vulkan/win32/DisplayVkWin32.h",
b"libANGLE/renderer/vulkan/xcb/DisplayVkXcb.h",
b"kernel/image.h",
}
IGNORED_INCLUDE_PREFIXES = {
b"android",
b"Carbon",
b"CoreFoundation",
b"CoreServices",
b"IOSurface",
b"mach",
b"mach-o",
b"OpenGL",
b"pci",
b"sys",
b"wrl",
b"X11",
}
def has_all_includes(target_name: str, descs: dict) -> bool:
flat = flattened_target(target_name, descs, stop_at_lib=False)
acceptable_sources = flat.get("sources", []) + flat.get("outputs", [])
acceptable_sources = (x.rsplit("/", 1)[-1].encode() for x in acceptable_sources)
acceptable_sources = set(acceptable_sources)
ret = True
desc = descs[target_name]
for cur_file in desc.get("sources", []):
assert cur_file.startswith("/"), cur_file
if not cur_file.startswith("//"):
continue
cur_file = pathlib.Path(cur_file[2:])
text = cur_file.read_bytes()
for m in INCLUDE_REGEX.finditer(text):
if m.group(1) == b"<":
continue
include = m.group(2)
if include in IGNORED_INCLUDES:
continue
try:
(prefix, _) = include.split(b"/", 1)
if prefix in IGNORED_INCLUDE_PREFIXES:
continue
except ValueError:
pass
include_file = include.rsplit(b"/", 1)[-1]
if include_file not in acceptable_sources:
# print(' acceptable_sources:')
# for x in sorted(acceptable_sources):
# print(' ', x)
print(
"Warning in {}: {}: Invalid include: {}".format(
target_name, cur_file, include
)
)
ret = False
# print('Looks valid:', m.group())
continue
return ret
angle_common = libraries["//:angle_common"]
angle_common["sources"] += EXTRA_ANGLE_COMMON_SOURCES
angle_common["sources"] = sorted(angle_common["sources"])
# -
# Gather real targets:
def gather_libraries(roots: Sequence[str], descs: dict) -> Set[str]:
libraries = set()
def fn(target_name):
cur = descs[target_name]
print(" " + cur["type"], target_name)
assert has_all_includes(target_name, descs), target_name
if cur["type"] in ("shared_library", "static_library"):
libraries.add(target_name)
return (cur["deps"],)
dag_traverse(roots, fn)
return libraries
# Reuse our own zlib
del libraries["//third_party/zlib:zlib"]
# -
libraries = gather_libraries(ROOTS, descs)
print(f"\n{len(libraries)} libraries:")
for k in libraries:
print(" ", k)
if CHECK_ONLY:
print("\n--check complete.")
exit(0)
@ -370,6 +238,7 @@ def append_arr(dest, name, vals, indent=0):
REGISTERED_DEFINES = {
"ADLER32_SIMD_SSSE3": False,
"ANGLE_CAPTURE_ENABLED": True,
"ANGLE_EGL_LIBRARY_NAME": False,
"ANGLE_ENABLE_D3D11": True,
@ -384,11 +253,14 @@ REGISTERED_DEFINES = {
"ANGLE_GENERATE_SHADER_DEBUG_INFO": True,
"ANGLE_GLESV2_LIBRARY_NAME": True,
"ANGLE_IS_64_BIT_CPU": False,
"ANGLE_IS_WIN": False,
"ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES": False,
"ANGLE_USE_EGL_LOADER": True,
"CERT_CHAIN_PARA_HAS_EXTRA_FIELDS": False,
"CHROMIUM_BUILD": False,
"COMPONENT_BUILD": False,
"CRC32_SIMD_SSE42_PCLMUL": False,
"DEFLATE_FILL_WINDOW_SSE2": False,
"DYNAMIC_ANNOTATIONS_ENABLED": True,
"EGL_EGL_PROTOTYPES": True,
"EGL_EGLEXT_PROTOTYPES": True,
@ -400,19 +272,22 @@ REGISTERED_DEFINES = {
"GL_GLES_PROTOTYPES": True,
"GL_GLEXT_PROTOTYPES": True,
"GPU_INFO_USE_SETUPAPI": True,
"INFLATE_CHUNK_READ_64LE": False,
"INFLATE_CHUNK_SIMD_SSE2": False,
"LIBANGLE_IMPLEMENTATION": True,
"LIBEGL_IMPLEMENTATION": True,
"LIBGLESV2_IMPLEMENTATION": True,
"NOMINMAX": True,
"NO_TCMALLOC": False,
# Else: gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp(89): error C2787: 'IDCompositionDevice': no GUID has been associated with this object
"NTDDI_VERSION": True,
"NTDDI_VERSION": False,
"PSAPI_VERSION": False,
"SAFE_BROWSING_CSD": False,
"SAFE_BROWSING_DB_LOCAL": False,
"UNICODE": True,
"USE_AURA": False,
"V8_DEPRECATION_WARNINGS": False,
"VK_USE_PLATFORM_WIN32_KHR": False,
"WIN32": False,
"WIN32_LEAN_AND_MEAN": False,
"WINAPI_FAMILY": False,
@ -425,7 +300,11 @@ REGISTERED_DEFINES = {
# _In_ const POINTER_INFO& pointerInfo
# ^
"WTF_USE_DYNAMIC_ANNOTATIONS": False,
"X86_WINDOWS": False,
"ZLIB_IMPLEMENTATION": True,
"_ATL_NO_OPENGL": True,
"_CRT_NONSTDC_NO_DEPRECATE": True,
"_CRT_NONSTDC_NO_WARNINGS": True,
"_CRT_RAND_S": True,
"_CRT_SECURE_NO_DEPRECATE": True,
"_DEBUG": False,
@ -450,8 +329,8 @@ REGISTERED_DEFINES = {
print("\nRun actions")
required_files: Set[str] = set()
run_checked("ninja", "-C", str(OUT_DIR), ":commit_id")
required_files |= set(descs["//:commit_id"]["outputs"])
run_checked("ninja", "-C", str(OUT_DIR), ":angle_commit_id")
required_files.add("//out/gen/angle/angle_commit.h")
# -
@ -469,13 +348,17 @@ checkout_dir.mkdir(exist_ok=True)
# -
RE_TARGET_NAME = re.compile('//(.*):(.+)')
def export_target(target_name) -> Set[str]:
# print(' ', target_name)
def export_target(target_full_name) -> Set[str]:
#print(' ', target_full_name)
descs = libraries
desc = descs[target_name]
flat = flattened_target(target_name, descs)
assert target_name.startswith("//:"), target_name
name = target_name[3:]
flat = desc
m = RE_TARGET_NAME.match(target_name)
assert m, target_name
name = m.group(2)
required_files: Set[str] = set(flat["sources"])
@ -495,13 +378,15 @@ def export_target(target_name) -> Set[str]:
v = f'"{v}"'
except ValueError:
(k, v) = (x, "True")
line = f'DEFINES["{k}"] = {v}'
try:
line = f'DEFINES["{k}"] = {v}'
if REGISTERED_DEFINES[k] == False:
line = "# " + line
lines.append(line)
except KeyError:
print(f"[{name}] Unrecognized define: {k}")
line = "# Unrecognized: " + line
lines.append(line)
lines.append("")
cxxflags = set(desc["cflags"] + desc["cflags_cc"])
@ -516,10 +401,10 @@ def export_target(target_name) -> Set[str]:
for x in fixup_paths(flat["sources"]):
# print(' '*5, x)
(b, e) = x.rsplit(".", 1)
if e in ["h", "y", "l", "inc", "inl"]:
if e in ["h", "hpp", "y", "l", "inc", "inl"]:
continue
elif e in ["cpp", "cc", "c"]:
if b.endswith("_win"):
if b.endswith("_win") or b.endswith("_win32"):
config = 'CONFIG["OS_ARCH"] == "WINNT"'
elif b.endswith("_linux"):
# Include these on BSDs too.
@ -584,14 +469,16 @@ def export_target(target_name) -> Set[str]:
append_arr(lines, "SOURCES", v, indent=indent)
dep_libs: Set[str] = set()
for dep_name in set(flat["deps"]):
dep = descs[dep_name]
if dep["type"] in LIBRARY_TYPES:
assert dep_name.startswith("//:"), dep_name
dep_libs.add(dep_name[3:])
for dep_full_name in set(flat["dep_libs"]):
assert dep_full_name.startswith("//"), dep_name
(_, dep_name) = dep_full_name.split(':')
dep_libs.add(dep_name)
dep_dirs = set(dep_libs)
dep_dirs.discard("zlib")
append_arr(lines, "USE_LIBS", dep_libs)
append_arr(lines, "DIRS", ["../" + x for x in dep_libs])
append_arr(lines, "DIRS", ["../" + x for x in dep_dirs])
append_arr(lines, "OS_LIBS", os_libs)
append_arr_commented(lines, "LDFLAGS", ldflags)