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 "", "lib": lib_name + "D" if config.debug else "",
"mw_version": "GC/1.2.5n", "mw_version": "GC/1.2.5n",
"cflags": cflags_base, "cflags": cflags_base,
"extern": False,
"host": False, "host": False,
"objects": objects, "objects": objects,
} }
@ -251,7 +250,6 @@ def RetroLib(lib_name, objects):
"lib": lib_name + "CW" + "D" if config.debug else "", "lib": lib_name + "CW" + "D" if config.debug else "",
"mw_version": "GC/1.3.2", "mw_version": "GC/1.3.2",
"cflags": cflags_retro, "cflags": cflags_retro,
"extern": False,
"host": False, "host": False,
"objects": objects, "objects": objects,
} }
@ -262,8 +260,7 @@ def MusyX(objects, mw_version="GC/1.3.2", debug=False, major=2, minor=0, patch=0
return { return {
"lib": "musyx", "lib": "musyx",
"mw_version": mw_version, "mw_version": mw_version,
"extern": True, "extern": "extern/musyx/src",
"extern_source": "extern/musyx/src",
"host": False, "host": False,
"cflags": [ "cflags": [
*cflags, *cflags,
@ -917,7 +914,6 @@ config.libs = [
"lib": "zlib", "lib": "zlib",
"mw_version": "GC/1.3.2", "mw_version": "GC/1.3.2",
"cflags": cflags_runtime, "cflags": cflags_runtime,
"extern": False,
"host": False, "host": False,
"objects": [ "objects": [
Object(Matching, "Kyoto/zlib/adler32.c"), Object(Matching, "Kyoto/zlib/adler32.c"),
@ -1115,7 +1111,6 @@ config.libs = [
"lib": "MSL_C.PPCEABI.bare.H", "lib": "MSL_C.PPCEABI.bare.H",
"mw_version": "GC/1.3.2", "mw_version": "GC/1.3.2",
"cflags": cflags_runtime, "cflags": cflags_runtime,
"extern": False,
"host": False, "host": False,
"objects": [ "objects": [
Object(Matching, "Runtime/__mem.c"), Object(Matching, "Runtime/__mem.c"),
@ -1226,28 +1221,6 @@ config.libs = [
Object(Matching, "musyx/runtime/profile.c"), 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( DolphinLib(
"Dummy", "Dummy",
[ [

View File

@ -511,8 +511,13 @@ def generate_build_ninja(config, build_config):
options = obj.options options = obj.options
completed = obj.completed completed = obj.completed
if "extern" in lib.keys() and lib["extern"]: # For extern sources we need to use the specified source directory
unit_src_path = Path(lib["extern_source"]) / options["source"] 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: else:
unit_src_path = config.src_dir / options["source"] unit_src_path = config.src_dir / options["source"]
@ -832,11 +837,18 @@ def generate_objdiff_config(config, build_config):
return return
lib, obj = result lib, obj = result
if "extern" in lib.keys() and lib["extern"]: lib_name = lib["lib"]
unit_src_path = Path(lib["extern_source"]) / obj.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 = Path(lib["extern"]) / obj.options["source"]
else: else:
unit_src_path = config.src_dir / obj.options["source"] unit_src_path = config.src_dir / obj.options["source"]
print(unit_src_path)
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