gn2bp: Add cflags to arch
Test: m cronet_aml_third_party_protobuf_protoc Change-Id: Iea847d205fd258ae00ba1ff03e382798deb2f0a8
This commit is contained in:
@@ -6739,7 +6739,6 @@ cc_binary {
|
||||
"third_party/protobuf/src/",
|
||||
"build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
|
||||
"build/linux/debian_bullseye_amd64-sysroot/usr/include",
|
||||
"third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
|
||||
],
|
||||
cpp_std: "c++20",
|
||||
cppflags: [
|
||||
|
||||
@@ -97,6 +97,7 @@ class GnParser(object):
|
||||
"""
|
||||
def __init__(self):
|
||||
self.sources = set()
|
||||
self.cflags = set()
|
||||
|
||||
|
||||
def __init__(self, name, type):
|
||||
@@ -174,12 +175,16 @@ class GnParser(object):
|
||||
indent=4,
|
||||
sort_keys=True)
|
||||
|
||||
def update(self, other):
|
||||
def update(self, other, arch):
|
||||
for key in ('cflags', 'defines', 'deps', 'include_dirs', 'ldflags',
|
||||
'source_set_deps', 'proto_deps', 'transitive_proto_deps',
|
||||
'libs', 'proto_paths'):
|
||||
self.__dict__[key].update(other.__dict__.get(key, []))
|
||||
|
||||
for key_in_arch in ('cflags',):
|
||||
self.arch[arch].__dict__[key_in_arch].update(
|
||||
other.arch[arch].__dict__.get(key_in_arch, []))
|
||||
|
||||
def finalize(self):
|
||||
"""Move common properties out of arch-dependent subobjects to Target object.
|
||||
|
||||
@@ -196,6 +201,10 @@ class GnParser(object):
|
||||
for arch in self.arch.keys():
|
||||
self.arch[arch].sources -= self.sources
|
||||
|
||||
# TODO: Keep cflags per arch
|
||||
for arch_value in self.arch.values():
|
||||
self.cflags = self.cflags.union(arch_value.cflags)
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.all_targets = {}
|
||||
@@ -317,7 +326,7 @@ class GnParser(object):
|
||||
public_headers = [x for x in desc.get('public', []) if x != '*']
|
||||
target.public_headers.update(public_headers)
|
||||
|
||||
target.cflags.update(desc.get('cflags', []) + desc.get('cflags_cc', []))
|
||||
target.arch[arch].cflags.update(desc.get('cflags', []) + desc.get('cflags_cc', []))
|
||||
target.libs.update(desc.get('libs', []))
|
||||
target.ldflags.update(desc.get('ldflags', []))
|
||||
target.defines.update(desc.get('defines', []))
|
||||
@@ -335,9 +344,9 @@ class GnParser(object):
|
||||
target.transitive_proto_deps.update(dep.transitive_proto_deps)
|
||||
elif dep.type == 'source_set':
|
||||
target.source_set_deps.add(dep.name)
|
||||
target.update(dep) # Bubble up source set's cflags/ldflags etc.
|
||||
target.update(dep, arch) # Bubble up source set's cflags/ldflags etc.
|
||||
elif dep.type == 'group':
|
||||
target.update(dep) # Bubble up groups's cflags/ldflags etc.
|
||||
target.update(dep, arch) # Bubble up groups's cflags/ldflags etc.
|
||||
elif dep.type in ['action', 'action_foreach', 'copy']:
|
||||
if proto_target_type is None:
|
||||
target.deps.add(dep.name)
|
||||
|
||||
Reference in New Issue
Block a user