hunting/middleware/GuiEngine/README.md
2024-06-15 08:35:07 +08:00

50 lines
2.2 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 1. GUI引擎
   负责对接GUI开源库。包括ubuntu动态对接lvgl模拟器和开发板的lvgl库。
## 1.1. 目录
* lvgl_common
   lvgl引擎接口二次封装的公共源码目的是把lvgl开源库的接口解耦合避免lvgl接口兼容导致的迭代困难。
* lvgl_board
   交叉编译源码目录含fb驱动。lvgl源码版本和模拟器一致。
* lvgl_x86
   ubuntu系统模拟器源码。
## 1.2. 编译静态链接
   根据构建脚本TARGET_PLATFORM的定义来选择链接lvgl_x86或者lvgl_board
```
// 只有两种链接情况分别使用gcc编译和交叉编译
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX}) // 第一链接PC模拟器此处模拟器单独编译成lvgl-x86库
# build the lvgl sumlator in linux.
include_directories(
./lvgl_common
${EXTERNAL_SOURCE_PATH}/lvglLinux-x86/lv_sim_vscode_sdl/lvgl
)
aux_source_directory(./lvgl_x86 SRC_FILES)
aux_source_directory(./lvgl_common SRC_FILES)
set(TARGET_NAME GuiEngine-lvglx86)
add_library(${TARGET_NAME} STATIC ${SRC_FILES})
target_link_libraries(${TARGET_NAME} lvgl-x86 ReturnCode Log) // 链接模拟器库
else() // 第二链接fb驱动代码此处驱动源码lvgl源码编译成GuiEngine-board库
include_directories(
./lvgl_common
${EXTERNAL_SOURCE_PATH}/lvglBoard
${EXTERNAL_SOURCE_PATH}/lvglBoard/lvgl
${EXTERNAL_SOURCE_PATH}/lvglBoard/lv_drivers
)
aux_source_directory(./lvgl_board SRC_FILES)
aux_source_directory(./lvgl_common SRC_FILES)
file(GLOB_RECURSE LVGL_SRC_FILES ${EXTERNAL_SOURCE_PATH}/lvglBoard/lvgl/src/*c) // 获取lvgl源码
file(GLOB_RECURSE LVGL_DRIVERS_SRC_FILES ${EXTERNAL_SOURCE_PATH}/lvglBoard/lv_drivers/*c) // 获取驱动源码
set(TARGET_NAME GuiEngine-board)
add_library(${TARGET_NAME} STATIC ${SRC_FILES} ${LVGL_SRC_FILES} ${LVGL_DRIVERS_SRC_FILES})
target_link_libraries(${TARGET_NAME} GuiEngineAbstract ReturnCode Log)
endif()
```