Hi,
how can i exclude a directory from a library? In the new-LiquidCrystal-Library is a third-party-folder that doesnt compile, but does if i delete the “TinyWireM”-Folder. This is my not working example:
.pio/libdeps/megaatmega2560/LiquidCrystal_I2C/thirdparty libraries/TinyWireM/USI_TWI_Master.cpp: In function 'void USI_TWI_Master_Initialise()':
.pio/libdeps/megaatmega2560/LiquidCrystal_I2C/thirdparty libraries/TinyWireM/USI_TWI_Master.cpp:48:3: error: 'PORT_USI' was not declared in this scope
that space is only a copy and paste-error. I’m still stuck at this “problem”. I dont want do delete the folder manually, so sharing a project doesnt require any copy-paste-delete-things.
My last “ValueError: No escaped character” errors was just path things, had to escape path-slashes, but i dont find any working solution yet
Part of the src_filter ‘madness’ is after ignoring the library, you re-add it via the src_flag in it’s entirety and then exclude the thirdparty folder, as well as adding it to the include path… And use forward, not back slashes to prevent escaping issues… let me know how it goes for you
Sorry, but this mess solution. What if location ../.pio/libdeps path will change in future by some reason? Think more elegant solution via scripting:
platformio.ini
extra_scripts =
pre:filter_src.py
filter_src.py
Import("env")
def skip_from_build(node):
"""
`node.name` - a name of File System Node
`node.get_path()` - a relative path
`node.get_abspath()` - an absolute path
to ignore file from a build process, just return None
"""
if "my-external-lib-name/path/to/dir" in node.get_path():
# Return None for exclude
return None
return node
# Register callback
env.AddBuildMiddleware(skip_from_build, "*")