From 5a3288154b56909192870f9765656acd82e482e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 1 Jan 2020 19:57:01 +0100 Subject: [PATCH] Platform: properly include SDL_main.h for iOS. Got missed when cleaning up the 50kLOC header mess in b73b9cb40882d1c4975cdb45477b5265ae7f2211 (Nov 2018). Sorry! --- doc/changelog.dox | 5 +++++ doc/snippets/MagnumGL-framebuffer.cpp | 1 + src/Magnum/Platform/Sdl2Application.h | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/doc/changelog.dox b/doc/changelog.dox index 75c865124..bef5904d8 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -177,6 +177,11 @@ See also: - Fixed broken @ref Platform::EmscriptenApplication mouse event coordinates when `-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1` is enabled (see [mosra/magnum#408](https://github.com/mosra/magnum/issues/408)) +- In 2019.01 @ref Magnum/Platform/Sdl2Application.h went through an include + cleanup, removing 50k lines; but unfortunately we forgot to add back + @cpp #include  @ce, causing iOS builds to fail to initialize. + The include got added back and initialization failures are reported with + more information now. @subsection changelog-latest-deprecated Deprecated APIs diff --git a/doc/snippets/MagnumGL-framebuffer.cpp b/doc/snippets/MagnumGL-framebuffer.cpp index 33ad6f045..9f424de88 100644 --- a/doc/snippets/MagnumGL-framebuffer.cpp +++ b/doc/snippets/MagnumGL-framebuffer.cpp @@ -97,4 +97,5 @@ GL::Buffer b; // implicitly tied to `other` /* [Context-makeCurrent] */ } +return 0; /* on iOS SDL redefines main to SDL_main and then return is needed */ } diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 6ac7dcb9a..5832adbfe 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -61,6 +61,16 @@ #include #include +#ifdef CORRADE_TARGET_IOS +/* Including SDL_main.h unconditionally would mean it'd override Corrade::Main + on Windows (both are parsing wargv and converting them to UTF-8, but ours + does that better and additionally enables ANSI colors and UTF-8 console + output). Right now (SDL 2.0.11) it's only needed for WinRT (which is done + below), Android (which we don't support for SDL) and iOS, so whitelist it + only for iOS. */ +#include +#endif + #ifdef CORRADE_TARGET_WINDOWS_RT #include /* For SDL_WinRTRunApp */ #include /* For the WinMain entrypoint */