Allow adding re-configure dependencies and doing non-matching builds (#22)
* Fix type checking errors with config version * Add optional reconfigure dependency list to project config * Add non-matching build option Skips hash check and progress output * Uncomment `config.reconfig_deps` assignment * Change default target for non-matching instead of stubbing check/progress
This commit is contained in:
parent
d102696838
commit
cf654dd8ad
16
configure.py
16
configure.py
|
@ -105,10 +105,16 @@ parser.add_argument(
|
|||
action="store_true",
|
||||
help="print verbose output",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--non-matching",
|
||||
dest="non_matching",
|
||||
action="store_true",
|
||||
help="builds equivalent (but non-matching) or modded objects",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
config = ProjectConfig()
|
||||
config.version = args.version
|
||||
config.version = str(args.version)
|
||||
version_num = VERSIONS.index(config.version)
|
||||
|
||||
# Apply arguments
|
||||
|
@ -118,6 +124,7 @@ config.binutils_path = args.binutils
|
|||
config.compilers_path = args.compilers
|
||||
config.debug = args.debug
|
||||
config.generate_map = args.map
|
||||
config.non_matching = args.non_matching
|
||||
config.sjiswrap_path = args.sjiswrap
|
||||
if not is_windows():
|
||||
config.wrapper = args.wrapper
|
||||
|
@ -146,6 +153,8 @@ config.ldflags = [
|
|||
"-nodefaults",
|
||||
# "-listclosure", # Uncomment for Wii linkers
|
||||
]
|
||||
# Use for any additional files that should cause a re-configure when modified
|
||||
config.reconfig_deps = []
|
||||
|
||||
# Base flags, common to most GC/Wii games.
|
||||
# Generally leave untouched, with overrides added below.
|
||||
|
@ -220,8 +229,9 @@ def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
|
|||
}
|
||||
|
||||
|
||||
Matching = True
|
||||
NonMatching = False
|
||||
Matching = True # Object matches and should be linked
|
||||
NonMatching = False # Object does not match and should not be linked
|
||||
Equivalent = config.non_matching # Object should be linked when configured with --non-matching
|
||||
|
||||
config.warn_missing_config = True
|
||||
config.warn_missing_source = False
|
||||
|
|
|
@ -71,6 +71,7 @@ class ProjectConfig:
|
|||
self.sjiswrap_path: Optional[Path] = None # If None, download
|
||||
|
||||
# Project config
|
||||
self.non_matching: bool = False
|
||||
self.build_rels: bool = True # Build REL files
|
||||
self.check_sha_path: Optional[Path] = None # Path to version.sha1
|
||||
self.config_path: Optional[Path] = None # Path to config.yml
|
||||
|
@ -90,6 +91,9 @@ class ProjectConfig:
|
|||
self.shift_jis = (
|
||||
True # Convert source files from UTF-8 to Shift JIS automatically
|
||||
)
|
||||
self.reconfig_deps: Optional[List[Path]] = (
|
||||
None # Additional re-configuration dependency files
|
||||
)
|
||||
|
||||
# Progress output and progress.json config
|
||||
self.progress_all: bool = True # Include combined "all" category
|
||||
|
@ -553,6 +557,7 @@ def generate_build_ninja(
|
|||
)
|
||||
n.newline()
|
||||
|
||||
link_outputs: List[Path] = []
|
||||
if build_config:
|
||||
link_steps: List[LinkStep] = []
|
||||
used_compiler_versions: Set[str] = set()
|
||||
|
@ -760,6 +765,7 @@ def generate_build_ninja(
|
|||
###
|
||||
for step in link_steps:
|
||||
step.write(n)
|
||||
link_outputs.append(step.output())
|
||||
n.newline()
|
||||
|
||||
###
|
||||
|
@ -861,7 +867,7 @@ def generate_build_ninja(
|
|||
outputs=ok_path,
|
||||
rule="check",
|
||||
inputs=config.check_sha_path,
|
||||
implicit=[dtk, *map(lambda step: step.output(), link_steps)],
|
||||
implicit=[dtk, *link_outputs],
|
||||
)
|
||||
n.newline()
|
||||
|
||||
|
@ -961,6 +967,7 @@ def generate_build_ninja(
|
|||
configure_script,
|
||||
python_lib,
|
||||
python_lib_dir / "ninja_syntax.py",
|
||||
*(config.reconfig_deps or [])
|
||||
],
|
||||
)
|
||||
n.newline()
|
||||
|
@ -970,6 +977,9 @@ def generate_build_ninja(
|
|||
###
|
||||
n.comment("Default rule")
|
||||
if build_config:
|
||||
if config.non_matching:
|
||||
n.default(link_outputs)
|
||||
else:
|
||||
n.default(progress_path)
|
||||
else:
|
||||
n.default(build_config_path)
|
||||
|
|
Loading…
Reference in New Issue