We work with the LVGL library. That works great, but we also have additional fonts that we use, stored in a top level folder. But the LVGL library just can’t find them. We work with these build flags:
The -I include is for the lvgl config file, managed in the include folder. This works fine in combination with the LV_CONF_INCLUDE_SIMPLE tag. But to use the fonts we now have to copy them manually to the /lipdeps/environment/lvgl/src/lv_font folder. But we have to do that for each environment.
I also created a topic on the LVGL forums as it might be an issue with the LVGL library.
Just thinking out loud, if it’s too hard to include the files form the fonts folder, would it be possible to use a script to copy the fonts to the /lipdeps/environment/lvgl/src/lv_font before compiling?
That’s something I tried, I tried both the src and the include folder and manually tried both flags as well: #include “lvgl/lvgl.h” and #include “lvgl.h”. But still no solution.
Both my collegue and I have tried a lot of combo’s in the past, but non of them worked, so we’re used to coping the files to the lib_deps for now. But this now blocks our next step where we would like to use github actions to automatically build the binfiles on release.
I’ve tried all those things. I’ve added them to the src folder with the different #include statements (both #include “lvgl.h” or #include “lvgl/lvgl.h”. Same with the include folder. But that all didn’t work…
Probably I’m doing something wrong, but I’ve spent too much time on this so I’ll stick to the solution I have for now.
Sorry for the delay. I’ve finally experimented with LVGL + external fonts located outside the project source directory. See below what I learned:
PlatformIO allows adding external C/C++ files located outside the project’s source folder to the build process. See more details at Build external sources — PlatformIO latest documentation. However, this approach will not work for your case because the custom LVGL fonts depend on the LVGL library.
Moving custom fonts including C sources to a project’s private lib folder is the right solution and it works out of the box. I created a folder named lvgl-fonts with custom fonts that use #include <lvgl.h> and put it in the project/lib folder. Next, I added lvgl-fonts to the lib_deps in the platformio.ini: