What MCU/Processor/Board and compiler are you using?
M5Stack Dial, ESP32-S3 based
What do you want to achieve?
Is it possible to drop, let’s say, the entire lvgl/lvgl_editor/tutorials/1_hello_world content into \components\lib-ui folder of ESP-IDF project and somehow make it compile by ESP-IDF without altering of generated CMakeLists.txt? This way I’d be able to open this folder in LVGL editor, work on the UI with previews and all, and also open the root project and work on the rest and be able to run ESP-IDF compilation from there to get the complete project.
What have you tried so far?
Tried to make just what desribed above. CMake throws project command is not scriptable. I’m quite new to this all so I’m likely missing some key concepts. Unfortunately Use the exported C code is empty in the docs, and I failed to google anything sensible on the topic.
For the reference, this CMakeLists.txt works for the component
# This includes the generated list of .c files
include(${CMAKE_CURRENT_LIST_DIR}/file_list_gen.cmake)
# You may use this check to add configuration when compiling for the Editor
# preview, or for your target.
if (LV_EDITOR_PREVIEW)
# things for the Preview
# Create the UI sources as a library
add_library(lib-ui ${PROJECT_SOURCES})
else ()
# things for your target
idf_component_register(
SRCS ${PROJECT_SOURCES}
INCLUDE_DIRS "."
REQUIRES lvgl
)
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_LVGL_H_INCLUDE_SIMPLE")
# set your include directories here, don't forget LVGL!
endif ()
Maybe it’s better to have LV_EDITOR_PREVIEW related stuff as well as target specific stuff in separate .cmake files, the same way as file_list_gen.cmake
I’m currently doing the very same. If you don’t mind, could you elaborate a bit on how you moved everything to your “actual” project and how you then intialized your UI?
I would very much appreciate that.
The main CMakeLists.txt exported by the LVGL Editor can be safely modifed as it won’t get regenerated again.
That else branch you modified is exactly what is expected to be modified. Since the UI can run in any platform, the goal here is for the user to modify to make it work with whatever platform they’re using. Note that it’s not mandatory to use cmake either, it’s just a convenient way of setting things up