wizio
June 15, 2021, 3:14pm
1
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”
wizio:
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
wizio
June 16, 2021, 4:47am
4
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
wizio
August 28, 2021, 6:54am
6
NICE - work… Thanks Max
need 2 files: library.json and script
{
“name”: “SomeLib”,
“version”: “0.0.0”,
“build”: {
"extraScript": "extra_script.py"
}
}
wizio
August 29, 2021, 4:44am
7
@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.
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
return env.StaticLibrary(
env.subst(variant_dir), env.CollectBuildFiles(variant_dir, src_dir, src_filter)
)
The BuildSources
function has the same signature. Example with source filter:
# build system file (starts up clocks) and startup file (contains interrupt vector table)
system_file_dir = join(atmel_cmsis_dir, "CMSIS", "Device", "ATMEL", "sam3xa", "source")
system_file_dir_filter = "-<*> +<system_sam3xa.c> +<as_gcc/startup_sam3xa.c>"
env.BuildSources(join("$BUILD_DIR", "FrameworkCMSIS"), system_file_dir, src_filter=system_file_dir_filter)
Has the same format as src_filter
.
1 Like
wizio
August 29, 2021, 3:16pm
9
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
wizio
August 29, 2021, 8:10pm
11
THANKS MAX !!!
Work…
env.Replace(SRC_FILTER=src_filter_default)