Better extern handling

Former-commit-id: 10cb22b560dd2da972249fb983cb202317b3a27a
This commit is contained in:
Phillip Stephens 2023-12-18 20:19:05 -08:00
parent 4995a55831
commit 30bd0f60a0
2 changed files with 18 additions and 33 deletions

View File

@ -240,7 +240,6 @@ def DolphinLib(lib_name, objects):
"lib": lib_name + "D" if config.debug else "",
"mw_version": "GC/1.2.5n",
"cflags": cflags_base,
"extern": False,
"host": False,
"objects": objects,
}
@ -251,7 +250,6 @@ def RetroLib(lib_name, objects):
"lib": lib_name + "CW" + "D" if config.debug else "",
"mw_version": "GC/1.3.2",
"cflags": cflags_retro,
"extern": False,
"host": False,
"objects": objects,
}
@ -262,8 +260,7 @@ def MusyX(objects, mw_version="GC/1.3.2", debug=False, major=2, minor=0, patch=0
return {
"lib": "musyx",
"mw_version": mw_version,
"extern": True,
"extern_source": "extern/musyx/src",
"extern": "extern/musyx/src",
"host": False,
"cflags": [
*cflags,
@ -917,7 +914,6 @@ config.libs = [
"lib": "zlib",
"mw_version": "GC/1.3.2",
"cflags": cflags_runtime,
"extern": False,
"host": False,
"objects": [
Object(Matching, "Kyoto/zlib/adler32.c"),
@ -1115,7 +1111,6 @@ config.libs = [
"lib": "MSL_C.PPCEABI.bare.H",
"mw_version": "GC/1.3.2",
"cflags": cflags_runtime,
"extern": False,
"host": False,
"objects": [
Object(Matching, "Runtime/__mem.c"),
@ -1226,28 +1221,6 @@ config.libs = [
Object(Matching, "musyx/runtime/profile.c"),
],
),
{
"lib": "txwin",
"mw_version": "GC/1.2.5n",
"cflags": [
"-Cpp_exceptions off",
"-proc gecko",
"-fp hard",
"-nodefaults",
"-nosyspath",
"-i include",
"-i libc",
"-g",
"-sym on",
"-D_DEBUG=1",
"-enum int",
],
"extern": True,
"host": False,
"objects": [
Object(NonMatching, "musyx/txwin/txwin.c"),
],
},
DolphinLib(
"Dummy",
[

View File

@ -511,8 +511,13 @@ def generate_build_ninja(config, build_config):
options = obj.options
completed = obj.completed
if "extern" in lib.keys() and lib["extern"]:
unit_src_path = Path(lib["extern_source"]) / options["source"]
# For extern sources we need to use the specified source directory
if "extern" in lib.keys():
lib_path = Path(lib["extern"])
if not lib_path.exists():
sys.exit(f"Specified extern path '{lib_path}' not found")
unit_src_path = lib_path / options["source"]
else:
unit_src_path = config.src_dir / options["source"]
@ -832,11 +837,18 @@ def generate_objdiff_config(config, build_config):
return
lib, obj = result
if "extern" in lib.keys() and lib["extern"]:
unit_src_path = Path(lib["extern_source"]) / obj.options["source"]
lib_name = lib["lib"]
# For extern sources we need to use the specified source directory
if "extern" in lib.keys():
lib_path = Path(lib["extern"])
if not lib_path.exists():
sys.exit(f"Specified extern path '{lib_path}' not found")
unit_src_path = Path(lib["extern"]) / obj.options["source"]
else:
unit_src_path = config.src_dir / obj.options["source"]
print(unit_src_path)
if not unit_src_path.exists():
objdiff_config["units"].append(unit_config)
return