Add new "fast" optimization mixin and handle

disabled components in builder.py
This commit is contained in:
Sleepy Monax 2023-11-14 21:54:47 +01:00
parent 6cf0502beb
commit 7ccd17d64b
2 changed files with 9 additions and 2 deletions

View file

@ -214,6 +214,10 @@ def build(
products: list[Product] = []
for c in components:
r = c.resolved[target.id]
if not r.enabled:
raise RuntimeError(f"Component {c.id} is disabled: {r.reason}")
products.append(
Product(
path=Path(outfile(target, c)),
@ -224,9 +228,9 @@ def build(
outs = list(map(lambda p: str(p.path), products))
if all:
shell.exec("ninja", "-v", "-f", ninjaPath)
shell.exec("ninja", "-f", ninjaPath)
else:
shell.exec("ninja", "-v", "-f", ninjaPath, *outs)
shell.exec("ninja", "-f", ninjaPath, *outs)
return products

View file

@ -65,6 +65,7 @@ mixins: dict[str, Mixin] = {
"tsan": makeMixinSan("thread"),
"ubsan": makeMixinSan("undefined"),
"tune": makeMixinTune("native"),
"fast": makeMixinOptimize("fast"),
"o3": makeMixinOptimize("3"),
"o2": makeMixinOptimize("2"),
"o1": makeMixinOptimize("1"),
@ -77,4 +78,6 @@ def append(mixinSpec: str, mixin: Mixin):
def byId(id: str) -> Mixin:
if id not in mixins:
raise RuntimeError(f"Unknown mixin {id}")
return mixins[id]