Allow .asm files and set default target.

This commit is contained in:
Sleepy Monax 2022-06-26 17:15:09 +02:00
parent 4b99ba40cf
commit a290e8388c
4 changed files with 6 additions and 7 deletions

View file

@ -36,14 +36,14 @@ def runCmd(opts: dict, args: list[str]) -> None:
print(f"Usage: {args[0]} run <component>")
sys.exit(1)
out = build.buildOne(opts.get('target', 'host-clang'), args[0])
out = build.buildOne(opts.get('target', 'default'), args[0])
print(f"{utils.Colors.BOLD}Running: {args[0]}{utils.Colors.RESET}")
utils.runCmd(out, *args[1:])
def buildCmd(opts: dict, args: list[str]) -> None:
targetName = opts.get('target', 'host-clang')
targetName = opts.get('target', 'default')
if len(args) == 0:
build.buildAll(targetName)
@ -53,7 +53,7 @@ def buildCmd(opts: dict, args: list[str]) -> None:
def listCmd(opts: dict, args: list[str]) -> None:
targetName = opts.get('target', 'host-clang')
targetName = opts.get('target', 'default')
target = targets.load(targetName)
components = manifests.loadAll("src", target)

View file

@ -58,7 +58,7 @@ def genNinja(out: TextIO, manifests: dict, target: dict) -> None:
elif obj[1].endswith(".cpp"):
writer.build(
obj[0], "cxx", obj[1], order_only=target["tools"]["cxx"].get("files", ""))
elif obj[1].endswith(".s"):
elif obj[1].endswith(".s") or obj[1].endswith(".asm"):
writer.build(
obj[0], "as", obj[1], order_only=target["tools"]["as"].get("files", ""))

View file

@ -88,7 +88,7 @@ def findFiles(manifests: dict) -> dict:
assetsPath = os.path.join(path, "assets")
item["tests"] = utils.findFiles(testsPath, [".c", ".cpp"])
item["srcs"] = utils.findFiles(path, [".c", ".cpp", ".s"])
item["srcs"] = utils.findFiles(path, [".c", ".cpp", ".s", ".asm"])
item["assets"] = utils.findFiles(assetsPath)
return manifests

View file

@ -187,11 +187,10 @@ def loadJson(filename: str) -> dict:
result = CACHE[filename]
else:
with open(filename) as f:
result = json.load(f)
result = processJson(json.load(f))
result["dir"] = os.path.dirname(filename)
result["json"] = filename
result = processJson(result)
CACHE[filename] = result
result = copy.deepcopy(result)