LVGL Editor: Proper Zephyr integration of generated C files

Dear all,

I’d like to ask what is the clean way of integrating LVGL Editor generated C files into a Zephyr project. The documentation states that “In the CMakeLists.txt file of the ui_project/ directory, created by the LVGL Editor, add…” But the issue is, that this file is automatically generated and gets regenerated when building the project from the editor. Also, the very first comment in that file clearly states that I’m not supposed to edit it.

I tried editing the CMakeLists.txt and I was able to build my Zephyr app, but as stated above, my changes are discarded as soon as I rebuild the project from the editor.

Is the documentation correct, or am I missing something?

Many thanks!

Environment

  • LVGL Editor v1.2.1
  • LVGL v9.4

Hi @ladivin,

Thank you for sending a message. Regarding CMake configuration, I’m using it like this, it’s not necessary to edit the CMake file in ui project (generated). Any question, let me know.

Main CMakeLists.txt

add_subdirectory(your_ui_dir)

target_link_libraries(app PUBLIC lib-ui)
target_compile_definitions(lib-ui PUBLIC LV_ZEPHYR=1)
target_link_libraries(lib-ui PUBLIC zephyr_interface)
target_compile_definitions(lib-ui PUBLIC
    LV_LVGL_H_INCLUDE_SIMPLE=1
)

target_include_directories(lib-ui PUBLIC
${CMAKE_BINARY_DIR}/zephyr/include/generated/lvgl
${ZEPHYR_LVGL_MODULE_DIR})

Hi @halyssonJr ,

many thanks for your response! Your solution works great.

However, this makes me feel that the documentation (link in my original post) is indeed wrong, because it explicitly asks you to modify the generated CMakeLists.txt. And there is one more statement there, which seems to be incorrect:

Zephyr automatically defines the LV_CONF_INCLUDE_SIMPLE symbol during the LVGL module build process, so it is not necessary to define it manually in your CMakeLists.txt.

In fact - and your solution shows it too - it is necessary to manually define this macro.

Do you think it’s worth creating an issue on LVGL Editor Github? I guess it would be good to fix this not to confuse others.

Again, many thanks!

Hi @ladivin ,

Great news!!!
I created this documentation about this integration with Zephyr. Thank you for opening this discussion. But for any issue-related documentation, you should open an issue in LVGL Open repo.