MaJerle / lwprintf

Lightweight printf library optimized for embedded systems
https://majerle.eu/projects/lwprintf-lightweight-stdio-manager-printf-snprintf-vprintf-vsnprintf-sprintf
MIT License
183 stars 32 forks source link

PlatformIO Registry #13

Open hagaigold opened 2 years ago

hagaigold commented 2 years ago

Hi Tilen,

I am not sure this is an issue, but still...

Tried to consume the library thru PlatformIO IDE and had some issues building the library as-is. I have very little experience with PlatofrmIO but I assumed it should work out of the box.

Is the library.json file for use only by the PlatformIO? or have another purpose in life? After changing it a bit, I could build the library:

        ]
    },
    "build": {
        "includeDir": "lwprintf/src/include",
        "srcDir": "lwprintf",
        "flags": [
            "-I../../include"
        ]
    }
}

without the includeDir, I couldn't include the library without the srcDir, PlatoformIO try to build also the dev folder

the last bit, which I found helpful, is adding another include folder (-I) so I can place the options header, lwprintf_opts.h, in a project folder and not inside the library itself.

MaJerle commented 2 years ago

I think you are right, problem is that there are also some files that are "optional" versus platform.

Could you prepare pull request with your changes?

hagaigold commented 2 years ago

I have some concerns about the included path for the option header, lwprintf_opts.h: in the sample above I used relative path '-I../../include'. This path can be different if you use manual clone into the lib folder versus automatic install of the library using the lib_deps = majerle/LwPRINTF@^1.0.3 in platformio.ini.

one option is just to leave it for the user to set up a global include folder thru platformio.ini. another option is using an absolute path. e.g -I$PROJECT_INCLUDE_DIR, -I$PROJECT_DIR/<some folder>