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.
This commit is contained in:
Martín Lucas Golini
2026-10-14 19:16:26 -03:00
parent 45f11f6816
commit 60f025fde2
4 changed files with 20 additions and 3 deletions
@@ -1,7 +1,9 @@
#include <eepp/system/log.hpp>
#include <eepp/window/backend/SDL2/base.hpp>
#include <eepp/window/backend/SDL2/platformhelpersdl2.hpp>
#ifdef EE_BACKEND_SDL2
#include <eepp/system/log.hpp>
using namespace EE::System;
#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN
@@ -109,3 +111,5 @@ bool PlatformHelperSDL2::isExternalStorageWritable() {
#endif
}}}} // namespace EE::Window::Backend::SDL2
#endif
@@ -1,6 +1,10 @@
#ifndef EE_PLATFORMHELPERSDL2_HPP
#define EE_PLATFORMHELPERSDL2_HPP
#include <eepp/window/backend/SDL2/base.hpp>
#ifdef EE_BACKEND_SDL2
#include <eepp/window/platformhelper.hpp>
#include <string>
@@ -36,3 +40,5 @@ class EE_API PlatformHelperSDL2 : public PlatformHelper {
}}}} // namespace EE::Window::Backend::SDL2
#endif
#endif
@@ -1,6 +1,10 @@
#ifndef EE_PLATFORMHELPERSDL3_HPP
#define EE_PLATFORMHELPERSDL3_HPP
#include <eepp/window/backend/SDL3/base.hpp>
#ifdef EE_BACKEND_SDL3
#include <eepp/window/platformhelper.hpp>
#include <string>
@@ -36,3 +40,5 @@ class EE_API PlatformHelperSDL3 : public PlatformHelper {
}}}} // namespace EE::Window::Backend::SDL3
#endif
#endif
+2 -1
View File
@@ -24,9 +24,10 @@
#include <eepp/ui/uiscenenode.hpp>
#include <eepp/ui/uithememanager.hpp>
#include <eepp/window/backend.hpp>
#if defined( EE_SDL_VERSION_2 )
#include <eepp/window/backend/SDL2/backendsdl2.hpp>
#include <eepp/window/backend/SDL2/platformhelpersdl2.hpp>
#if defined( EE_SDL_VERSION_3 )
#elif defined( EE_SDL_VERSION_3 )
#include <eepp/window/backend/SDL3/backendsdl3.hpp>
#include <eepp/window/backend/SDL3/platformhelpersdl3.hpp>
#endif