Include SDL as subproject to fix CI simulator build (#158)

This commit is contained in:
Ken Van Hoeylandt 2025-01-11 14:40:20 +01:00 committed by GitHub
parent 352ceacfcb
commit 72a9eb1279
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 17 additions and 39 deletions

View File

@ -9,17 +9,9 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
- uses: libsdl-org/setup-sdl@main
id: sdl
with:
install-linux-dependencies: true
version: 2-latest
version-sdl-image: 2-latest
- name: Configure Project - name: Configure Project
uses: threeal/cmake-action@v2.0.0 uses: threeal/cmake-action@v2.0.0
- name: Prepare Project - name: Prepare Project
run: cmake -S ./ -B build run: cmake -S ./ -B build
- name: Build Project - name: Build Project
env:
USE_SDL_WITH_NAMESPACE: true
run: cmake --build build run: cmake --build build

View File

@ -3,8 +3,6 @@ on: [push]
jobs: jobs:
Run: Run:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
SKIP_SDL: true
steps: steps:
- name: "Checkout repo" - name: "Checkout repo"
uses: actions/checkout@v2 uses: actions/checkout@v2

3
.gitmodules vendored
View File

@ -7,3 +7,6 @@
[submodule "Libraries/lvgl"] [submodule "Libraries/lvgl"]
path = Libraries/lvgl path = Libraries/lvgl
url = https://github.com/lvgl/lvgl.git url = https://github.com/lvgl/lvgl.git
[submodule "Libraries/SDL"]
path = Libraries/SDL
url = https://github.com/libsdl-org/SDL.git

View File

@ -24,7 +24,6 @@ if (DEFINED ENV{ESP_IDF_VERSION})
) )
else() else()
file(GLOB_RECURSE SOURCES "Source/*.c*") file(GLOB_RECURSE SOURCES "Source/*.c*")
add_executable(AppSim ${SOURCES}) add_executable(AppSim ${SOURCES})
target_link_libraries(AppSim target_link_libraries(AppSim
@ -32,14 +31,9 @@ else()
PRIVATE TactilityCore PRIVATE TactilityCore
PRIVATE TactilityHeadless PRIVATE TactilityHeadless
PRIVATE Simulator PRIVATE Simulator
PRIVATE SDL2::SDL2-static SDL2-static
) )
if (NOT DEFINED ENV{SKIP_SDL})
find_package(SDL2 REQUIRED CONFIG)
include_directories(${SDL2_INCLUDE_DIRS})
target_link_libraries(AppSim PRIVATE ${SDL2_LIBRARIES})
endif()
add_definitions(-D_Nullable=) add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=) add_definitions(-D_Nonnull=)
endif() endif()

View File

@ -17,13 +17,10 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION})
PRIVATE TactilityCore PRIVATE TactilityCore
PRIVATE TactilityHeadless PRIVATE TactilityHeadless
PRIVATE lvgl PRIVATE lvgl
PRIVATE ${SDL2_LIBRARIES} PRIVATE SDL2-static
) )
if (NOT DEFINED ENV{SKIP_SDL}) target_link_libraries(Simulator PRIVATE ${SDL2_LIBRARIES})
find_package(SDL2 REQUIRED CONFIG)
target_link_libraries(Simulator PRIVATE ${SDL2_LIBRARIES})
endif()
add_definitions(-D_Nullable=) add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=) add_definitions(-D_Nonnull=)

View File

@ -70,6 +70,7 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION})
endif() endif()
if (NOT DEFINED ENV{ESP_IDF_VERSION}) if (NOT DEFINED ENV{ESP_IDF_VERSION})
# FreeRTOS # FreeRTOS
set(FREERTOS_CONFIG_FILE_DIRECTORY ${PROJECT_SOURCE_DIR}/Boards/Simulator/Source CACHE STRING "") set(FREERTOS_CONFIG_FILE_DIRECTORY ${PROJECT_SOURCE_DIR}/Boards/Simulator/Source CACHE STRING "")
set(FREERTOS_PORT GCC_POSIX CACHE STRING "") set(FREERTOS_PORT GCC_POSIX CACHE STRING "")
@ -87,22 +88,19 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION})
add_subdirectory(Libraries/mbedtls) add_subdirectory(Libraries/mbedtls)
# Sim app # Sim app
if (NOT DEFINED ENV{SKIP_SDL}) add_subdirectory(App)
add_subdirectory(App)
endif()
# Tests # Tests
add_subdirectory(Tests) add_subdirectory(Tests)
# SDL
add_compile_definitions($<$<BOOL:${LV_USE_DRAW_SDL}>:LV_USE_DRAW_SDL=1>)
add_subdirectory(Libraries/SDL) # Added as idf component for ESP and as library for other targets
# LVGL # LVGL
add_subdirectory(Libraries/lvgl) # Added as idf component for ESP and as library for other targets add_subdirectory(Libraries/lvgl) # Added as idf component for ESP and as library for other targets
include_directories(lvgl PUBLIC ${PROJECT_SOURCE_DIR}/Libraries/lvgl_conf) include_directories(lvgl PUBLIC ${PROJECT_SOURCE_DIR}/Libraries/lvgl_conf)
if (NOT DEFINED ENV{SKIP_SDL})
find_package(SDL2 REQUIRED CONFIG)
target_include_directories(lvgl PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_libraries(lvgl
PRIVATE ${SDL2_LIBRARIES}
)
endif()
target_compile_definitions(lvgl PUBLIC "-DLV_CONF_PATH=\"${PROJECT_SOURCE_DIR}/Libraries/lvgl_conf/lv_conf_simulator.h\"") target_compile_definitions(lvgl PUBLIC "-DLV_CONF_PATH=\"${PROJECT_SOURCE_DIR}/Libraries/lvgl_conf/lv_conf_simulator.h\"")
target_link_libraries(lvgl PRIVATE SDL2-static)
endif() endif()

View File

@ -13,14 +13,9 @@
- EventFlag: Fix return value of set/get/wait (the errors are weirdly mixed in) - EventFlag: Fix return value of set/get/wait (the errors are weirdly mixed in)
- Consistently use either ESP_TARGET or ESP_PLATFORM - Consistently use either ESP_TARGET or ESP_PLATFORM
- tt_check() failure during app argument bundle nullptr check seems to trigger SIGSEGV - tt_check() failure during app argument bundle nullptr check seems to trigger SIGSEGV
- Fix bug in T-Deck/etc: esp_lvgl_port settings has a large stack depth (~9kB) to fix an issue where the T-Deck would get a stackoverflow. This sometimes happens when WiFi is auto-enabled and you open the app while it is still connecting. - Fix bug in T-Deck/etc: esp_lvgl_port settings has a large stack size (~9kB) to fix an issue where the T-Deck would get a stackoverflow. This sometimes happens when WiFi is auto-enabled and you open the app while it is still connecting.
# TODOs # TODOs
- Try to fix SDL pipeline issue with apt-get:
```yaml
- name: Install SDL
run: sudo apt-get install -y libsdl2-dev cmake
```
- Make "blocking" argument the last one, and put it default to false (or remove it entirely?): void startApp(const std::string& id, bool blocking, std::shared_ptr<const Bundle> parameters) { - Make "blocking" argument the last one, and put it default to false (or remove it entirely?): void startApp(const std::string& id, bool blocking, std::shared_ptr<const Bundle> parameters) {
- Boot hooks instead of a single boot method in config. Define different boot phases/levels in enum. - Boot hooks instead of a single boot method in config. Define different boot phases/levels in enum.
- Add toggle to Display app for sysmon overlay: https://docs.lvgl.io/master/API/others/sysmon/index.html - Add toggle to Display app for sysmon overlay: https://docs.lvgl.io/master/API/others/sysmon/index.html

1
Libraries/SDL Submodule

@ -0,0 +1 @@
Subproject commit 0efeb82a28795e72594642251f1bddcb881aaa7f

View File

@ -163,7 +163,7 @@
#define LV_USE_DRAW_DAVE2D 0 #define LV_USE_DRAW_DAVE2D 0
/* Draw using cached SDL textures*/ /* Draw using cached SDL textures*/
#define LV_USE_DRAW_SDL 0 #define LV_USE_DRAW_SDL 1
/* Use VG-Lite GPU. */ /* Use VG-Lite GPU. */
#define LV_USE_DRAW_VG_LITE 0 #define LV_USE_DRAW_VG_LITE 0