emscripten: Add JS library dependencies using EM_JS_DEPS macro

See https://github.com/emscripten-core/emscripten/pull/19780

(cherry picked from commit 042243471f)
This commit is contained in:
Sam Clegg 2023-07-05 13:52:37 -07:00 committed by Ryan C. Gordon
parent 95033e87e1
commit b42cb1c6f2
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
5 changed files with 10 additions and 7 deletions

View File

@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v10
with:
version: 2.0.32
version: 3.1.35
- name: Install ninja
run: |
sudo apt-get -y update

View File

@ -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.

View File

@ -196,6 +196,9 @@ static void EMSCRIPTENAUDIO_CloseDevice(SDL_AudioDevice *_this)
#endif
}
EM_JS_DEPS(sdlaudio, "$autoResumeAudioContext,$dynCall");
static int EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *_this, const char *devname)
{
SDL_AudioFormat test_format;

View File

@ -24,12 +24,10 @@
#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;
}

View File

@ -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;