diff --git a/src/Magnum/DebugTools/BufferData.cpp b/src/Magnum/DebugTools/BufferData.cpp index 9b5a55662..61c843588 100644 --- a/src/Magnum/DebugTools/BufferData.cpp +++ b/src/Magnum/DebugTools/BufferData.cpp @@ -24,6 +24,17 @@ DEALINGS IN THE SOFTWARE. */ +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#include +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + /* Don't compile this file on Emscripten < 2.0.17. Because it's easier to do that here than through CMake. */ #if !defined(__EMSCRIPTEN_major__) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017 diff --git a/src/Magnum/DebugTools/BufferData.h b/src/Magnum/DebugTools/BufferData.h index 99f588d6c..a0ce544bd 100644 --- a/src/Magnum/DebugTools/BufferData.h +++ b/src/Magnum/DebugTools/BufferData.h @@ -39,6 +39,16 @@ #include "Magnum/GL/OpenGL.h" #include "Magnum/DebugTools/visibility.h" +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + #ifdef MAGNUM_BUILD_DEPRECATED #include #include diff --git a/src/Magnum/GL/Buffer.h b/src/Magnum/GL/Buffer.h index 87413cfd8..5a53038c7 100644 --- a/src/Magnum/GL/Buffer.h +++ b/src/Magnum/GL/Buffer.h @@ -41,6 +41,16 @@ #include "Magnum/GL/AbstractObject.h" #include "Magnum/GL/GL.h" +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + #ifdef MAGNUM_BUILD_DEPRECATED /* For label() / setLabel(), which used to be a std::string. Not ideal for the return type, but at least something. */ diff --git a/src/Magnum/GL/Implementation/BufferState.h b/src/Magnum/GL/Implementation/BufferState.h index 8375fde30..422d852ac 100644 --- a/src/Magnum/GL/Implementation/BufferState.h +++ b/src/Magnum/GL/Implementation/BufferState.h @@ -28,6 +28,16 @@ #include "Magnum/GL/Buffer.h" +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + namespace Magnum { namespace GL { namespace Implementation { struct BufferState { diff --git a/src/Magnum/GL/Implementation/MeshState.cpp b/src/Magnum/GL/Implementation/MeshState.cpp index cb95c7f74..8b42f51f1 100644 --- a/src/Magnum/GL/Implementation/MeshState.cpp +++ b/src/Magnum/GL/Implementation/MeshState.cpp @@ -33,6 +33,16 @@ #include "State.h" +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + namespace Magnum { namespace GL { namespace Implementation { using namespace Containers::Literals; diff --git a/src/Magnum/GL/Implementation/driverSpecific.cpp b/src/Magnum/GL/Implementation/driverSpecific.cpp index 3765f8e44..e206e5fec 100644 --- a/src/Magnum/GL/Implementation/driverSpecific.cpp +++ b/src/Magnum/GL/Implementation/driverSpecific.cpp @@ -31,6 +31,11 @@ #include "Magnum/Math/Range.h" #if defined(MAGNUM_TARGET_WEBGL) && defined(CORRADE_TARGET_EMSCRIPTEN) +/* Including any Emscripten header should also make __EMSCRIPTEN_major__ etc + macros available, independently of whether they're passed implicitly (before + version 3.1.23) or taken from a version header (after version 3.1.4). + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ #include #include #endif diff --git a/src/Magnum/GL/Mesh.h b/src/Magnum/GL/Mesh.h index d9f49126d..40edfc805 100644 --- a/src/Magnum/GL/Mesh.h +++ b/src/Magnum/GL/Mesh.h @@ -38,6 +38,16 @@ #include "Magnum/GL/Buffer.h" #include "Magnum/GL/GL.h" +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + #ifdef MAGNUM_BUILD_DEPRECATED /* For label() / setLabel(), which used to be a std::string. Not ideal for the return type, but at least something. */ diff --git a/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp b/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp index 9cb1cce83..957d649ca 100644 --- a/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp +++ b/src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp @@ -33,6 +33,16 @@ #include "Magnum/GL/Mesh.h" #include "Magnum/Math/Color.h" +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + namespace Magnum { namespace Platform { namespace Test { using namespace Containers::Literals; diff --git a/src/Magnum/Platform/WindowlessEglApplication.cpp b/src/Magnum/Platform/WindowlessEglApplication.cpp index c492e1468..84197547b 100644 --- a/src/Magnum/Platform/WindowlessEglApplication.cpp +++ b/src/Magnum/Platform/WindowlessEglApplication.cpp @@ -39,6 +39,16 @@ #include "Implementation/Egl.h" +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + /* ANGLE's EGL on Windows needs an actual window */ /** @todo investigate if this is still needed */ #ifdef CORRADE_TARGET_WINDOWS diff --git a/src/Magnum/Platform/gl-info.cpp b/src/Magnum/Platform/gl-info.cpp index 2ded27ad3..1ceda411c 100644 --- a/src/Magnum/Platform/gl-info.cpp +++ b/src/Magnum/Platform/gl-info.cpp @@ -72,6 +72,16 @@ #error no windowless application available on this platform #endif +/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version + 3.1.4 moved them to a version header and version 3.1.23 dropped the + backwards compatibility. To work consistently on all versions, including the + header only if the version macros aren't present. + https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a + https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */ +#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__) +#include +#endif + namespace Magnum { /** @page magnum-gl-info Magnum GL Info