From 14fa2247e997c1678a2d7d84aa4ca63d90417794 Mon Sep 17 00:00:00 2001 From: Cameron Egbert Date: Tue, 3 Sep 2019 14:49:39 +0200 Subject: [PATCH] python: MSVC doesn't like pure virtual methods in local classes. --- src/python/magnum/platform/glfw.cpp | 9 +++++++++ src/python/magnum/platform/sdl2.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/python/magnum/platform/glfw.cpp b/src/python/magnum/platform/glfw.cpp index 0090ca3..4ef511d 100644 --- a/src/python/magnum/platform/glfw.cpp +++ b/src/python/magnum/platform/glfw.cpp @@ -41,7 +41,16 @@ void glfw(py::module& m) { struct PublicizedApplication: Platform::Application { explicit PublicizedApplication(const Configuration& configuration, const GLConfiguration& glConfiguration): Platform::Application{Arguments{argc, nullptr}, configuration, glConfiguration} {} + /* MSVC dies with "error C3640: a referenced or virtual member function + of a local class must be defined" if this is just `= 0` here. Since + we're overriding this method below anyway, it doesn't have to be + pure virtual. */ + #ifdef _MSC_VER + void drawEvent() override {} + #else void drawEvent() override = 0; + #endif + void mousePressEvent(MouseEvent&) override {} void mouseReleaseEvent(MouseEvent&) override {} void mouseMoveEvent(MouseMoveEvent&) override {} diff --git a/src/python/magnum/platform/sdl2.cpp b/src/python/magnum/platform/sdl2.cpp index 7511d06..72f1d3e 100644 --- a/src/python/magnum/platform/sdl2.cpp +++ b/src/python/magnum/platform/sdl2.cpp @@ -41,7 +41,16 @@ void sdl2(py::module& m) { struct PublicizedApplication: Platform::Application { explicit PublicizedApplication(const Configuration& configuration, const GLConfiguration& glConfiguration): Platform::Application{Arguments{argc, nullptr}, configuration, glConfiguration} {} + /* MSVC dies with "error C3640: a referenced or virtual member function + of a local class must be defined" if this is just `= 0` here. Since + we're overriding this method below anyway, it doesn't have to be + pure virtual. */ + #ifdef _MSC_VER + void drawEvent() override {} + #else void drawEvent() override = 0; + #endif + void mousePressEvent(MouseEvent&) override {} void mouseReleaseEvent(MouseEvent&) override {} void mouseMoveEvent(MouseMoveEvent&) override {}