diff --git a/pio-scripts/fixup_usermods.py b/pio-scripts/fixup_usermods.py new file mode 100644 index 000000000..5b8cddf32 --- /dev/null +++ b/pio-scripts/fixup_usermods.py @@ -0,0 +1,17 @@ +Import('env') + +# Patch up each usermod's include folders to include anything referenced by wled +# This is because usermods need to include wled.h +lib_builders = env.GetLibBuilders() +um_deps = [dep for dep in lib_builders if "/usermods" in dep.src_dir] +other_deps = [dep for dep in lib_builders if "/usermods" not in dep.src_dir] + +for um in um_deps: + # Add include paths for all non-usermod dependencies + for dep in other_deps: + for dir in dep.get_include_dirs(): + um.env.PrependUnique(CPPPATH=dir) + # Add the wled folder to the include path + um.env.PrependUnique(CPPPATH=env["PROJECT_SRC_DIR"]) + +#raise RuntimeError("debug") diff --git a/platformio.ini b/platformio.ini index 4832978a9..f8366da0b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -115,6 +115,7 @@ extra_scripts = post:pio-scripts/strip-floats.py pre:pio-scripts/user_config_copy.py pre:pio-scripts/load_usermods.py + post:pio-scripts/fixup_usermods.py pre:pio-scripts/build_ui.py ; post:pio-scripts/obj-dump.py ;; convenience script to create a disassembly dump of the firmware (hardcore debugging) diff --git a/usermods/audioreactive/library.json b/usermods/audioreactive/library.json index 2ce60ec6b..77f30d2c4 100644 --- a/usermods/audioreactive/library.json +++ b/usermods/audioreactive/library.json @@ -1,8 +1,6 @@ { "name": "audioreactive", "build": { - "srcDir": ".", - "includeDir": "../../wled00", "extraScript": "override_sqrt.py" }, "dependencies": [ diff --git a/usermods/usermod_v2_animartrix/library.json b/usermods/usermod_v2_animartrix/library.json index f176e72ed..4552be330 100644 --- a/usermods/usermod_v2_animartrix/library.json +++ b/usermods/usermod_v2_animartrix/library.json @@ -1,11 +1,5 @@ { "name": "animartrix", - "build": { - "srcDir": ".", - "includeDir": "../../wled00", - "libLDFMode": "chain+", - "libArchive": false - }, "dependencies": { "Animartrix": "https://github.com/netmindz/animartrix.git#b172586" } diff --git a/usermods/usermod_v2_auto_save/library.json b/usermods/usermod_v2_auto_save/library.json index 40676ed55..9d81aa682 100644 --- a/usermods/usermod_v2_auto_save/library.json +++ b/usermods/usermod_v2_auto_save/library.json @@ -1,8 +1,3 @@ { - "name": "auto_save", - "build": { - "srcDir": ".", - "includeDir": "../../wled00", - "libLDFMode": "chain+" - } + "name": "auto_save" } \ No newline at end of file