Try this:
- Create a
library.jsonfile in the root of a library - Write a custom extra script and dynamically replace srcFilter value with your a custom.
See example (I didn’t test it, just a hint)
library.json
{
"name": "MotorDriver",
"version": "0.0.0",
"build": {
"extraScript": "extra_script.py"
}
}
extra_script.py
Import('env')
from SCons.Script import COMMAND_LINE_TARGETS
src_filter = ["+<*>", "-<NoopMotorDriver.cpp>"] # default
if "__debug" in COMMAND_LINE_TARGETS:
env.Replace(SRC_FILTER=["+<*>", "-<ArduinoMotorDriver.cpp>"])