From ba02722755948ad80cfa4f51e67ec119a98f80c8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 16 Jan 2024 21:32:35 -0800 Subject: [PATCH] Removed SDL_LOADSO_DISABLED Loading shared libraries is core functionality on platforms that support it. --- CMakeLists.txt | 31 +++++-------------- include/build_config/SDL_build_config.h.cmake | 1 - .../build_config/SDL_build_config_minimal.h | 4 +-- include/build_config/SDL_build_config_ngage.h | 4 +-- src/loadso/dummy/SDL_sysloadso.c | 4 +-- src/video/SDL_vulkan_internal.h | 4 --- 6 files changed, 13 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d19ad993e..2e2c21b60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,13 +211,11 @@ if(EMSCRIPTEN) set(SDL_ASSEMBLY_DEFAULT OFF) set(SDL_SHARED_AVAILABLE OFF) set(SDL_ATOMIC_DEFAULT OFF) - set(SDL_LOADSO_DEFAULT OFF) set(SDL_CPUINFO_DEFAULT OFF) endif() if(VITA OR PSP OR PS2 OR N3DS OR RISCOS) set(SDL_SHARED_AVAILABLE OFF) - set(SDL_LOADSO_DEFAULT OFF) endif() if((RISCOS OR UNIX_SYS) AND NOT (LINUX OR NETBSD OR OPENBSD)) @@ -253,7 +251,6 @@ set(SDL_SUBSYSTEMS Threads Timers File - Loadso CPUinfo Filesystem Sensor @@ -1193,7 +1190,7 @@ if(UNIX OR APPLE) # Relevant for Unix/Darwin only set(DYNAPI_NEEDS_DLOPEN 1) CheckDLOPEN() - if(SDL_LOADSO AND HAVE_DLOPEN) + if(HAVE_DLOPEN) set(SDL_LOADSO_DLOPEN 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c") set(HAVE_SDL_LOADSO TRUE) @@ -1282,11 +1279,9 @@ if(ANDROID) ) set(HAVE_SDL_JOYSTICK TRUE) endif() - if(SDL_LOADSO) - set(SDL_LOADSO_DLOPEN 1) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c") - set(HAVE_SDL_LOADSO TRUE) - endif() + set(SDL_LOADSO_DLOPEN 1) + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c") + set(HAVE_SDL_LOADSO TRUE) if(SDL_POWER) set(SDL_POWER_ANDROID 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/power/android/*.c") @@ -1863,10 +1858,6 @@ elseif(WINDOWS) endif() if(SDL_VIDEO) - # requires SDL_LOADSO on Windows (IME, DX, etc.) - if(NOT SDL_LOADSO) - message(FATAL_ERROR "SDL_VIDEO requires SDL_LOADSO, which is not enabled") - endif() if(WINDOWS_STORE) set(SDL_VIDEO_DRIVER_WINRT 1) sdl_glob_sources( @@ -1969,11 +1960,9 @@ elseif(WINDOWS) set(HAVE_SDL_TIMERS TRUE) endif() - if(SDL_LOADSO) - set(SDL_LOADSO_WINDOWS 1) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/loadso/windows/*.c") - set(HAVE_SDL_LOADSO TRUE) - endif() + set(SDL_LOADSO_WINDOWS 1) + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/loadso/windows/*.c") + set(HAVE_SDL_LOADSO TRUE) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c") @@ -2758,12 +2747,6 @@ elseif(N3DS) endif() endif() -if(HAVE_VULKAN AND NOT SDL_LOADSO) - message(STATUS "Vulkan support is available, but disabled because there's no loadso.") - set(HAVE_VULKAN FALSE) - set(SDL_VIDEO_VULKAN 0) -endif() - # Platform-independent options if(SDL_VIDEO) diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake index 9deb5555c..cf2cbb5b0 100644 --- a/include/build_config/SDL_build_config.h.cmake +++ b/include/build_config/SDL_build_config.h.cmake @@ -265,7 +265,6 @@ #cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@ #cmakedefine SDL_HIDAPI_DISABLED @SDL_HIDAPI_DISABLED@ #cmakedefine SDL_SENSOR_DISABLED @SDL_SENSOR_DISABLED@ -#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@ #cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@ #cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@ #cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@ diff --git a/include/build_config/SDL_build_config_minimal.h b/include/build_config/SDL_build_config_minimal.h index 276881a77..bb256fc30 100644 --- a/include/build_config/SDL_build_config_minimal.h +++ b/include/build_config/SDL_build_config_minimal.h @@ -77,8 +77,8 @@ typedef unsigned int uintptr_t; /* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ #define SDL_SENSOR_DISABLED 1 -/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 +/* Enable the dummy shared object loader (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DUMMY 1 /* Enable the stub thread support (src/thread/generic/\*.c) */ #define SDL_THREADS_DISABLED 1 diff --git a/include/build_config/SDL_build_config_ngage.h b/include/build_config/SDL_build_config_ngage.h index 1942ef464..17872ef06 100644 --- a/include/build_config/SDL_build_config_ngage.h +++ b/include/build_config/SDL_build_config_ngage.h @@ -80,8 +80,8 @@ typedef unsigned long uintptr_t; /* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ #define SDL_SENSOR_DISABLED 1 -/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ -#define SDL_LOADSO_DISABLED 1 +/* Enable the dummy shared object loader (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DUMMY 1 /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ #define SDL_FILESYSTEM_DUMMY 1 diff --git a/src/loadso/dummy/SDL_sysloadso.c b/src/loadso/dummy/SDL_sysloadso.c index 9a2f524b7..476d84477 100644 --- a/src/loadso/dummy/SDL_sysloadso.c +++ b/src/loadso/dummy/SDL_sysloadso.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.h" -#if defined(SDL_LOADSO_DUMMY) || defined(SDL_LOADSO_DISABLED) +#if defined(SDL_LOADSO_DUMMY) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent library loading routines */ @@ -44,4 +44,4 @@ void SDL_UnloadObject(void *handle) /* no-op. */ } -#endif /* SDL_LOADSO_DUMMY || SDL_LOADSO_DISABLED */ +#endif /* SDL_LOADSO_DUMMY */ diff --git a/src/video/SDL_vulkan_internal.h b/src/video/SDL_vulkan_internal.h index 5edf7c71b..5961df84b 100644 --- a/src/video/SDL_vulkan_internal.h +++ b/src/video/SDL_vulkan_internal.h @@ -24,10 +24,6 @@ #include "SDL_internal.h" #ifdef SDL_VIDEO_VULKAN -#if defined(SDL_LOADSO_DISABLED) || defined(SDL_LOADSO_DUMMY) -#error You should not be here. -#endif - #ifdef SDL_VIDEO_DRIVER_ANDROID #define VK_USE_PLATFORM_ANDROID_KHR #endif