From dbff10e57bb8ae800dfce47ecfe596f506923a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 28 Apr 2015 20:46:47 +0200 Subject: [PATCH 1/8] package/archlinux: disable unknown flags in GCC 4.7 PKGBUILD. --- package/archlinux/PKGBUILD-gcc47 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/archlinux/PKGBUILD-gcc47 b/package/archlinux/PKGBUILD-gcc47 index 2101e11db..acda7ac47 100644 --- a/package/archlinux/PKGBUILD-gcc47 +++ b/package/archlinux/PKGBUILD-gcc47 @@ -14,6 +14,10 @@ provides=('magnum-git') _rootdir=$startdir/../../ build() { + # Disable flags unknown to GCC 4.7 + newcxxflags=$(echo $CXXFLAGS | sed s/-fstack-protector-strong.//g) + export CXXFLAGS="$newcxxflags" + if [ ! -d "$_rootdir/build-gcc47" ] ; then mkdir "$_rootdir/build-gcc47" cd "$_rootdir/build-gcc47" From c09a2d9c95a4c59cfc4840402a1d9b50b1f5ffed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Apr 2015 20:12:20 +0200 Subject: [PATCH 2/8] CMake: use VAR instead of "${VAR}" in if() statements. Caused annoying warnings on CMake 3.1 (gone in 3.2). --- src/CMakeLists.txt | 2 +- src/MagnumExternal/OpenGL/GL/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5294eef5d..f3322339e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,7 +26,7 @@ # On 4.8.2 strict aliasing causes failure of DebugToolsCylinderRendererTest # without any warning, only in release build, any attempt to add debug print # results in issue disappearing. Not an issue on Clang or GCC < 4.8. -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.8.0") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") endif() diff --git a/src/MagnumExternal/OpenGL/GL/CMakeLists.txt b/src/MagnumExternal/OpenGL/GL/CMakeLists.txt index 9a2fed073..0009c0fb1 100644 --- a/src/MagnumExternal/OpenGL/GL/CMakeLists.txt +++ b/src/MagnumExternal/OpenGL/GL/CMakeLists.txt @@ -26,7 +26,7 @@ # flextGLPlatform.cpp is compiled as part of Magnum*Context libraries in Platform add_library(MagnumFlextGLObjects OBJECT flextGL.cpp) -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang") set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -DFlextGL_EXPORTS") else() set_target_properties(MagnumFlextGLObjects PROPERTIES COMPILE_FLAGS "-DFlextGL_EXPORTS") From 06f938fed83a79af91757d0740b6c1b86e01d803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Apr 2015 20:13:41 +0200 Subject: [PATCH 3/8] Disable the deprecation warning also for MSVC. I long for the day when I can remove the old texture API. --- src/Magnum/Framebuffer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Magnum/Framebuffer.cpp b/src/Magnum/Framebuffer.cpp index 635106c3c..87421e253 100644 --- a/src/Magnum/Framebuffer.cpp +++ b/src/Magnum/Framebuffer.cpp @@ -250,6 +250,10 @@ Framebuffer& Framebuffer::attachTextureLayer(Framebuffer::BufferAttachment attac #endif #ifdef MAGNUM_BUILD_DEPRECATED +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4996) /* deprecated warning */ +#endif Framebuffer& Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D& texture, Int mipLevel) { #ifdef __GNUC__ #pragma GCC diagnostic push @@ -261,6 +265,9 @@ Framebuffer& Framebuffer::attachTexture2D(BufferAttachment attachment, Texture2D #endif return *this; } +#ifdef _MSC_VER +#pragma warning(pop) +#endif #endif void Framebuffer::renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer& renderbuffer) { From e8cefca023125f415136a7201163c17c475c1cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Apr 2015 20:14:25 +0200 Subject: [PATCH 4/8] Wait why how eww. --- src/Magnum/Implementation/TransformFeedbackState.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magnum/Implementation/TransformFeedbackState.h b/src/Magnum/Implementation/TransformFeedbackState.h index da10f9579..1ecfdfa06 100644 --- a/src/Magnum/Implementation/TransformFeedbackState.h +++ b/src/Magnum/Implementation/TransformFeedbackState.h @@ -41,7 +41,7 @@ struct TransformFeedbackState { GLint maxBuffers; #endif - GLuint binding; + GLuint binding; void(TransformFeedback::*createImplementation)(); void(TransformFeedback::*attachRangeImplementation)(GLuint, Buffer&, GLintptr, GLsizeiptr); From 24d573e4535725e165769c11bfb7de4370891511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Apr 2015 20:15:14 +0200 Subject: [PATCH 5/8] Fix linkage for local ResourceManager instance on MSVC. I feared that this would be much more complicated. --- src/Magnum/ResourceManager.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Magnum/ResourceManager.hpp b/src/Magnum/ResourceManager.hpp index 44ffc3d02..16b7f2127 100644 --- a/src/Magnum/ResourceManager.hpp +++ b/src/Magnum/ResourceManager.hpp @@ -38,7 +38,11 @@ namespace Magnum { namespace Implementation { -template CORRADE_VISIBILITY_EXPORT ResourceManager*& ResourceManagerLocalInstanceImplementation::internalInstance() { +template +#ifndef _MSC_VER +CORRADE_VISIBILITY_EXPORT +#endif +ResourceManager*& ResourceManagerLocalInstanceImplementation::internalInstance() { static ResourceManager* _instance(nullptr); return _instance; } From c2040c53af759fd73af72ca10b7fd1b2d6134118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Apr 2015 20:16:08 +0200 Subject: [PATCH 6/8] SceneGraph: fix compile error in deprecated functions. And that's only thanks to MSVC, which compiles even the code that is nowhere used. --- src/Magnum/SceneGraph/AbstractTranslationRotation2D.h | 2 +- src/Magnum/SceneGraph/AbstractTranslationRotation3D.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h b/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h index e188a45b1..bce459ae1 100644 --- a/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotation2D.h @@ -77,7 +77,7 @@ template class AbstractBasicTranslationRotation2D: public AbstractBasic * instead. */ CORRADE_DEPRECATED("use rotate() or rotateLocal() instead") AbstractBasicTranslationRotation2D& rotate(Math::Rad angle, TransformationType type) { - return type == TransformationType::Global ? rotate(angle, type) : rotateLocal(angle, type); + return type == TransformationType::Global ? rotate(angle) : rotateLocal(angle); } #endif diff --git a/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h b/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h index ba7464c2f..c0f9e19e2 100644 --- a/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/Magnum/SceneGraph/AbstractTranslationRotation3D.h @@ -201,7 +201,7 @@ template class AbstractBasicTranslationRotation3D: public AbstractBasic * instead. */ CORRADE_DEPRECATED("use rotateZ() or rotateZLocal() instead") AbstractBasicTranslationRotation3D& rotateZ(Math::Rad angle, TransformationType type) { - return type == TransformationType::Global ? rotateZ(angle) : rotateZLocal(); + return type == TransformationType::Global ? rotateZ(angle) : rotateZLocal(angle); } #endif @@ -220,7 +220,7 @@ template class AbstractBasicTranslationRotation3D: public AbstractBasic return *this; } #ifdef MAGNUM_BUILD_DEPRECATED - CORRADE_DEPRECATED("use translate() or translateLocal() instead") AbstractBasicTranslationRotation3D& translate(const Math::Vector2& vector, TransformationType type) { + CORRADE_DEPRECATED("use translate() or translateLocal() instead") AbstractBasicTranslationRotation3D& translate(const Math::Vector3& vector, TransformationType type) { AbstractBasicTranslation3D::translate(vector, type); return *this; } From 922f36cdb18a6578e93ec75b6827d4529faba144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Apr 2015 20:17:40 +0200 Subject: [PATCH 7/8] Fix crash on context creation on Windows on Intel drivers. Sorry! These driver-specific workarounds are a double-edged sword. --- src/Magnum/Implementation/setupDriverWorkarounds.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magnum/Implementation/setupDriverWorkarounds.cpp b/src/Magnum/Implementation/setupDriverWorkarounds.cpp index 6f8af7739..fe1e2c805 100644 --- a/src/Magnum/Implementation/setupDriverWorkarounds.cpp +++ b/src/Magnum/Implementation/setupDriverWorkarounds.cpp @@ -41,7 +41,7 @@ void Context::setupDriverWorkarounds() { #ifdef CORRADE_TARGET_WINDOWS /* On Windows Intel drivers ARB_shading_language_420pack is exposed in GLSL even that the extension (e.g. binding keyword) is not supported */ - if((detectedDriver() & DetectedDriver::IntelWindows) && !Context::current()->isExtensionSupported()) + if((detectedDriver() & DetectedDriver::IntelWindows) && !isExtensionSupported()) _setRequiredVersion(GL::ARB::shading_language_420pack, None); #endif From 7a43d85d9f5c68bc4f25c7b36437e9e08f26136e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Apr 2015 20:26:42 +0200 Subject: [PATCH 8/8] Fix linkage conflict warning/error on MinGW and MSVC. --- src/Magnum/MeshView.h | 3 ++- src/Magnum/Shaders/Flat.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Magnum/MeshView.h b/src/Magnum/MeshView.h index 45b8631e6..dbe57a574 100644 --- a/src/Magnum/MeshView.h +++ b/src/Magnum/MeshView.h @@ -164,7 +164,8 @@ class MAGNUM_EXPORT MeshView { * available there. * @see @ref setCount() */ - MeshView& setIndexRange(Int first, UnsignedInt start, UnsignedInt end); + /* MinGW/MSVC needs inline also here to avoid linkage conflicts */ + inline MeshView& setIndexRange(Int first, UnsignedInt start, UnsignedInt end); #ifdef MAGNUM_BUILD_DEPRECATED /** diff --git a/src/Magnum/Shaders/Flat.h b/src/Magnum/Shaders/Flat.h index 3be81b3eb..7173794bc 100644 --- a/src/Magnum/Shaders/Flat.h +++ b/src/Magnum/Shaders/Flat.h @@ -200,7 +200,8 @@ template class MAGNUM_SHADERS_EXPORT Flat: public Abstra * multiplied with texture if @ref Flag::Textured is set. * @see @ref setTexture() */ - Flat& setColor(const Color4& color); + /* MSVC needs inline also here to avoid linkage conflicts */ + inline Flat& setColor(const Color4& color); /** * @brief Set texture