Update to emscripten 6 and pre-build sdl2 in web packaging image
This commit is contained in:
parent
f30da1a2ad
commit
8587ba6bc0
3 changed files with 22 additions and 19 deletions
|
|
@ -13,16 +13,17 @@
|
|||
#include <psemek/util/terminal_color.hpp>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/wasmfs.h>
|
||||
|
||||
struct em_state
|
||||
{
|
||||
std::unique_ptr<psemek::app::application> application;
|
||||
std::unique_ptr<psemek::sdl2::window> window;
|
||||
psemek::app::application::context context;
|
||||
} em_state;
|
||||
struct em_state
|
||||
{
|
||||
std::unique_ptr<psemek::app::application> application;
|
||||
std::unique_ptr<psemek::sdl2::window> 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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue