Merge changes I55f2bdea,Ic9901bd1 am: d73bdc3bb8 am: c7394b3481 am: 2c62370430 am: 1ba094a78c
Original change: https://android-review.googlesource.com/c/platform/external/webrtc/+/2456191 Change-Id: Icdb65503869e0a4858b104f2da5f53e5e00245d6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
19597
Android.bp
19597
Android.bp
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
PRINT_ORIGINAL_FULL = False
|
||||
|
||||
# This flags are augmented with flags added to the json files but not present in .gn or .gni files
|
||||
IGNORED_FLAGS = [
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
@ -89,7 +91,9 @@ DEFAULT_CFLAGS_BY_ARCH = {
|
||||
'x64': ['-msse2', '-mavx2', '-mfma', '-DHAVE_ARM64_CRC32C=0'],
|
||||
'arm': ['-DWEBRTC_HAS_NEON', '-DWEBRTC_ARCH_ARM_V7', '-DWEBRTC_ARCH_ARM', '-mfpu=neon', '-mthumb', '-DHAVE_ARM64_CRC32C=0'],
|
||||
'arm64': ['-DWEBRTC_HAS_NEON', '-DWEBRTC_ARCH_ARM64', '-DHAVE_ARM64_CRC32C=0'],
|
||||
'riscv64': ['-DHAVE_ARM64_CRC32C=0'],
|
||||
}
|
||||
FLAGS = ['cflags', 'cflags_c', 'cflags_cc', 'asmflags']
|
||||
|
||||
ARCH_NAME_MAP = {n: n for n in DEFAULT_CFLAGS_BY_ARCH.keys()}
|
||||
ARCH_NAME_MAP['x64'] = 'x86_64'
|
||||
@ -179,12 +183,7 @@ def PrintHeader():
|
||||
print('}')
|
||||
|
||||
def GatherDefaultFlags(targets):
|
||||
default = {
|
||||
'cflags' : [],
|
||||
'cflags_c' : [],
|
||||
'cflags_cc' : [],
|
||||
'asmflags' : [],
|
||||
}
|
||||
default = { f: [] for f in FLAGS}
|
||||
arch = {a: {} for a in ARCHS}
|
||||
|
||||
first = True
|
||||
@ -654,6 +653,32 @@ def MergeAll(targets_by_arch):
|
||||
|
||||
return targets
|
||||
|
||||
def GatherAllFlags(obj):
|
||||
if type(obj) != type({}):
|
||||
# not a dictionary
|
||||
return set()
|
||||
ret = set()
|
||||
for f in FLAGS:
|
||||
ret |= set(obj.get(f, []))
|
||||
for v in obj.values():
|
||||
ret |= GatherAllFlags(v)
|
||||
return ret
|
||||
|
||||
def FilterFlagsInUse(flags, directory):
|
||||
unused = []
|
||||
for f in flags:
|
||||
nf = f
|
||||
if nf.startswith("-D"):
|
||||
nf = nf[2:]
|
||||
i = nf.find('=')
|
||||
if i > 0:
|
||||
nf = nf[:i]
|
||||
c = os.system(f"find {directory} -name '*.gn*' | xargs grep -q -s -e '{nf}'")
|
||||
if c != 0:
|
||||
# couldn't find the flag in *.gn or *.gni
|
||||
unused.append(f)
|
||||
return unused
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print('wrong number of arguments', file = sys.stderr)
|
||||
exit(1)
|
||||
@ -661,10 +686,15 @@ if len(sys.argv) != 2:
|
||||
dir = sys.argv[1]
|
||||
|
||||
targets_by_arch = {}
|
||||
flags = set()
|
||||
for arch in ARCHS:
|
||||
path = "{0}/project_{1}.json".format(dir, arch)
|
||||
json_file = open(path, 'r')
|
||||
targets_by_arch[arch] = Preprocess(json.load(json_file))
|
||||
flags |= GatherAllFlags(targets_by_arch[arch])
|
||||
|
||||
unusedFlags = FilterFlagsInUse(flags, f"{dir}/..")
|
||||
IGNORED_FLAGS = sorted(set(IGNORED_FLAGS) | set(unusedFlags))
|
||||
|
||||
targets = MergeAll(targets_by_arch)
|
||||
|
||||
|
||||
52027
android_tools/project_riscv64.json
Normal file
52027
android_tools/project_riscv64.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user