diff --git a/site/source/docs/tools_reference/settings_reference.rst b/site/source/docs/tools_reference/settings_reference.rst index 8941a9d44b207..4b52b81a2dcf1 100644 --- a/site/source/docs/tools_reference/settings_reference.rst +++ b/site/source/docs/tools_reference/settings_reference.rst @@ -2181,11 +2181,12 @@ Default value: true USE_SDL ======= -Specify the SDL version that is being linked against. -1, the default, is 1.3, which is implemented in JS -2 is a port of the SDL C code on emscripten-ports -When AUTO_JS_LIBRARIES is set to 0 this defaults to 0 and SDL -is not linked in. +Specify the SDL version that is being linked against: + +- 0, the default, means no SDL headers or libraries will be used. +- 1 is port of SDL 1.3 which is implemented in JS. +- 2 and 3 are upstream ports build from the official SDL codebase. + Alternate syntax for using the port: --use-port=sdl2 .. note:: Applicable during both linking and compilation diff --git a/src/modules.mjs b/src/modules.mjs index e7ba4ac0222d9..04f079d30b00f 100644 --- a/src/modules.mjs +++ b/src/modules.mjs @@ -143,21 +143,19 @@ function calculateLibraries() { 'libidbstore.js', 'libasync.js', ); - if (USE_SDL != 2) { - libraries.push('libsdl.js'); - } } else { if (ASYNCIFY) { libraries.push('libasync.js'); } - if (USE_SDL == 1) { - libraries.push('libsdl.js'); - } if (USE_SDL == 2) { libraries.push('libegl.js', 'libwebgl.js', 'libhtml5_webgl.js'); } } + if (USE_SDL == 1) { + libraries.push('libsdl.js'); + } + if (USE_GLFW) { libraries.push('libglfw.js'); } diff --git a/src/settings.js b/src/settings.js index 9a755c2b50bb4..f3b93aebcec8a 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1498,11 +1498,12 @@ var LEGALIZE_JS_FFI = true; // Ports -// Specify the SDL version that is being linked against. -// 1, the default, is 1.3, which is implemented in JS -// 2 is a port of the SDL C code on emscripten-ports -// When AUTO_JS_LIBRARIES is set to 0 this defaults to 0 and SDL -// is not linked in. +// Specify the SDL version that is being linked against: +// +// - 0, the default, means no SDL headers or libraries will be used. +// - 1 is port of SDL 1.3 which is implemented in JS. +// - 2 and 3 are upstream ports build from the official SDL codebase. +// // Alternate syntax for using the port: --use-port=sdl2 // [compile+link] var USE_SDL = 0; diff --git a/system/include/fakesdl/SDL.h b/system/include/fakesdl/SDL/SDL.h similarity index 100% rename from system/include/fakesdl/SDL.h rename to system/include/fakesdl/SDL/SDL.h diff --git a/system/include/fakesdl/SDL_assert.h b/system/include/fakesdl/SDL/SDL_assert.h similarity index 100% rename from system/include/fakesdl/SDL_assert.h rename to system/include/fakesdl/SDL/SDL_assert.h diff --git a/system/include/fakesdl/SDL_atomic.h b/system/include/fakesdl/SDL/SDL_atomic.h similarity index 100% rename from system/include/fakesdl/SDL_atomic.h rename to system/include/fakesdl/SDL/SDL_atomic.h diff --git a/system/include/fakesdl/SDL_audio.h b/system/include/fakesdl/SDL/SDL_audio.h similarity index 100% rename from system/include/fakesdl/SDL_audio.h rename to system/include/fakesdl/SDL/SDL_audio.h diff --git a/system/include/fakesdl/SDL_blendmode.h b/system/include/fakesdl/SDL/SDL_blendmode.h similarity index 100% rename from system/include/fakesdl/SDL_blendmode.h rename to system/include/fakesdl/SDL/SDL_blendmode.h diff --git a/system/include/fakesdl/SDL_clipboard.h b/system/include/fakesdl/SDL/SDL_clipboard.h similarity index 100% rename from system/include/fakesdl/SDL_clipboard.h rename to system/include/fakesdl/SDL/SDL_clipboard.h diff --git a/system/include/fakesdl/SDL_compat.h b/system/include/fakesdl/SDL/SDL_compat.h similarity index 100% rename from system/include/fakesdl/SDL_compat.h rename to system/include/fakesdl/SDL/SDL_compat.h diff --git a/system/include/fakesdl/SDL_config.h b/system/include/fakesdl/SDL/SDL_config.h similarity index 100% rename from system/include/fakesdl/SDL_config.h rename to system/include/fakesdl/SDL/SDL_config.h diff --git a/system/include/fakesdl/SDL_copying.h b/system/include/fakesdl/SDL/SDL_copying.h similarity index 100% rename from system/include/fakesdl/SDL_copying.h rename to system/include/fakesdl/SDL/SDL_copying.h diff --git a/system/include/fakesdl/SDL_cpuinfo.h b/system/include/fakesdl/SDL/SDL_cpuinfo.h similarity index 100% rename from system/include/fakesdl/SDL_cpuinfo.h rename to system/include/fakesdl/SDL/SDL_cpuinfo.h diff --git a/system/include/fakesdl/SDL_endian.h b/system/include/fakesdl/SDL/SDL_endian.h similarity index 100% rename from system/include/fakesdl/SDL_endian.h rename to system/include/fakesdl/SDL/SDL_endian.h diff --git a/system/include/fakesdl/SDL_error.h b/system/include/fakesdl/SDL/SDL_error.h similarity index 100% rename from system/include/fakesdl/SDL_error.h rename to system/include/fakesdl/SDL/SDL_error.h diff --git a/system/include/fakesdl/SDL_events.h b/system/include/fakesdl/SDL/SDL_events.h similarity index 100% rename from system/include/fakesdl/SDL_events.h rename to system/include/fakesdl/SDL/SDL_events.h diff --git a/system/include/fakesdl/SDL_gesture.h b/system/include/fakesdl/SDL/SDL_gesture.h similarity index 100% rename from system/include/fakesdl/SDL_gesture.h rename to system/include/fakesdl/SDL/SDL_gesture.h diff --git a/system/include/fakesdl/SDL_gfxPrimitives.h b/system/include/fakesdl/SDL/SDL_gfxPrimitives.h similarity index 100% rename from system/include/fakesdl/SDL_gfxPrimitives.h rename to system/include/fakesdl/SDL/SDL_gfxPrimitives.h diff --git a/system/include/fakesdl/SDL_haptic.h b/system/include/fakesdl/SDL/SDL_haptic.h similarity index 100% rename from system/include/fakesdl/SDL_haptic.h rename to system/include/fakesdl/SDL/SDL_haptic.h diff --git a/system/include/fakesdl/SDL_hints.h b/system/include/fakesdl/SDL/SDL_hints.h similarity index 100% rename from system/include/fakesdl/SDL_hints.h rename to system/include/fakesdl/SDL/SDL_hints.h diff --git a/system/include/fakesdl/SDL_image.h b/system/include/fakesdl/SDL/SDL_image.h similarity index 100% rename from system/include/fakesdl/SDL_image.h rename to system/include/fakesdl/SDL/SDL_image.h diff --git a/system/include/fakesdl/SDL_input.h b/system/include/fakesdl/SDL/SDL_input.h similarity index 100% rename from system/include/fakesdl/SDL_input.h rename to system/include/fakesdl/SDL/SDL_input.h diff --git a/system/include/fakesdl/SDL_joystick.h b/system/include/fakesdl/SDL/SDL_joystick.h similarity index 100% rename from system/include/fakesdl/SDL_joystick.h rename to system/include/fakesdl/SDL/SDL_joystick.h diff --git a/system/include/fakesdl/SDL_keyboard.h b/system/include/fakesdl/SDL/SDL_keyboard.h similarity index 100% rename from system/include/fakesdl/SDL_keyboard.h rename to system/include/fakesdl/SDL/SDL_keyboard.h diff --git a/system/include/fakesdl/SDL_keycode.h b/system/include/fakesdl/SDL/SDL_keycode.h similarity index 100% rename from system/include/fakesdl/SDL_keycode.h rename to system/include/fakesdl/SDL/SDL_keycode.h diff --git a/system/include/fakesdl/SDL_loadso.h b/system/include/fakesdl/SDL/SDL_loadso.h similarity index 100% rename from system/include/fakesdl/SDL_loadso.h rename to system/include/fakesdl/SDL/SDL_loadso.h diff --git a/system/include/fakesdl/SDL_log.h b/system/include/fakesdl/SDL/SDL_log.h similarity index 100% rename from system/include/fakesdl/SDL_log.h rename to system/include/fakesdl/SDL/SDL_log.h diff --git a/system/include/fakesdl/SDL_main.h b/system/include/fakesdl/SDL/SDL_main.h similarity index 100% rename from system/include/fakesdl/SDL_main.h rename to system/include/fakesdl/SDL/SDL_main.h diff --git a/system/include/fakesdl/SDL_mixer.h b/system/include/fakesdl/SDL/SDL_mixer.h similarity index 100% rename from system/include/fakesdl/SDL_mixer.h rename to system/include/fakesdl/SDL/SDL_mixer.h diff --git a/system/include/fakesdl/SDL_mouse.h b/system/include/fakesdl/SDL/SDL_mouse.h similarity index 100% rename from system/include/fakesdl/SDL_mouse.h rename to system/include/fakesdl/SDL/SDL_mouse.h diff --git a/system/include/fakesdl/SDL_mutex.h b/system/include/fakesdl/SDL/SDL_mutex.h similarity index 100% rename from system/include/fakesdl/SDL_mutex.h rename to system/include/fakesdl/SDL/SDL_mutex.h diff --git a/system/include/fakesdl/SDL_name.h b/system/include/fakesdl/SDL/SDL_name.h similarity index 100% rename from system/include/fakesdl/SDL_name.h rename to system/include/fakesdl/SDL/SDL_name.h diff --git a/system/include/fakesdl/SDL_opengl.h b/system/include/fakesdl/SDL/SDL_opengl.h similarity index 100% rename from system/include/fakesdl/SDL_opengl.h rename to system/include/fakesdl/SDL/SDL_opengl.h diff --git a/system/include/fakesdl/SDL_opengles.h b/system/include/fakesdl/SDL/SDL_opengles.h similarity index 100% rename from system/include/fakesdl/SDL_opengles.h rename to system/include/fakesdl/SDL/SDL_opengles.h diff --git a/system/include/fakesdl/SDL_opengles2.h b/system/include/fakesdl/SDL/SDL_opengles2.h similarity index 100% rename from system/include/fakesdl/SDL_opengles2.h rename to system/include/fakesdl/SDL/SDL_opengles2.h diff --git a/system/include/fakesdl/SDL_pixels.h b/system/include/fakesdl/SDL/SDL_pixels.h similarity index 100% rename from system/include/fakesdl/SDL_pixels.h rename to system/include/fakesdl/SDL/SDL_pixels.h diff --git a/system/include/fakesdl/SDL_platform.h b/system/include/fakesdl/SDL/SDL_platform.h similarity index 100% rename from system/include/fakesdl/SDL_platform.h rename to system/include/fakesdl/SDL/SDL_platform.h diff --git a/system/include/fakesdl/SDL_power.h b/system/include/fakesdl/SDL/SDL_power.h similarity index 100% rename from system/include/fakesdl/SDL_power.h rename to system/include/fakesdl/SDL/SDL_power.h diff --git a/system/include/fakesdl/SDL_quit.h b/system/include/fakesdl/SDL/SDL_quit.h similarity index 100% rename from system/include/fakesdl/SDL_quit.h rename to system/include/fakesdl/SDL/SDL_quit.h diff --git a/system/include/fakesdl/SDL_rect.h b/system/include/fakesdl/SDL/SDL_rect.h similarity index 100% rename from system/include/fakesdl/SDL_rect.h rename to system/include/fakesdl/SDL/SDL_rect.h diff --git a/system/include/fakesdl/SDL_render.h b/system/include/fakesdl/SDL/SDL_render.h similarity index 100% rename from system/include/fakesdl/SDL_render.h rename to system/include/fakesdl/SDL/SDL_render.h diff --git a/system/include/fakesdl/SDL_revision.h b/system/include/fakesdl/SDL/SDL_revision.h similarity index 100% rename from system/include/fakesdl/SDL_revision.h rename to system/include/fakesdl/SDL/SDL_revision.h diff --git a/system/include/fakesdl/SDL_rotozoom.h b/system/include/fakesdl/SDL/SDL_rotozoom.h similarity index 100% rename from system/include/fakesdl/SDL_rotozoom.h rename to system/include/fakesdl/SDL/SDL_rotozoom.h diff --git a/system/include/fakesdl/SDL_rwops.h b/system/include/fakesdl/SDL/SDL_rwops.h similarity index 100% rename from system/include/fakesdl/SDL_rwops.h rename to system/include/fakesdl/SDL/SDL_rwops.h diff --git a/system/include/fakesdl/SDL_scancode.h b/system/include/fakesdl/SDL/SDL_scancode.h similarity index 100% rename from system/include/fakesdl/SDL_scancode.h rename to system/include/fakesdl/SDL/SDL_scancode.h diff --git a/system/include/fakesdl/SDL_shape.h b/system/include/fakesdl/SDL/SDL_shape.h similarity index 100% rename from system/include/fakesdl/SDL_shape.h rename to system/include/fakesdl/SDL/SDL_shape.h diff --git a/system/include/fakesdl/SDL_stdinc.h b/system/include/fakesdl/SDL/SDL_stdinc.h similarity index 100% rename from system/include/fakesdl/SDL_stdinc.h rename to system/include/fakesdl/SDL/SDL_stdinc.h diff --git a/system/include/fakesdl/SDL_surface.h b/system/include/fakesdl/SDL/SDL_surface.h similarity index 100% rename from system/include/fakesdl/SDL_surface.h rename to system/include/fakesdl/SDL/SDL_surface.h diff --git a/system/include/fakesdl/SDL_syswm.h b/system/include/fakesdl/SDL/SDL_syswm.h similarity index 100% rename from system/include/fakesdl/SDL_syswm.h rename to system/include/fakesdl/SDL/SDL_syswm.h diff --git a/system/include/fakesdl/SDL_thread.h b/system/include/fakesdl/SDL/SDL_thread.h similarity index 100% rename from system/include/fakesdl/SDL_thread.h rename to system/include/fakesdl/SDL/SDL_thread.h diff --git a/system/include/fakesdl/SDL_timer.h b/system/include/fakesdl/SDL/SDL_timer.h similarity index 100% rename from system/include/fakesdl/SDL_timer.h rename to system/include/fakesdl/SDL/SDL_timer.h diff --git a/system/include/fakesdl/SDL_touch.h b/system/include/fakesdl/SDL/SDL_touch.h similarity index 100% rename from system/include/fakesdl/SDL_touch.h rename to system/include/fakesdl/SDL/SDL_touch.h diff --git a/system/include/fakesdl/SDL_ttf.h b/system/include/fakesdl/SDL/SDL_ttf.h similarity index 100% rename from system/include/fakesdl/SDL_ttf.h rename to system/include/fakesdl/SDL/SDL_ttf.h diff --git a/system/include/fakesdl/SDL_types.h b/system/include/fakesdl/SDL/SDL_types.h similarity index 100% rename from system/include/fakesdl/SDL_types.h rename to system/include/fakesdl/SDL/SDL_types.h diff --git a/system/include/fakesdl/SDL_version.h b/system/include/fakesdl/SDL/SDL_version.h similarity index 100% rename from system/include/fakesdl/SDL_version.h rename to system/include/fakesdl/SDL/SDL_version.h diff --git a/system/include/fakesdl/SDL_video.h b/system/include/fakesdl/SDL/SDL_video.h similarity index 100% rename from system/include/fakesdl/SDL_video.h rename to system/include/fakesdl/SDL/SDL_video.h diff --git a/test/codesize/test_codesize_hello_O0.json b/test/codesize/test_codesize_hello_O0.json index c88041660275d..6bf9f375ff7ac 100644 --- a/test/codesize/test_codesize_hello_O0.json +++ b/test/codesize/test_codesize_hello_O0.json @@ -1,10 +1,10 @@ { - "a.out.js": 24268, - "a.out.js.gz": 8718, + "a.out.js": 24256, + "a.out.js.gz": 8709, "a.out.nodebug.wasm": 15138, "a.out.nodebug.wasm.gz": 7455, - "total": 39406, - "total_gz": 16173, + "total": 39394, + "total_gz": 16164, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index 4799ec52b028b..faad9d628f628 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,208 +1,8 @@ { - "a.out.js": 244691, + "a.out.js": 205013, "a.out.nodebug.wasm": 577706, - "total": 822397, + "total": 782719, "sent": [ - "IMG_Init", - "IMG_Load", - "IMG_Load_RW", - "IMG_Quit", - "Mix_AllocateChannels", - "Mix_ChannelFinished", - "Mix_CloseAudio", - "Mix_FadeInChannelTimed", - "Mix_FadeInMusicPos", - "Mix_FadeOutChannel", - "Mix_FadeOutMusic", - "Mix_FadingChannel", - "Mix_FreeChunk", - "Mix_FreeMusic", - "Mix_HaltChannel", - "Mix_HaltMusic", - "Mix_HookMusicFinished", - "Mix_Init", - "Mix_Linked_Version", - "Mix_LoadMUS", - "Mix_LoadMUS_RW", - "Mix_LoadWAV", - "Mix_LoadWAV_RW", - "Mix_OpenAudio", - "Mix_Pause", - "Mix_PauseMusic", - "Mix_Paused", - "Mix_PausedMusic", - "Mix_PlayChannelTimed", - "Mix_PlayMusic", - "Mix_Playing", - "Mix_PlayingMusic", - "Mix_QuerySpec", - "Mix_QuickLoad_RAW", - "Mix_Quit", - "Mix_ReserveChannels", - "Mix_Resume", - "Mix_ResumeMusic", - "Mix_SetPanning", - "Mix_SetPosition", - "Mix_SetPostMix", - "Mix_Volume", - "Mix_VolumeChunk", - "Mix_VolumeMusic", - "SDL_AddTimer", - "SDL_AllocRW", - "SDL_AudioDriverName", - "SDL_AudioQuit", - "SDL_ClearError", - "SDL_CloseAudio", - "SDL_CondBroadcast", - "SDL_CondSignal", - "SDL_CondWait", - "SDL_CondWaitTimeout", - "SDL_ConvertSurface", - "SDL_CreateCond", - "SDL_CreateMutex", - "SDL_CreateRGBSurface", - "SDL_CreateRGBSurfaceFrom", - "SDL_CreateThread", - "SDL_Delay", - "SDL_DestroyCond", - "SDL_DestroyMutex", - "SDL_DestroyRenderer", - "SDL_DestroyWindow", - "SDL_DisplayFormat", - "SDL_DisplayFormatAlpha", - "SDL_EnableKeyRepeat", - "SDL_EnableUNICODE", - "SDL_FillRect", - "SDL_Flip", - "SDL_FreeRW", - "SDL_FreeSurface", - "SDL_GL_DeleteContext", - "SDL_GL_ExtensionSupported", - "SDL_GL_GetAttribute", - "SDL_GL_GetSwapInterval", - "SDL_GL_MakeCurrent", - "SDL_GL_SetAttribute", - "SDL_GL_SetSwapInterval", - "SDL_GL_SwapBuffers", - "SDL_GL_SwapWindow", - "SDL_GetAppState", - "SDL_GetAudioDriver", - "SDL_GetClipRect", - "SDL_GetCurrentAudioDriver", - "SDL_GetError", - "SDL_GetKeyName", - "SDL_GetKeyState", - "SDL_GetKeyboardState", - "SDL_GetModState", - "SDL_GetMouseState", - "SDL_GetNumAudioDrivers", - "SDL_GetRGB", - "SDL_GetRGBA", - "SDL_GetScancodeFromKey", - "SDL_GetThreadID", - "SDL_GetTicks", - "SDL_GetVideoInfo", - "SDL_GetVideoSurface", - "SDL_GetWindowFlags", - "SDL_GetWindowSize", - "SDL_Has3DNow", - "SDL_Has3DNowExt", - "SDL_HasAltiVec", - "SDL_HasMMX", - "SDL_HasMMXExt", - "SDL_HasRDTSC", - "SDL_HasSSE", - "SDL_HasSSE2", - "SDL_Init", - "SDL_InitSubSystem", - "SDL_JoystickClose", - "SDL_JoystickEventState", - "SDL_JoystickGetAxis", - "SDL_JoystickGetBall", - "SDL_JoystickGetButton", - "SDL_JoystickGetHat", - "SDL_JoystickIndex", - "SDL_JoystickName", - "SDL_JoystickNumAxes", - "SDL_JoystickNumBalls", - "SDL_JoystickNumButtons", - "SDL_JoystickNumHats", - "SDL_JoystickOpen", - "SDL_JoystickOpened", - "SDL_JoystickUpdate", - "SDL_Linked_Version", - "SDL_ListModes", - "SDL_LoadBMP_RW", - "SDL_LockAudio", - "SDL_LockSurface", - "SDL_LogSetOutputFunction", - "SDL_LowerBlit", - "SDL_LowerBlitScaled", - "SDL_MapRGB", - "SDL_MapRGBA", - "SDL_NumJoysticks", - "SDL_OpenAudio", - "SDL_PauseAudio", - "SDL_PeepEvents", - "SDL_PollEvent", - "SDL_PumpEvents", - "SDL_PushEvent", - "SDL_Quit", - "SDL_QuitSubSystem", - "SDL_RWFromConstMem", - "SDL_RWFromFile", - "SDL_RWFromMem", - "SDL_RemoveTimer", - "SDL_SaveBMP_RW", - "SDL_SetAlpha", - "SDL_SetClipRect", - "SDL_SetColorKey", - "SDL_SetColors", - "SDL_SetError", - "SDL_SetGamma", - "SDL_SetGammaRamp", - "SDL_SetPalette", - "SDL_SetVideoMode", - "SDL_SetWindowFullscreen", - "SDL_SetWindowTitle", - "SDL_ShowCursor", - "SDL_StartTextInput", - "SDL_StopTextInput", - "SDL_ThreadID", - "SDL_UnlockAudio", - "SDL_UnlockSurface", - "SDL_UpdateRect", - "SDL_UpdateRects", - "SDL_UpperBlit", - "SDL_UpperBlitScaled", - "SDL_VideoDriverName", - "SDL_VideoModeOK", - "SDL_VideoQuit", - "SDL_WM_GrabInput", - "SDL_WM_IconifyWindow", - "SDL_WM_SetCaption", - "SDL_WM_SetIcon", - "SDL_WM_ToggleFullScreen", - "SDL_WaitThread", - "SDL_WarpMouse", - "SDL_WasInit", - "SDL_mutexP", - "SDL_mutexV", - "TTF_CloseFont", - "TTF_FontAscent", - "TTF_FontDescent", - "TTF_FontHeight", - "TTF_FontLineSkip", - "TTF_GlyphMetrics", - "TTF_Init", - "TTF_OpenFont", - "TTF_Quit", - "TTF_RenderText_Blended", - "TTF_RenderText_Shaded", - "TTF_RenderText_Solid", - "TTF_RenderUTF8_Solid", - "TTF_SizeText", - "TTF_SizeUTF8", "XChangeWindowAttributes", "XCreateWindow", "XInternAtom", @@ -382,8 +182,6 @@ "alcOpenDevice", "alcProcessContext", "alcSuspendContext", - "boxColor", - "boxRGBA", "clock_res_get", "clock_time_get", "eglBindAPI", @@ -412,9 +210,6 @@ "eglWaitClient", "eglWaitGL", "eglWaitNative", - "ellipseColor", - "ellipseRGBA", - "emscripten_SDL_SetEventHandler", "emscripten_alcDevicePauseSOFT", "emscripten_alcDeviceResumeSOFT", "emscripten_alcGetStringiSOFT", @@ -872,8 +667,6 @@ "fd_seek", "fd_sync", "fd_write", - "filledEllipseColor", - "filledEllipseRGBA", "getaddrinfo", "getnameinfo", "getprotobyname", @@ -1108,14 +901,8 @@ "glutSpecialUpFunc", "glutSwapBuffers", "glutTimerFunc", - "lineColor", - "lineRGBA", - "pixelRGBA", "proc_exit", "random_get", - "rectangleColor", - "rectangleRGBA", - "rotozoomSurface", "setNetworkCallback", "setprotoent", "stackAlloc", @@ -1133,8 +920,7 @@ "uuid_unparse", "uuid_unparse_lower", "uuid_unparse_upper", - "uuid_variant", - "zoomSurface" + "uuid_variant" ], "imports": [ "GOT.func.alBuffer3f", diff --git a/test/codesize/test_unoptimized_code_size.json b/test/codesize/test_unoptimized_code_size.json index 27350191fb96c..8d65b15245eed 100644 --- a/test/codesize/test_unoptimized_code_size.json +++ b/test/codesize/test_unoptimized_code_size.json @@ -1,6 +1,6 @@ { - "hello_world.js": 56965, - "hello_world.js.gz": 17729, + "hello_world.js": 56943, + "hello_world.js.gz": 17715, "hello_world.wasm": 15138, "hello_world.wasm.gz": 7455, "no_asserts.js": 26576, @@ -11,6 +11,6 @@ "strict.js.gz": 17045, "strict.wasm": 15138, "strict.wasm.gz": 7450, - "total": 180885, - "total_gz": 64544 + "total": 180863, + "total_gz": 64530 } diff --git a/test/test_browser.py b/test/test_browser.py index c651383f4dd4b..2e8d7799f300d 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -1935,7 +1935,7 @@ def test_gl_renderers(self): @no_2gb('render fails') @no_4gb('render fails') def test_gl_stride(self): - self.reftest('gl_stride.c', 'gl_stride.png', cflags=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL']) + self.reftest('gl_stride.c', 'gl_stride.png', cflags=['-sGL_UNSAFE_OPTS=0', '-sLEGACY_GL_EMULATION', '-lGL', '-lSDL', '-sUSE_SDL']) @requires_graphics_hardware def test_gl_vertex_buffer_pre(self): diff --git a/test/test_other.py b/test/test_other.py index 46637386f834b..2471b4a09219c 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2482,6 +2482,20 @@ def test_sdl_none(self): self.assert_fail([EMCC, 'main.c'], 'SDL.h:1:2: error: "To use the emscripten port of SDL use -sUSE_SDL or -sUSE_SDL=2"') self.run_process([EMCC, 'main.c', '-sUSE_SDL']) + def test_sdl_undefined(self): + create_file('main.c', r''' + #include + + int SDL_Init(int flags); + + int main() { + printf("in main: %p\n", SDL_Init); + return 0; + } + ''') + self.assert_fail([EMCC, 'main.c'], 'undefined symbol: SDL_Init') + self.run_process([EMCC, 'main.c', '-sUSE_SDL']) + def test_sdl_endianness(self): create_file('main.c', r''' #include @@ -2492,7 +2506,7 @@ def test_sdl_endianness(self): return 0; } ''') - self.do_runf('main.c', '1234, 1234, 4321\n') + self.do_runf('main.c', '1234, 1234, 4321\n', cflags=['-sUSE_SDL']) def test_sdl_scan_code_from_key(self): create_file('main.c', r''' @@ -2504,7 +2518,7 @@ def test_sdl_scan_code_from_key(self): return 0; } ''') - self.do_runf('main.c', '204\n') + self.do_runf('main.c', '204\n', cflags=['-sUSE_SDL']) def test_sdl_get_key_name(self): create_file('main.c', r''' @@ -2526,7 +2540,7 @@ def test_sdl_get_key_name(self): 0 -> '0' 0 -> '9' F1 -> '' -''') +''', cflags=['-sUSE_SDL']) @requires_network def test_sdl2_mixer_wav(self): @@ -8839,7 +8853,7 @@ def test_standalone_system_headers(self, prefix): # everything it needs. directories = {'': []} for elem in os.listdir(path_from_root('system/include')): - if elem == 'fakesdl': + if elem == 'SDL': continue full = path_from_root('system/include', elem) if os.path.isdir(full): @@ -9233,6 +9247,7 @@ def test_closure_type_annotations(self): self.build('hello_world.c', cflags=[ '--closure=1', '-sINCLUDE_FULL_LIBRARY', + '-sUSE_SDL', '-sFETCH', '-sFETCH_SUPPORT_INDEXEDDB', '-Werror=closure', diff --git a/tools/compile.py b/tools/compile.py index 81bedffa25ca7..bc424dfd4d7df 100644 --- a/tools/compile.py +++ b/tools/compile.py @@ -141,6 +141,7 @@ def array_contains_any_of(hay, needles): if '-nostdinc' not in user_args: if not settings.USE_SDL: cflags += ['-Xclang', '-iwithsysroot' + os.path.join('/include', 'fakesdl')] + cflags += ['-Xclang', '-iwithsysroot' + os.path.join('/include', 'fakesdl', 'SDL')] cflags += ['-Xclang', '-iwithsysroot' + os.path.join('/include', 'compat')] return cflags diff --git a/tools/gen_struct_info.py b/tools/gen_struct_info.py index dee74814d52d6..f0a33c3c79222 100755 --- a/tools/gen_struct_info.py +++ b/tools/gen_struct_info.py @@ -215,6 +215,7 @@ def generate_cmd(js_file_path, src_file_path, cflags): '-sINCOMING_MODULE_JS_API=', '-sSTRICT', '-sSUPPORT_LONGJMP=0', + '-sUSE_SDL=1', '-sASSERTIONS=0'] # Default behavior for emcc is to warn for binaryen version check mismatches