diff --git a/.github/workflows/emsdk.yml b/.github/workflows/emsdk.yml new file mode 100644 index 0000000..2cb7462 --- /dev/null +++ b/.github/workflows/emsdk.yml @@ -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 diff --git a/.gitmodules b/.gitmodules index d49ae25..b25a8cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7981c1e..881a025 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,11 +216,30 @@ 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) +endif() # Get the latest abbreviated commit hash of the working branch execute_process( diff --git a/main.cpp b/main.cpp index b090f6c..5ca894d 100644 --- a/main.cpp +++ b/main.cpp @@ -806,7 +806,7 @@ class Framework { 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