Compare commits

...

4 Commits

Author SHA1 Message Date
Reinhold Gschweicher feb7b1751e CI: add emsdk workflow with jobname 'emscripten' 2022-03-31 21:28:22 +02:00
Reinhold Gschweicher 881f2b83e5 InfiniTime: point to neroburner/emscripten branch 2022-03-31 20:58:37 +02:00
Reinhold Gschweicher 912c71eeaf [WIP] main: per default don't open the status window
Need to see if I can disable the status window completely
when using emscripten.
2022-03-31 20:58:05 +02:00
Reinhold Gschweicher b145409f0a cmake: add emscripten specific flags 2022-03-31 20:58:05 +02:00
4 changed files with 87 additions and 2 deletions

66
.github/workflows/emsdk.yml vendored Normal file
View File

@ -0,0 +1,66 @@
name: Build InfiniSim LVGL Simulator using emscripten
# Run on all branches
push:
branches: []
# Also run this Workflow when a Pull Request is created or updated in the "main" and "develop" Branch
pull_request:
branches: [ main, develop ]
jobs:
emscripten:
runs-on: ubuntu-latest
steps:
#########################################################################################
# Download and Install Dependencies
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11
with:
# Make sure to set a version number!
version: 3.1.8
# This is the name of the cache folder.
# The cache folder will be placed in the build directory,
# so make sure it doesn't conflict with anything!
actions-cache-folder: 'emsdk-cache'
- name: Tell emsdk to use SDL with pthread proxy fix
run: sed -i -e "s/^TAG =.*/TAG = 'ea7d5307acfb1daf9af6104b60b75114b15bcd27'/" -e "s/HASH =.*/HASH = 'b7d58124f0d1145f23338abfdb6aa07855ac74ed80b3a5b613d23b4930c84d04d1794a62aab2ca2680ba369128ee2028ea51236fab4aaf70556036172fa59e6a'/" emsdk-cache/upstream/emscripten/tools/ports/sdl2.py
- name: Verify
run: emcc -v
- name: Install cmake
uses: lukka/get-cmake@v3.18.3
#########################################################################################
# Checkout
- name: Checkout source files
uses: actions/checkout@v2
with:
submodules: recursive
#########################################################################################
# CMake
- name: CMake
run: |
emcmake cmake -S . -B build_em -DCMAKE_BUILD_TYPE=Release
#########################################################################################
# Build and Upload simulator wasm files
- name: Build simulator executable
run: |
cmake --build build_lv_sim
- name: Upload simulator executable
uses: actions/upload-artifact@v3
with:
name: infinisim_emscripten
path: |
build_em/infinisim.html
build_em/infinisim.js
build_em/infinisim.wasm

2
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "InfiniTime"] [submodule "InfiniTime"]
path = InfiniTime path = InfiniTime
url = ../../InfiniTimeOrg/InfiniTime.git url = ../../NeroBurner/InfiniTime.git
[submodule "lv_drivers"] [submodule "lv_drivers"]
path = lv_drivers path = lv_drivers
url = ../../lvgl/lv_drivers.git url = ../../lvgl/lv_drivers.git

View File

@ -216,11 +216,30 @@ target_sources(infinisim PUBLIC
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Special case for SDL2 dependency, goal is to find a config that exports SDL2::SDL2 target # Special case for SDL2 dependency, goal is to find a config that exports SDL2::SDL2 target
# libsdl2-dev has a `sdl2-config.cmake` that doesn't export this, but vcpkg does.. # libsdl2-dev has a `sdl2-config.cmake` that doesn't export this, but vcpkg does..
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
# emcmake cmake -S . -B _build_em
set(USE_FLAGS "-s USE_PTHREADS=1 -pthread")
set(USE_FLAGS "${USE_FLAGS} -s USE_SDL=2")
set(USE_FLAGS "${USE_FLAGS} -fwasm-exceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${USE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${USE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s PTHREAD_POOL_SIZE=4 -s PROXY_TO_PTHREAD=1")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s INITIAL_MEMORY=30736384") # 30MB memory
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ABORTING_MALLOC=0")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORTED_RUNTIME_METHODS=[\"printErr\"]")
set(CMAKE_EXECUTABLE_SUFFIX .html)
target_include_directories(infinisim PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(infinisim PRIVATE ${SDL2_LIBRARIES})
#set_target_properties(infinisim PROPERTIES LINK_FLAGS "--shell-file ${PROJECT_SOURCE_DIR}/lvgl_shell.html")
else()
find_package(SDL2 CONFIG QUIET) find_package(SDL2 CONFIG QUIET)
if(NOT TARGET SDL2::SDL2) if(NOT TARGET SDL2::SDL2)
find_package(SDL2 MODULE REQUIRED) find_package(SDL2 MODULE REQUIRED)
endif() endif()
target_link_libraries(infinisim PRIVATE SDL2::SDL2) target_link_libraries(infinisim PRIVATE SDL2::SDL2)
endif()
# Get the latest abbreviated commit hash of the working branch # Get the latest abbreviated commit hash of the working branch
execute_process( execute_process(

View File

@ -806,7 +806,7 @@ private:
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
// parse arguments // parse arguments
bool fw_status_window_visible = true; bool fw_status_window_visible = false;
bool arg_help = false; bool arg_help = false;
for (int i=1; i<argc; i++) for (int i=1; i<argc; i++)
{ {