From 30bd0f60a01a3589a614cbb7d6440fcbc61cd366 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 18 Dec 2023 20:19:05 -0800 Subject: [PATCH] Better extern handling Former-commit-id: 10cb22b560dd2da972249fb983cb202317b3a27a --- configure.py | 29 +---------------------------- tools/project.py | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/configure.py b/configure.py index 2753901c..36eb29c4 100755 --- a/configure.py +++ b/configure.py @@ -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", [ diff --git a/tools/project.py b/tools/project.py index d3dabb95..f223bb2e 100644 --- a/tools/project.py +++ b/tools/project.py @@ -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