diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index 39931c28e..5cfc08e8a 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -62,6 +62,13 @@ // MACROS ------------------------------------------------------------------ +// Requires SDL 2.0.6 or newer +//#define SDL2_STATIC_LIBRARY + +#if defined SDL2_STATIC_LIBRARY && defined HAVE_VULKAN +#include +#endif // SDL2_STATIC_LIBRARY && HAVE_VULKAN + // TYPES ------------------------------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- @@ -113,11 +120,20 @@ CCMD(vid_list_sdl_render_drivers) namespace Priv { +#ifdef SDL2_STATIC_LIBRARY + +#define SDL2_OPTIONAL_FUNCTION(RESULT, NAME, ...) \ + RESULT(*NAME)(__VA_ARGS__) = SDL_ ## NAME + +#else // !SDL2_STATIC_LIBRARY + FModule library("SDL2"); #define SDL2_OPTIONAL_FUNCTION(RESULT, NAME, ...) \ static TOptProc NAME("SDL_" #NAME) +#endif // SDL2_STATIC_LIBRARY + SDL2_OPTIONAL_FUNCTION(int, GetWindowBordersSize, SDL_Window *window, int *top, int *left, int *bottom, int *right); #ifdef HAVE_VULKAN SDL2_OPTIONAL_FUNCTION(void, Vulkan_GetDrawableSize, SDL_Window *window, int *width, int *height); @@ -408,11 +424,13 @@ SDLVideo::SDLVideo () return; } +#ifndef SDL2_STATIC_LIBRARY // Load optional SDL functions if (!Priv::library.IsLoaded()) { Priv::library.Load({ "libSDL2-2.0.so.0", "libSDL2-2.0.so", "libSDL2.so" }); } +#endif // !SDL2_STATIC_LIBRARY #ifdef HAVE_VULKAN Priv::vulkanEnabled = vid_preferbackend == 1