diff --git a/libs/sdl2/source/main.cpp b/libs/sdl2/source/main.cpp index 65857f99..3e5d6152 100644 --- a/libs/sdl2/source/main.cpp +++ b/libs/sdl2/source/main.cpp @@ -13,16 +13,17 @@ #include #ifdef __EMSCRIPTEN__ - #include - #include - #include +#include +#include +#include +#include - struct em_state - { - std::unique_ptr application; - std::unique_ptr window; - psemek::app::application::context context; - } em_state; +struct em_state +{ + std::unique_ptr application; + std::unique_ptr window; + psemek::app::application::context context; +} em_state; #endif #undef main @@ -111,19 +112,17 @@ int main(int argc, char ** argv) try SDL_StopTextInput(); #ifdef __EMSCRIPTEN__ - emscripten_request_animation_frame_loop([](double, void*) -> EM_BOOL { + emscripten_set_main_loop([]{ if (sdl2::poll_events(*em_state.application)) em_state.application->stop(); if (!em_state.application->running()) - return EM_FALSE; + emscripten_cancel_main_loop(); em_state.application->update(); em_state.application->present(); em_state.window->swap(); - - return EM_TRUE; - }, nullptr); + }, 0, 1); #else while (application->running()) { @@ -134,9 +133,10 @@ int main(int argc, char ** argv) try application->present(); window.swap(); } -#endif log::info() << "Quitting"; +#endif + return EXIT_SUCCESS; } catch (psemek::util::exception const & e) diff --git a/package/web/Dockerfile b/package/web/Dockerfile index 57307126..d59b4643 100644 --- a/package/web/Dockerfile +++ b/package/web/Dockerfile @@ -2,10 +2,12 @@ FROM lisyarus/psemek:package-linux # Install emsdk - the version the build was tested at WORKDIR /home -RUN git clone --branch 3.1.46 https://github.com/emscripten-core/emsdk.git +RUN git clone --branch 6.0.2 https://github.com/emscripten-core/emsdk.git WORKDIR /home/emsdk -RUN ./emsdk install 3.1.46 -RUN ./emsdk activate 3.1.46 +RUN ./emsdk install 6.0.2 +RUN ./emsdk activate 6.0.2 +RUN . ./emsdk_env.sh && embuilder build sdl2 sdl2-mt + WORKDIR /home COPY env-helper.sh . # Source emsdk env variables when running the container @@ -13,6 +15,7 @@ ENTRYPOINT ["/home/env-helper.sh"] # Install Boost sources WORKDIR /home +RUN git config --global advice.detachedHead false RUN git clone --recurse-submodules --branch boost-1.87.0 https://github.com/boostorg/boost.git # Install toolchain file & main packaging script diff --git a/package/web/package.sh b/package/web/package.sh index 695fe547..7cf64a85 100755 --- a/package/web/package.sh +++ b/package/web/package.sh @@ -14,7 +14,7 @@ rm -rf ./* # right toolchain. emcmake cmake \ -DBOOST_SOURCE_ROOT=$(realpath ../source)/psemek/3rdparty/boost \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_BUILD_TYPE=Release \ -DPSEMEK_PACKAGE_MODE=ON \ -DPSEMEK_PACKAGE_HOST=OFF \ -DPSEMEK_PACKAGE_TARGET=ON \