Minor cleanup

This commit is contained in:
Luke Street 2024-09-17 19:21:54 -06:00
parent f49a9cbb62
commit 2f94ccb062
2 changed files with 16 additions and 6 deletions

View File

@ -16,7 +16,15 @@ import argparse
import sys import sys
from pathlib import Path from pathlib import Path
from typing import Any, Dict, List from typing import Any, Dict, List
from tools.project import *
from tools.project import (
Object,
ProgressCategory,
ProjectConfig,
calculate_progress,
generate_build,
is_windows,
)
# Game versions # Game versions
DEFAULT_VERSION = 0 DEFAULT_VERSION = 0

View File

@ -213,11 +213,13 @@ CHAIN = "cmd /c " if is_windows() else ""
EXE = ".exe" if is_windows() else "" EXE = ".exe" if is_windows() else ""
def make_flags_str(cflags: Union[str, List[str]]) -> str: def make_flags_str(flags: Optional[Union[str, List[str]]]) -> str:
if isinstance(cflags, list): if flags is None:
return " ".join(cflags) return ""
elif isinstance(flags, list):
return " ".join(flags)
else: else:
return cflags return flags
# Load decomp-toolkit generated config.json # Load decomp-toolkit generated config.json
@ -282,7 +284,7 @@ def generate_build_ninja(
# Variables # Variables
### ###
n.comment("Variables") n.comment("Variables")
n.variable("ldflags", " ".join(config.ldflags or [])) n.variable("ldflags", make_flags_str(config.ldflags))
if config.linker_version is None: if config.linker_version is None:
sys.exit("ProjectConfig.linker_version missing") sys.exit("ProjectConfig.linker_version missing")
n.variable("mw_version", Path(config.linker_version)) n.variable("mw_version", Path(config.linker_version))