Add a MetaPlatformInfo.
A metaplatform allow to regroup sereval platform together. When a target is added to the platform, the target is dispatched/add to all sub platforms. As the step (metaplatformName, target) is not really added, we have to track which steps are really added, so `add_targets` need to return the list of added targets.
This commit is contained in:
parent
3eae47240b
commit
74ba5885a0
|
@ -18,17 +18,18 @@ class Builder:
|
||||||
PlatformInfo.get_platform('neutral', self._targets)
|
PlatformInfo.get_platform('neutral', self._targets)
|
||||||
|
|
||||||
platform = PlatformInfo.get_platform(option('target_platform'), self._targets)
|
platform = PlatformInfo.get_platform(option('target_platform'), self._targets)
|
||||||
platform.add_targets(option('targets'), self._targets)
|
self.targetDefs = platform.add_targets(option('targets'), self._targets)
|
||||||
|
|
||||||
def finalize_target_steps(self):
|
def finalize_target_steps(self):
|
||||||
targetDef = (option('target_platform'), option('targets'))
|
steps = []
|
||||||
dependencies = self.order_steps(targetDef)
|
for targetDef in self.targetDefs:
|
||||||
dependencies = list(remove_duplicates(dependencies))
|
steps += self.order_steps(targetDef)
|
||||||
|
steps = list(remove_duplicates(steps))
|
||||||
|
|
||||||
if option('build_nodeps'):
|
if option('build_nodeps'):
|
||||||
add_target_step(targetDef, self._targets[targetDef])
|
add_target_step(targetDef, self._targets[targetDef])
|
||||||
else:
|
else:
|
||||||
for dep in dependencies:
|
for dep in steps:
|
||||||
if option('build_deps_only') and dep == targetDef:
|
if option('build_deps_only') and dep == targetDef:
|
||||||
continue
|
continue
|
||||||
add_target_step(dep, self._targets[dep])
|
add_target_step(dep, self._targets[dep])
|
||||||
|
|
|
@ -58,7 +58,7 @@ class PlatformInfo(metaclass=_MetaPlatform):
|
||||||
|
|
||||||
def add_targets(self, targetName, targets):
|
def add_targets(self, targetName, targets):
|
||||||
if (self.name, targetName) in targets:
|
if (self.name, targetName) in targets:
|
||||||
return
|
return []
|
||||||
targetClass = Dependency.all_deps[targetName]
|
targetClass = Dependency.all_deps[targetName]
|
||||||
targets[('source', targetName)] = targetClass.Source
|
targets[('source', targetName)] = targetClass.Source
|
||||||
targets[(self.name, targetName)] = targetClass.Builder
|
targets[(self.name, targetName)] = targetClass.Builder
|
||||||
|
@ -69,6 +69,7 @@ class PlatformInfo(metaclass=_MetaPlatform):
|
||||||
depPlatformName, depName = self.name, dep
|
depPlatformName, depName = self.name, dep
|
||||||
depPlatform = self.get_platform(depPlatformName, targets)
|
depPlatform = self.get_platform(depPlatformName, targets)
|
||||||
depPlatform.add_targets(depName, targets)
|
depPlatform.add_targets(depName, targets)
|
||||||
|
return [(self.name, targetName)]
|
||||||
|
|
||||||
def get_cross_config(self):
|
def get_cross_config(self):
|
||||||
return {}
|
return {}
|
||||||
|
@ -102,3 +103,15 @@ class PlatformInfo(metaclass=_MetaPlatform):
|
||||||
def clean_intermediate_directories(self):
|
def clean_intermediate_directories(self):
|
||||||
self.buildEnv.clean_intermediate_directories()
|
self.buildEnv.clean_intermediate_directories()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MetaPlatformInfo(PlatformInfo):
|
||||||
|
subPlatformNames = []
|
||||||
|
|
||||||
|
def add_targets(self, targetName, targets):
|
||||||
|
targetDefs = []
|
||||||
|
for platformName in self.subPlatformNames:
|
||||||
|
print("radd {}".format(platformName))
|
||||||
|
platform = self.get_platform(platformName, targets)
|
||||||
|
targetDefs += platform.add_targets(targetName, targets)
|
||||||
|
return targetDefs
|
||||||
|
|
Loading…
Reference in New Issue