Compare commits
17 Commits
rei/develo
...
emscripten
Author | SHA1 | Date |
---|---|---|
Reinhold Gschweicher | 4a0aeeb4f2 | |
Reinhold Gschweicher | 2332d1c22f | |
Reinhold Gschweicher | 99a5c95c93 | |
Reinhold Gschweicher | 0febb00f2b | |
Reinhold Gschweicher | ae7505bf23 | |
Reinhold Gschweicher | 9d2bdb94dc | |
Reinhold Gschweicher | 48377d1344 | |
Reinhold Gschweicher | 157e092bda | |
Reinhold Gschweicher | 44820d5ce8 | |
Reinhold Gschweicher | 57ab40be0d | |
Reinhold Gschweicher | b2dbbbbabb | |
Reinhold Gschweicher | 529ece6593 | |
Reinhold Gschweicher | 12cd16614e | |
Reinhold Gschweicher | feb7b1751e | |
Reinhold Gschweicher | 881f2b83e5 | |
Reinhold Gschweicher | 912c71eeaf | |
Reinhold Gschweicher | b145409f0a |
|
@ -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
|
|
@ -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
|
||||||
|
|
|
@ -216,12 +216,38 @@ 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)
|
||||||
|
|
||||||
|
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
|
# Get the latest abbreviated commit hash of the working branch
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
|
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!")
|
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")
|
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)
|
install(TARGETS infinisim DESTINATION bin)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8f436e1d74ffdd497c68dc2f34f6a67e430a1932
|
Subproject commit a1dac63672eee6f301d62cfa065f56ca8ea90266
|
2
main.cpp
2
main.cpp
|
@ -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++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue