Export sdk using platformio

Hello,

I have a need to export an sdk that will be from source files. The current project builds my libs/* and the src/*…
Now I want to run something like pio run --target sdk.
The output will be an sdk folder with a simple example app (in source form) + all the libraries and includes needed.
I can generate from the python script a platformio.ini for the example etc… but I also need the following information:

  • list of libraries (except the platform libs… ie only my libs). I’m using env[’__PIO_LIB_BUILDERS’] for that, but the lib*.a file I don’t know how to get it as the name is random (ie, in build//libXXX/lib*.a)
  • A list of the needed includes: I’m using env[’__PIO_LIB_BUILDERS’].include_dir to copy all the file to my sdk dir.

I think that for the other variables (like CPP defines etc) I can manage also from the env.

Is there something simpler? Or my current solution is the only one?
How to get in that case the libXXX folder were the .a file is (I can always do a search from the script, but I prefere to avoid if possible)

Thank you!