PlatformIO Community

Library configuration script

Hi all,

I’m developing a PlatformIO library that needs some compile time configurations.

I’ve seen that in the platformio.ini file is possible to add some extra python scripts that should be run from the build system before or after the main platform script. So I want to run a script that takes a .ini file as input and generates a .hpp file as output.

The problem is that I’m developing a library so the file .ini will be in the directory of the project that will use my library not in the directory of the library itself.

So my question is: Is it possible to locate from the python API of PlatformIO the location of the project that is compiling my library?

I found the solution by myself. I’m posting here the things that I’ve figured out so if someone else will need them he will find hem.

It is possible to find the location of the project that is been compiled with the value env[‘PROJECT_DIR’] , where env is imported from scons with the statement: Import(‘env’)

1 Like