emscripten: Add JS library dependencies using EM_JS_DEPS macro See https://github.com/emscripten-core/emscripten/pull/19780 (cherry picked from commit 042243471fb7ecf6ba5e53f0ba35e825a8bb066a)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml
index b32410a..5603e20 100644
--- a/.github/workflows/emscripten.yml
+++ b/.github/workflows/emscripten.yml
@@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v12
with:
- version: 2.0.32
+ version: 3.1.35
- name: Install ninja
run: |
sudo apt-get -y update
diff --git a/docs/README-emscripten.md b/docs/README-emscripten.md
index 5f8c277..147e18d 100644
--- a/docs/README-emscripten.md
+++ b/docs/README-emscripten.md
@@ -38,7 +38,7 @@ for some Javascript code to steal for this approach.
## Building SDL/emscripten
-SDL currently requires at least Emscripten 2.0.32 to build. Newer versions
+SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
are likely to work, as well.
diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c
index af5f095..341c9df 100644
--- a/src/audio/emscripten/SDL_emscriptenaudio.c
+++ b/src/audio/emscripten/SDL_emscriptenaudio.c
@@ -197,6 +197,8 @@ static void EMSCRIPTENAUDIO_CloseDevice(_THIS)
#endif
}
+EM_JS_DEPS(sdlaudio, "$autoResumeAudioContext,$dynCall");
+
static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
{
SDL_AudioFormat test_format;
diff --git a/src/misc/emscripten/SDL_sysurl.c b/src/misc/emscripten/SDL_sysurl.c
index 12cb156..1d707fc 100644
--- a/src/misc/emscripten/SDL_sysurl.c
+++ b/src/misc/emscripten/SDL_sysurl.c
@@ -23,13 +23,11 @@
#include <emscripten/emscripten.h>
+EM_JS_DEPS(sdlsysurl, "$UTF8ToString");
+
int SDL_SYS_OpenURL(const char *url)
{
- EM_ASM({
- window.open(UTF8ToString($0), "_blank");
- },
- url);
-
+ EM_ASM(window.open(UTF8ToString($0), "_blank"), url);
return 0;
}
diff --git a/src/video/emscripten/SDL_emscriptenmouse.c b/src/video/emscripten/SDL_emscriptenmouse.c
index 822995c..7dea22b 100644
--- a/src/video/emscripten/SDL_emscriptenmouse.c
+++ b/src/video/emscripten/SDL_emscriptenmouse.c
@@ -60,6 +60,8 @@ static SDL_Cursor *Emscripten_CreateDefaultCursor()
return Emscripten_CreateCursorFromString("default", SDL_FALSE);
}
+EM_JS_DEPS(sdlmouse, "$stringToUTF8,$UTF8ToString");
+
static SDL_Cursor *Emscripten_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
{
const char *cursor_url = NULL;