From 1aa24b25a99335e350503fb45a0bca2f25d3dd05 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 21 Apr 2017 15:38:34 +0300 Subject: Enable Mapbox GL plugin on MinGW builds Qt CI is using MinGW 5.3.0 that should do the job compiling Mapbox GL. For now, only the ANGLE OpenGL backend is supported on Windows for this plugin. I.e. you need to set QT_OPENGL=angle or Qt::AA_UseOpenGLES. Task-number: QTBUG-60110 Change-Id: Iebd4d1569191f47a14b264c489b5d3fb23338d78 Reviewed-by: Qt CI Bot Reviewed-by: Paolo Angelelli --- src/plugins/geoservices/geoservices.pro | 2 +- src/plugins/geoservices/mapboxgl/mapboxgl.pro | 8 ++++++++ .../geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/plugins/geoservices') diff --git a/src/plugins/geoservices/geoservices.pro b/src/plugins/geoservices/geoservices.pro index a0d29325..0810d392 100644 --- a/src/plugins/geoservices/geoservices.pro +++ b/src/plugins/geoservices/geoservices.pro @@ -6,7 +6,7 @@ qtConfig(concurrent) { SUBDIRS += osm } -qtConfig(c++14):!win32:!qnx { +qtConfig(c++14):!win32|mingw:!qnx { !exists(../../3rdparty/mapbox-gl-native/CMakeLists.txt) { warning("Submodule mapbox-gl-native does not exist. Run 'git submodule update --init' on qtlocation.") } else { diff --git a/src/plugins/geoservices/mapboxgl/mapboxgl.pro b/src/plugins/geoservices/mapboxgl/mapboxgl.pro index dcdee7e4..7781fd6d 100644 --- a/src/plugins/geoservices/mapboxgl/mapboxgl.pro +++ b/src/plugins/geoservices/mapboxgl/mapboxgl.pro @@ -38,6 +38,14 @@ qtConfig(icu) { include(../../../3rdparty/icu_dependency.pri) } +# When building for Windows with dynamic OpenGL, this plugin +# can only run with ANGLE because Mapbox GL requires at least +# OpenGL ES and does not use QOpenGLFunctions for resolving +# the OpenGL symbols. -lopengl32 only gives OpenGL 1.1. +win32:qtConfig(dynamicgl) { + LIBS_PRIVATE += -lQtANGLE +} + PLUGIN_TYPE = geoservices PLUGIN_CLASS_NAME = QGeoServiceProviderFactoryMapboxGL load(qt_plugin) diff --git a/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp index 30c01f8c..fb8dd19e 100644 --- a/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp +++ b/src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp @@ -38,6 +38,7 @@ #include "qgeoserviceproviderpluginmapboxgl.h" #include "qgeomappingmanagerenginemapboxgl.h" +#include QT_BEGIN_NAMESPACE @@ -54,6 +55,15 @@ QGeoCodingManagerEngine *QGeoServiceProviderFactoryMapboxGL::createGeocodingMana QGeoMappingManagerEngine *QGeoServiceProviderFactoryMapboxGL::createMappingManagerEngine( const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) const { +#ifdef Q_OS_WIN + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGLES) { + qWarning("The Mapbox GL plugin only supports OpenGL ES on Windows. \ + Try setting the environment variable QT_OPENGL to 'angle'."); + + return 0; + } +#endif + return new QGeoMappingManagerEngineMapboxGL(parameters, error, errorString); } -- cgit v1.2.1