搭建LVGL仿真环境
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
cmake_minimum_required(VERSION 3.12.4)
|
||||
|
||||
project(lvgl LANGUAGES C)
|
||||
|
||||
set(LVGL_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# 收集所有 LVGL 源文件
|
||||
file(GLOB_RECURSE LVGL_SOURCES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.c"
|
||||
)
|
||||
|
||||
# 创建静态库
|
||||
add_library(lvgl STATIC ${LVGL_SOURCES})
|
||||
|
||||
# 基础包含路径
|
||||
target_include_directories(lvgl PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src
|
||||
)
|
||||
|
||||
# 如果调用者定义了 LV_CONF_DIR,将其加入包含路径(供 lv_conf.h 查找)
|
||||
if(DEFINED LV_CONF_DIR)
|
||||
target_include_directories(lvgl PUBLIC ${LV_CONF_DIR})
|
||||
endif()
|
||||
|
||||
# 如果调用者定义了 SDL2_INCLUDE_DIR,将其加入包含路径(供 SDL 驱动使用)
|
||||
if(DEFINED SDL2_INCLUDE_DIR)
|
||||
target_include_directories(lvgl PUBLIC ${SDL2_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# 编译定义
|
||||
target_compile_definitions(lvgl PRIVATE
|
||||
LV_CONF_INCLUDE_SIMPLE
|
||||
)
|
||||
|
||||
# 关闭一些警告
|
||||
if(MSVC)
|
||||
target_compile_options(lvgl PRIVATE /W0)
|
||||
else()
|
||||
target_compile_options(lvgl PRIVATE -w)
|
||||
endif()
|
||||
Reference in New Issue
Block a user