Create the associated platform at demand.
This commit is contained in:
parent
daad1c98c6
commit
41d23b6249
|
@ -14,14 +14,6 @@ from . import _global
|
|||
|
||||
class Builder:
|
||||
def __init__(self):
|
||||
platformClass = PlatformInfo.all_platforms[option('target_platform')]
|
||||
if neutralEnv('distname') not in platformClass.compatible_hosts:
|
||||
print(('ERROR: The target platform {} cannot be build on host {}.\n'
|
||||
'Select another target platform, or change your host system.'
|
||||
).format(option('target_platform'), self.distname))
|
||||
sys.exit(-1)
|
||||
self.platform = platform = platformClass()
|
||||
|
||||
_targets = {}
|
||||
targetDef = (option('target_platform'), option('targets'))
|
||||
self.add_targets(targetDef, _targets)
|
||||
|
@ -40,7 +32,7 @@ class Builder:
|
|||
if targetDef in targets:
|
||||
return
|
||||
targetPlatformName, targetName = targetDef
|
||||
targetPlatform = PlatformInfo.all_platforms[targetPlatformName]
|
||||
targetPlatform = PlatformInfo.get_platform(targetPlatformName)
|
||||
targetClass = Dependency.all_deps[targetName]
|
||||
targets[('source', targetName)] = targetClass.Source
|
||||
targets[targetDef] = targetClass.Builder
|
||||
|
@ -58,7 +50,7 @@ class Builder:
|
|||
# build step two lines later.
|
||||
return
|
||||
target = _targets[targetDef]
|
||||
targetPlatform = PlatformInfo.all_platforms[targetPlatformName]
|
||||
targetPlatform = PlatformInfo.get_platform(targetPlatformName)
|
||||
yield ('source', targetName)
|
||||
for dep in target.get_dependencies(targetPlatform):
|
||||
try:
|
||||
|
@ -100,7 +92,7 @@ class Builder:
|
|||
if tlbuilderDef[0] == 'neutral':
|
||||
env = _global._neutralEnv
|
||||
else:
|
||||
env = PlatformInfo.all_running_platforms[tlbuilderDef[0]].buildEnv
|
||||
env = PlatformInfo.get_platform(tlbuilderDef[0]).buildEnv
|
||||
builder = get_plt_step(tlbuilderDef)(toolchainClass, source, env)
|
||||
add_plt_step(tlbuilderDef, builder)
|
||||
builder.build()
|
||||
|
@ -110,7 +102,7 @@ class Builder:
|
|||
for builderDef in builderDefs:
|
||||
depClass = Dependency.all_deps[builderDef[1]]
|
||||
source = get_target_step(builderDef[1], 'source')
|
||||
env = PlatformInfo.all_running_platforms[builderDef[0]].buildEnv
|
||||
env = PlatformInfo.get_platform(builderDef[0]).buildEnv
|
||||
builder = get_target_step(builderDef)(depClass, source, env)
|
||||
if option('make_dist') and builderDef[1] == option('targets'):
|
||||
print("make dist {}:".format(builder.name))
|
||||
|
@ -126,9 +118,11 @@ class Builder:
|
|||
print("[SETUP PLATFORMS]")
|
||||
self.prepare_toolchain_sources()
|
||||
self.build_toolchains()
|
||||
self.platform.finalize_setup()
|
||||
for platform in PlatformInfo.all_running_platforms.values():
|
||||
platform.finalize_setup()
|
||||
print("[INSTALL PACKAGES]")
|
||||
self.platform.install_packages()
|
||||
for platform in PlatformInfo.all_running_platforms.values():
|
||||
platform.install_packages()
|
||||
print("[PREPARE]")
|
||||
self.prepare_sources()
|
||||
print("[BUILD]")
|
||||
|
@ -136,7 +130,8 @@ class Builder:
|
|||
# No error, clean intermediate file at end of build if needed.
|
||||
print("[CLEAN]")
|
||||
if option('clean_at_end'):
|
||||
self.platform.clean_intermediate_directories()
|
||||
for platform in PlatformInfo.all_running_platforms.values():
|
||||
platform.clean_intermediate_directories()
|
||||
else:
|
||||
print("SKIP")
|
||||
except StopBuild:
|
||||
|
|
|
@ -27,7 +27,18 @@ class PlatformInfo(metaclass=_MetaPlatform):
|
|||
toolchain_names = []
|
||||
configure_option = ""
|
||||
|
||||
@classmethod
|
||||
def get_platform(cls, name):
|
||||
if name not in cls.all_running_platforms:
|
||||
cls.all_running_platforms[name] = cls.all_platforms[name]()
|
||||
return cls.all_running_platforms[name]
|
||||
|
||||
def __init__(self):
|
||||
if neutralEnv('distname') not in self.compatible_hosts:
|
||||
print(('ERROR: The target platform {} cannot be build on host {}.\n'
|
||||
'Select another target platform, or change your host system.'
|
||||
).format(self.name, neutralEnv('distname')))
|
||||
sys.exit(-1)
|
||||
self.all_running_platforms[self.name] = self
|
||||
self.buildEnv = BuildEnv(self)
|
||||
self.setup_toolchains()
|
||||
|
|
Loading…
Reference in New Issue