cmake_minimum_required(VERSION 3.17) project(LvglApplication) find_package(SDL2 REQUIRED) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -s USE_SDL=2") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -s USE_SDL=2") # 使用这个可以帮助查看如何使用和集成wasm set(CMAKE_EXECUTABLE_SUFFIX ".html") add_executable(lvglapp main.cpp ) target_link_options(lvglapp PRIVATE --shell-file=${CMAKE_CURRENT_SOURCE_DIR}/lvgl_shell.html ) include(FetchContent) FetchContent_Declare( lvgl GIT_REPOSITORY https://github.com/lvgl/lvgl.git GIT_TAG v9.2.2 SOURCE_DIR lvgl ) set(LV_CONF_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lv_conf.h) set(LV_CONF_BUILD_DISABLE_EXAMPLES ON) # set(LV_CONF_BUILD_DISABLE_DEMOS ON) FetchContent_MakeAvailable(lvgl) target_include_directories(lvglapp PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ) # sudo apt-get install libsdl2-dev target_link_libraries(lvglapp PRIVATE lvgl::demos PRIVATE lvgl::lvgl PRIVATE lvgl::thorvg PRIVATE embind PRIVATE SDL2 )