Add 'src_dir' override for libraries (#1)

This allows projects to specify external libraries more easily.
Particularly useful for common libraries shared between decomp projects,
enabling the use of submodules/subtrees to deduplicated decomp efforts
This commit is contained in:
Phillip Stephens 2023-12-18 20:55:36 -08:00 committed by GitHub
parent 90a464aea1
commit e84ce8db06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -518,11 +518,13 @@ def generate_build_ninja(config, build_config):
lib, obj = result lib, obj = result
lib_name = lib["lib"] lib_name = lib["lib"]
src_dir = Path(lib.get("src_dir", config.src_dir))
options = obj.options options = obj.options
completed = obj.completed completed = obj.completed
unit_src_path = config.src_dir / options["source"] unit_src_path = src_dir / options["source"]
if not unit_src_path.exists(): if not unit_src_path.exists():
if config.warn_missing_source or completed: if config.warn_missing_source or completed:
print(f"Missing source file {unit_src_path}") print(f"Missing source file {unit_src_path}")
@ -873,7 +875,10 @@ def generate_objdiff_config(config, build_config):
return return
lib, obj = result lib, obj = result
unit_src_path = config.src_dir / obj.options["source"] src_dir = Path(lib.get("src_dir", config.src_dir))
unit_src_path = src_dir / obj.options["source"]
if not unit_src_path.exists(): if not unit_src_path.exists():
objdiff_config["units"].append(unit_config) objdiff_config["units"].append(unit_config)
return return