PlatformIO Community

INI / SCRIPT file for a Library

is there a possibility ( or idea for future ) INI file for library

example: github project “ABC”, suport X,Y,Z functions…
import to project_dir/lib as “LIB_ABC”
The INI file( or library PY script, in this folder “/lib/LIB_ABC” ) to be how to compile - defines, includes, sources from this “library/folder”

Defines, includes and sources for a library are already controlled by the library.json file of the library.

This even supports extraScript for custom Pytho logic if the static build flags etc. are not enough.

1 Like

Thanks Max, will test…

this extraScript is global/project or local/library - I am referring to local, library only

extraScript is for the local library, not extra_scripts for the project.

You can see an example here.

2 Likes

NICE - work… Thanks Max
need 2 files: library.json and script

{
“name”: “SomeLib”,
“version”: “0.0.0”,
“build”: {
"extraScript": "extra_script.py"
}
}

@maxgerhardt in extra_script is valid env.BuildLibrary(… filter ) ?
for the library in “this” folder

the question is: how to select the files for compilation

Yes, you can give it a source filter expression.

The BuildSources function has the same signature. Example with source filter:

Has the same format as src_filter.

1 Like

library FOO ( include & src )
SRC folder is auto-scan for files and compiled library have temp-random-project file name

so… how to exclude files from SRC folder?

Oh I think in this case you just want to use a source filter.

Also see bottom of that chapter

https://docs.platformio.org/en/latest/librarymanager/config.html#extrascript

1 Like

THANKS MAX !!!

Work…
env.Replace(SRC_FILTER=src_filter_default)