Add ability to have extern sources

Former-commit-id: 45b4e8abbbc9b9b40045b161e201447777b65483
This commit is contained in:
Phillip Stephens 2023-12-18 20:01:30 -08:00
parent a67833a2a1
commit 4995a55831
3 changed files with 52 additions and 39 deletions

View File

@ -240,6 +240,7 @@ 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,
} }
@ -250,6 +251,7 @@ 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,
} }
@ -258,8 +260,10 @@ def RetroLib(lib_name, objects):
def MusyX(objects, mw_version="GC/1.3.2", debug=False, major=2, minor=0, patch=0): def MusyX(objects, mw_version="GC/1.3.2", debug=False, major=2, minor=0, patch=0):
cflags = cflags_musyx if not debug else cflags_musyx_debug cflags = cflags_musyx if not debug else cflags_musyx_debug
return { return {
"lib": "musyx" + "D" if config.debug else "", "lib": "musyx",
"mw_version": mw_version, "mw_version": mw_version,
"extern": True,
"extern_source": "extern/musyx/src",
"host": False, "host": False,
"cflags": [ "cflags": [
*cflags, *cflags,
@ -913,6 +917,7 @@ 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"),
@ -1110,6 +1115,7 @@ 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"),
@ -1185,41 +1191,39 @@ config.libs = [
# minor=5, # minor=5,
# patch=3, # patch=3,
objects=[ objects=[
Object( Object(Matching, "musyx/runtime/seq.c"),
Matching, "musyx/runtime/seq.c", source="extern/musyx/runtime/seq.c" Object(Matching, "musyx/runtime/synth.c"),
), Object(Matching, "musyx/runtime/seq_api.c"),
Object(Matching, "musyx/runtime/synth.c", source="extern/musyx/synth.c"), Object(Matching, "musyx/runtime/snd_synthapi.c"),
Object(Matching, "musyx/runtime/seq_api.c", source="extern/musyx/seq_api.c"), Object(NonMatching, "musyx/runtime/stream.c"),
Object(Matching, "musyx/runtime/snd_synthapi.c", source="extern/musyx/snd_synthapi.c"), Object(Matching, "musyx/runtime/synthdata.c"),
Object(NonMatching, "musyx/runtime/stream.c", source="extern/musyx/stream.c"), Object(NonMatching, "musyx/runtime/synthmacros.c"),
Object(Matching, "musyx/runtime/synthdata.c", source="extern/musyx/synthdata.c"), Object(Matching, "musyx/runtime/synthvoice.c"),
Object(NonMatching, "musyx/runtime/synthmacros.c", source="extern/musyx/synthmacros.c"), Object(Matching, "musyx/runtime/synth_ac.c"),
Object(Matching, "musyx/runtime/synthvoice.c", source="extern/musyx/synthvoice.c"), Object(Matching, "musyx/runtime/synth_adsr.c"),
Object(Matching, "musyx/runtime/synth_ac.c", source="extern/musyx/synth_ac.c"), Object(Matching, "musyx/runtime/synth_vsamples.c"),
Object(Matching, "musyx/runtime/synth_adsr.c", source="extern/musyx/synth_adsr.c"), Object(Matching, "musyx/runtime/synth_dbtab.c"),
Object(Matching, "musyx/runtime/synth_vsamples.c", source="extern/musyx/synth_vsamples.c"), Object(Matching, "musyx/runtime/s_data.c"),
Object(Matching, "musyx/runtime/synth_dbtab.c", source="extern/musyx/synth_dbtab.c"), Object(NonMatching, "musyx/runtime/hw_dspctrl.c"),
Object(Matching, "musyx/runtime/s_data.c", source="extern/musyx/s_data.c"), Object(Matching, "musyx/runtime/hw_volconv.c"),
Object(NonMatching, "musyx/runtime/hw_dspctrl.c", source="extern/musyx/hw_dspctrl.c"), Object(Matching, "musyx/runtime/snd3d.c"),
Object(Matching, "musyx/runtime/hw_volconv.c", source="extern/musyx/hw_volconv.c"), Object(Matching, "musyx/runtime/snd_init.c"),
Object(Matching, "musyx/runtime/snd3d.c", source="extern/musyx/snd3d.c"), Object(Matching, "musyx/runtime/snd_math.c"),
Object(Matching, "musyx/runtime/snd_init.c", source="extern/musyx/snd_init.c"), Object(NonMatching, "musyx/runtime/snd_midictrl.c"),
Object(Matching, "musyx/runtime/snd_math.c", source="extern/musyx/snd_math.c"), Object(Matching, "musyx/runtime/snd_service.c"),
Object(NonMatching, "musyx/runtime/snd_midictrl.c", source="extern/musyx/snd_midictrl.c"), Object(Matching, "musyx/runtime/hardware.c"),
Object(Matching, "musyx/runtime/snd_service.c", source="extern/musyx/snd_service.c"), Object(Matching, "musyx/runtime/hw_aramdma.c"),
Object(Matching, "musyx/runtime/hardware.c", source="extern/musyx/hardware.c"), Object(Matching, "musyx/runtime/dsp_import.c"),
Object(Matching, "musyx/runtime/hw_aramdma.c", source="extern/musyx/hw_aramdma.c"), Object(Matching, "musyx/runtime/hw_dolphin.c"),
Object(Matching, "musyx/runtime/dsp_import.c", source="extern/musyx/dsp_import.c"), Object(Matching, "musyx/runtime/hw_memory.c"),
Object(Matching, "musyx/runtime/hw_dolphin.c", source="extern/musyx/hw_dolphin.c"), Object(Matching, "musyx/runtime/hw_lib_dummy.c"),
Object(Matching, "musyx/runtime/hw_memory.c", source="extern/musyx/hw_memory.c"), Object(Matching, "musyx/runtime/CheapReverb/creverb_fx.c"),
Object(Matching, "musyx/runtime/hw_lib_dummy.c", source="extern/musyx/hw_lib_dummy.c"), Object(Matching, "musyx/runtime/CheapReverb/creverb.c"),
Object(Matching, "musyx/runtime/CheapReverb/creverb_fx.c", source="extern/musyx/creverb_fx.c"), Object(Matching, "musyx/runtime/StdReverb/reverb_fx.c"),
Object(Matching, "musyx/runtime/CheapReverb/creverb.c", source="extern/musyx/creverb.c"), Object(Matching, "musyx/runtime/StdReverb/reverb.c"),
Object(Matching, "musyx/runtime/StdReverb/reverb_fx.c", source="extern/musyx/reverb_fx.c"), Object(Matching, "musyx/runtime/Delay/delay_fx.c"),
Object(Matching, "musyx/runtime/StdReverb/reverb.c", source="extern/musyx/reverb.c"), Object(Matching, "musyx/runtime/Chorus/chorus_fx.c"),
Object(Matching, "musyx/runtime/Delay/delay_fx.c", source="extern/musyx/delay_fx.c"), Object(Matching, "musyx/runtime/profile.c"),
Object(Matching, "musyx/runtime/Chorus/chorus_fx.c", source="extern/musyx/chorus_fx.c"),
Object(Matching, "musyx/runtime/profile.c", source="extern/musyx/profile.c"),
], ],
), ),
{ {
@ -1238,6 +1242,7 @@ config.libs = [
"-D_DEBUG=1", "-D_DEBUG=1",
"-enum int", "-enum int",
], ],
"extern": True,
"host": False, "host": False,
"objects": [ "objects": [
Object(NonMatching, "musyx/txwin/txwin.c"), Object(NonMatching, "musyx/txwin/txwin.c"),

2
extern/musyx vendored

@ -1 +1 @@
Subproject commit 6f76370d3614c260b43cbd6cc875ac9de885359d Subproject commit 28424c828c8c462e26953ded3b08e6f3a0c8e489

View File

@ -511,7 +511,11 @@ def generate_build_ninja(config, build_config):
options = obj.options options = obj.options
completed = obj.completed completed = obj.completed
unit_src_path = config.src_dir / options["source"] if "extern" in lib.keys() and lib["extern"]:
unit_src_path = Path(lib["extern_source"]) / options["source"]
else:
unit_src_path = config.src_dir / options["source"]
if not unit_src_path.exists(): if not unit_src_path.exists():
if config.warn_missing_source: if config.warn_missing_source:
print(f"Missing source file {unit_src_path}") print(f"Missing source file {unit_src_path}")
@ -828,7 +832,11 @@ def generate_objdiff_config(config, build_config):
return return
lib, obj = result lib, obj = result
unit_src_path = config.src_dir / obj.options["source"] if "extern" in lib.keys() and lib["extern"]:
unit_src_path = Path(lib["extern_source"]) / obj.options["source"]
else:
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