Compare commits

...

17 Commits

Author SHA1 Message Date
Reinhold Gschweicher 4a0aeeb4f2 CI: try to load ./coi-serviceworker.js 2022-03-31 23:12:46 +02:00
Reinhold Gschweicher 2332d1c22f CI: earlier coi-serviceworker.js 2022-03-31 22:57:33 +02:00
Reinhold Gschweicher 99a5c95c93 CI: Use coi-serviceworker for Cross-origin isolation on gh-pages
https://github.com/gzuidhof/coi-serviceworker
2022-03-31 22:44:31 +02:00
Reinhold Gschweicher 0febb00f2b CI: run prepare gh-pages step 2022-03-31 22:16:57 +02:00
Reinhold Gschweicher ae7505bf23 CI: fix gh-deploy action version 2022-03-31 22:12:36 +02:00
Reinhold Gschweicher 9d2bdb94dc Point Infinitime to emscripten branch 2022-03-31 22:10:23 +02:00
Reinhold Gschweicher 48377d1344 CI: use latest release for github-pages-deploy-action 2022-03-31 22:08:15 +02:00
Reinhold Gschweicher 157e092bda CI: actually build on build_em folder 2022-03-31 22:05:25 +02:00
Reinhold Gschweicher 44820d5ce8 CI: don't allow WITH_PNG when building with Emscripten 2022-03-31 22:00:24 +02:00
Reinhold Gschweicher 57ab40be0d CI: gh-pages 2022-03-31 21:56:26 +02:00
Reinhold Gschweicher b2dbbbbabb CI: use EMSDK variable for sed command 2022-03-31 21:42:35 +02:00
Reinhold Gschweicher 529ece6593 CI: fix syntax 2022-03-31 21:35:31 +02:00
Reinhold Gschweicher 12cd16614e CI: rename emsdk name 2022-03-31 21:32:41 +02:00
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
5 changed files with 117 additions and 10 deletions

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

@ -0,0 +1,88 @@
name: Emscripten build InfiniSim LVGL Simulator
# When to run this Workflow...
on:
# 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:
#########################################################################################
# Checkout
- name: Checkout source files
uses: actions/checkout@v2
with:
submodules: recursive
#########################################################################################
# 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}/upstream/emscripten/tools/ports/sdl2.py
- name: Verify
run: emcc -v
- name: Install cmake
uses: lukka/get-cmake@v3.18.3
#########################################################################################
# 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_em
- 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
# using https://github.com/gzuidhof/coi-serviceworker to get Cross-origin isolation on gh-pages
# otherwise the error 'Uncaught ReferenceError: SharedArrayBuffer is not defined' will be shown
- name: Prepare Github Page
shell: bash
run: |
mkdir emscripten
curl -o emscripten/coi-serviceworker.js https://raw.githubusercontent.com/gzuidhof/coi-serviceworker/ed2fbe98a222b8e0991a839f504137408d56d2e6/coi-serviceworker.js
sed -i -e 's#</title>#</title><script src="./coi-serviceworker.js"></script>#' build_em/infinisim.html
mv build_em/infinisim.html \
build_em/infinisim.js \
build_em/infinisim.wasm \
emscripten/.
- name: Deploy Github Page
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: emscripten

2
.gitmodules vendored
View File

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

View File

@ -216,12 +216,38 @@ target_sources(infinisim PUBLIC
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
# 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)
if(NOT TARGET SDL2::SDL2)
find_package(SDL2 MODULE REQUIRED)
endif()
target_link_libraries(infinisim PRIVATE SDL2::SDL2)
option(WITH_PNG "Compile with libpng support to dump current screen as png" ON)
if(WITH_PNG)
target_compile_definitions(infinisim PRIVATE WITH_PNG)
add_subdirectory(libpng EXCLUDE_FROM_ALL)
target_link_libraries(infinisim PRIVATE png_static)
endif()
endif()
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
@ -232,11 +258,4 @@ execute_process(
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
configure_file("${InfiniTime_DIR}/src/Version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/Version.h")
option(WITH_PNG "Compile with libpng support to dump current screen as png" ON)
if(WITH_PNG)
target_compile_definitions(infinisim PRIVATE WITH_PNG)
add_subdirectory(libpng EXCLUDE_FROM_ALL)
target_link_libraries(infinisim PRIVATE png_static)
endif()
install(TARGETS infinisim DESTINATION bin)

@ -1 +1 @@
Subproject commit 8f436e1d74ffdd497c68dc2f34f6a67e430a1932
Subproject commit a1dac63672eee6f301d62cfa065f56ca8ea90266

View File

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