I’m using the platformIO on VScode for ESP32. And after I downloaded the latest lvgl8.2 from github and put it inside lib directory. The project now looks like
and I found that I files inside lvgl/demos won’t compile. As a result, when I tried to use the demo program like lv_demo_benchmark, I would receive compile error, which is
D:\Documents\PlatformIO\Projects\test_lvgl_demo/src/main.cpp:91: undefined reference to `lv_demo_benchmark'
And I have already enabled the lv_demo_benchmark by setting the macro definition LV_USE_DEMO_BENCHMARK to 1.
I guess maybe there is something wrong with my way of adding files into compilation, can anybody help me? thank you.
Yes, I have already used that. Actually, the folder structure of lvgl looks like this
When I move the directory lib/lvgl/demos/benchmark into lib/lvgl/src/benchmark, the files inside benchmark are compiled successfully and the compilation error disappers. Does this mean I have to move the source file inside the src of any library, otherwise they would not be compiled?
Yes, I found that by default, srcDir is set to src so that’s why the code inside it is compiled. But is there any way to compile multiple directories together because now srcDir can only be set to one String.
In the library.json. When including a library, it is assumed that you want to use only the source code (src/), not the demo application code (demos/), hence the library.json does not bother adding the demos folder to the compiled sources.
Usually a library.json from a library can’t be easily modified from the platformio.ini of the project. You may however be abel to use a side effect for build_src_filter that when you add paths to it via +<path>, it will add it to the build system. So try something like build_src_filter = +<*> +<..relative path to demos folder here..>