From bddf01c3b9d3b2bde44ece0ce8305ed3814d969a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 24 Oct 2013 17:00:33 +0200 Subject: [PATCH] Disable deprecated API if MAGNUM_BUILD_DEPRECATED is set. Causes the compilation to fail. --- src/AbstractShaderProgram.h | 2 ++ src/AbstractTexture.h | 2 ++ src/Buffer.h | 4 ++++ src/CMakeLists.txt | 7 ++++++- src/ImageFormat.h | 4 ++++ src/Platform/AbstractXApplication.h | 2 ++ src/Platform/NaClApplication.h | 2 ++ src/Sampler.h | 2 ++ 8 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 76f947b49..9aa0432b3 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -309,12 +309,14 @@ class MAGNUM_EXPORT AbstractShaderProgram { */ static Int maxVertexAttributes(); + #ifdef MAGNUM_BUILD_DEPRECATED /** * @copydoc maxVertexAttributes() * @deprecated Use @ref Magnum::AbstractShaderProgram::maxVertexAttributes() "maxVertexAttributes()" * instead. */ static Int maxSupportedVertexAttributeCount() { return maxVertexAttributes(); } + #endif #ifndef MAGNUM_TARGET_GLES /** diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 5cac4fb3c..69befeed2 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -110,12 +110,14 @@ class MAGNUM_EXPORT AbstractTexture { */ static Int maxLayers(); + #ifdef MAGNUM_BUILD_DEPRECATED /** * @copybrief maxLayers() * @deprecated Use @ref Magnum::AbstractTexture::maxLayers() "maxLayers()" * instead. */ static Int maxSupportedLayerCount() { return maxLayers(); } + #endif #ifndef MAGNUM_TARGET_GLES /** diff --git a/src/Buffer.h b/src/Buffer.h index aa479b3c5..1f3c88189 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -657,6 +657,7 @@ class MAGNUM_EXPORT Buffer { return *this; } + #ifdef MAGNUM_BUILD_DEPRECATED /** * @brief Set buffer data * @deprecated Use @ref Magnum::Buffer::setData(Containers::ArrayReference, Usage) "setData(Containers::ArrayReference, Usage)" @@ -665,6 +666,7 @@ class MAGNUM_EXPORT Buffer { Buffer& setData(GLsizeiptr size, const GLvoid* data, Usage usage) { return setData({data, std::size_t(size)}, usage); } + #endif /** * @brief Set buffer data @@ -702,6 +704,7 @@ class MAGNUM_EXPORT Buffer { return *this; } + #ifdef MAGNUM_BUILD_DEPRECATED /** * @brief Set buffer subdata * @deprecated Use @ref Magnum::Buffer::setSubData(GLintptr, Containers::ArrayReference) "setSubData(GLintptr, Containers::ArrayReference)" @@ -710,6 +713,7 @@ class MAGNUM_EXPORT Buffer { Buffer& setSubData(GLintptr offset, GLsizeiptr size, const GLvoid* data) { return setSubData(offset, {data, std::size_t(size)}); } + #endif /** * @brief Set buffer subdata diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd35e65ea..9ccf64856 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -116,7 +116,6 @@ set(Magnum_HEADERS Extensions.h Framebuffer.h Image.h - ImageFormat.h ImageReference.h Magnum.h Mesh.h @@ -138,6 +137,12 @@ set(Magnum_HEADERS magnumVisibility.h) +# Deprecated headers +if(BUILD_DEPRECATED) + set(Magnum_HEADERS ${Magnum_HEADERS} + ImageFormat.h) +endif() + # Desktop-only headers and libraries if(NOT TARGET_GLES) set(Magnum_HEADERS ${Magnum_HEADERS} diff --git a/src/ImageFormat.h b/src/ImageFormat.h index 85271696c..5ec6e8a31 100644 --- a/src/ImageFormat.h +++ b/src/ImageFormat.h @@ -31,6 +31,7 @@ #include "ColorFormat.h" +#ifdef MAGNUM_BUILD_DEPRECATED namespace Magnum { /** @@ -46,5 +47,8 @@ typedef ColorFormat ImageFormat; typedef ColorType ImageType; } +#else +#error +#endif #endif diff --git a/src/Platform/AbstractXApplication.h b/src/Platform/AbstractXApplication.h index d1e61cf5d..514a9f627 100644 --- a/src/Platform/AbstractXApplication.h +++ b/src/Platform/AbstractXApplication.h @@ -257,6 +257,7 @@ class AbstractXApplication::InputEvent { Alt = Mod1Mask, /**< Alt */ AltGr = Mod5Mask, /**< AltGr */ + #ifdef MAGNUM_BUILD_DEPRECATED /** * @copybrief Button::Left * @deprecated Use @ref Magnum::Platform::AbstractXApplication::InputEvent::buttons() "buttons()" @@ -280,6 +281,7 @@ class AbstractXApplication::InputEvent { * instead. */ RightButton = Button3Mask, + #endif CapsLock = LockMask, /**< Caps lock */ NumLock = Mod2Mask /**< Num lock */ diff --git a/src/Platform/NaClApplication.h b/src/Platform/NaClApplication.h index d1de44e8c..2c40db2a4 100644 --- a/src/Platform/NaClApplication.h +++ b/src/Platform/NaClApplication.h @@ -371,6 +371,7 @@ class NaClApplication::InputEvent { Alt = PP_INPUTEVENT_MODIFIER_ALTKEY, /**< Alt */ Meta = PP_INPUTEVENT_MODIFIER_METAKEY, /**< Meta */ + #ifdef MAGNUM_BUILD_DEPRECATED /** * @copybrief Button::Left * @deprecated Use @ref Magnum::Platform::NaClApplication::InputEvent::buttons() "buttons()" @@ -394,6 +395,7 @@ class NaClApplication::InputEvent { * instead. */ RightButton = PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN, + #endif CapsLock = PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY, /**< Caps lock */ NumLock = PP_INPUTEVENT_MODIFIER_NUMLOCKKEY /**< Num lock */ diff --git a/src/Sampler.h b/src/Sampler.h index 601a8bfa4..a19249ab8 100644 --- a/src/Sampler.h +++ b/src/Sampler.h @@ -146,6 +146,7 @@ class MAGNUM_EXPORT Sampler { */ static Float maxAnisotropy(); + #ifdef MAGNUM_BUILD_DEPRECATED /** * @copybrief maxAnisotropy() * @deprecated Use @ref Magnum::Sampler::maxAnisotropy() "maxAnisotropy()" @@ -153,6 +154,7 @@ class MAGNUM_EXPORT Sampler { */ static Float maxSupportedAnisotropy() { return maxAnisotropy(); } #endif + #endif }; /** @debugoperator{Magnum::Sampler} */