From 60f025fde237ef6eef24530fbc5ef455f3786b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 14 Oct 2026 19:16:26 -0300 Subject: [PATCH] Fix SDL backend isolation in platform helpers Include only the selected backend in Engine and guard both platform helper classes and the SDL2 implementation. This prevents MSVC SDL3 builds from exporting SDL2 vtables and failing with unresolved helper methods. --- src/eepp/window/backend/SDL2/platformhelpersdl2.cpp | 8 ++++++-- src/eepp/window/backend/SDL2/platformhelpersdl2.hpp | 6 ++++++ src/eepp/window/backend/SDL3/platformhelpersdl3.hpp | 6 ++++++ src/eepp/window/engine.cpp | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/eepp/window/backend/SDL2/platformhelpersdl2.cpp b/src/eepp/window/backend/SDL2/platformhelpersdl2.cpp index 93e30437c..3e907e9d0 100644 --- a/src/eepp/window/backend/SDL2/platformhelpersdl2.cpp +++ b/src/eepp/window/backend/SDL2/platformhelpersdl2.cpp @@ -1,7 +1,9 @@ -#include -#include #include +#ifdef EE_BACKEND_SDL2 + +#include + using namespace EE::System; #if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN @@ -109,3 +111,5 @@ bool PlatformHelperSDL2::isExternalStorageWritable() { #endif }}}} // namespace EE::Window::Backend::SDL2 + +#endif diff --git a/src/eepp/window/backend/SDL2/platformhelpersdl2.hpp b/src/eepp/window/backend/SDL2/platformhelpersdl2.hpp index 5c070f903..714e44953 100644 --- a/src/eepp/window/backend/SDL2/platformhelpersdl2.hpp +++ b/src/eepp/window/backend/SDL2/platformhelpersdl2.hpp @@ -1,6 +1,10 @@ #ifndef EE_PLATFORMHELPERSDL2_HPP #define EE_PLATFORMHELPERSDL2_HPP +#include + +#ifdef EE_BACKEND_SDL2 + #include #include @@ -36,3 +40,5 @@ class EE_API PlatformHelperSDL2 : public PlatformHelper { }}}} // namespace EE::Window::Backend::SDL2 #endif + +#endif diff --git a/src/eepp/window/backend/SDL3/platformhelpersdl3.hpp b/src/eepp/window/backend/SDL3/platformhelpersdl3.hpp index 425939dad..3278270fc 100644 --- a/src/eepp/window/backend/SDL3/platformhelpersdl3.hpp +++ b/src/eepp/window/backend/SDL3/platformhelpersdl3.hpp @@ -1,6 +1,10 @@ #ifndef EE_PLATFORMHELPERSDL3_HPP #define EE_PLATFORMHELPERSDL3_HPP +#include + +#ifdef EE_BACKEND_SDL3 + #include #include @@ -36,3 +40,5 @@ class EE_API PlatformHelperSDL3 : public PlatformHelper { }}}} // namespace EE::Window::Backend::SDL3 #endif + +#endif diff --git a/src/eepp/window/engine.cpp b/src/eepp/window/engine.cpp index 69c3292e6..e400403aa 100644 --- a/src/eepp/window/engine.cpp +++ b/src/eepp/window/engine.cpp @@ -24,9 +24,10 @@ #include #include #include +#if defined( EE_SDL_VERSION_2 ) #include #include -#if defined( EE_SDL_VERSION_3 ) +#elif defined( EE_SDL_VERSION_3 ) #include #include #endif