summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2017-04-21 15:38:34 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2017-04-28 11:38:11 +0000
commit1aa24b25a99335e350503fb45a0bca2f25d3dd05 (patch)
tree1456b5a7ffba2364e535194a58f6122a1f449c05
parent380aad323cd622aa500fa31e195da40c8b660bc1 (diff)
downloadqtlocation-1aa24b25a99335e350503fb45a0bca2f25d3dd05.tar.gz
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 <qt_ci_bot@qt-project.org> Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
m---------src/3rdparty/mapbox-gl-native0
-rw-r--r--src/location/doc/src/plugins/mapboxgl.qdoc18
-rw-r--r--src/plugins/geoservices/geoservices.pro2
-rw-r--r--src/plugins/geoservices/mapboxgl/mapboxgl.pro8
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeoserviceproviderpluginmapboxgl.cpp10
5 files changed, 37 insertions, 1 deletions
diff --git a/src/3rdparty/mapbox-gl-native b/src/3rdparty/mapbox-gl-native
-Subproject fa9e435795a958b44d50a5cd9cfb4a83363c192
+Subproject 958086bd44bf07f6ef5b6e6aff785074b299509
diff --git a/src/location/doc/src/plugins/mapboxgl.qdoc b/src/location/doc/src/plugins/mapboxgl.qdoc
index 9e7aa35a..1ff845a2 100644
--- a/src/location/doc/src/plugins/mapboxgl.qdoc
+++ b/src/location/doc/src/plugins/mapboxgl.qdoc
@@ -53,6 +53,22 @@ The Mapbox GL geo services plugin can be loaded by using the plugin key "mapboxg
Both Mapbox geo services plugins require an access token to access map styles
and tiles hosted by Mapbox. To create a Mapbox account visit \l{https://www.mapbox.com/pricing}.
+\section1 Platform Support
+
+Qt Location Mapbox GL Plugin has the following support for platforms:
+
+\list
+ \li Microsoft Windows (win32) - Supported, requires MinGW 5.0+ and ANGLE as OpenGL backend
+ \li Linux X11 - Supported, requires GCC 4.9+
+ \li macOS - Supported
+ \li Android - Supported
+ \li Embedded Linux - Supported, requires GCC 4.9+
+ \li iOS - Supported
+ \li WinRT - Not supported
+\endlist
+
+\section1 Parameters
+
\section2 Optional plugin parameters
The following table lists optional parameters that can be passed to the Mapbox plugin.
@@ -169,6 +185,8 @@ replacing the dash with camel case for technical reasons (i.e. \b line-cap will
in the GeoJSON.
\endtable
+\section1 Example usage
+
This example adds inline GeoJSON data to the map. Simply adding a \b source is not enough to get the data
visible. It is also necessary to create a \b layer based on this source. After the layer is added, we also need
to style its \b paint and \b layout properties. In this case we are changing the line color to blue, and the line
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 <QtGui/QOpenGLContext>
QT_BEGIN_NAMESPACE
@@ -54,6 +55,15 @@ QGeoCodingManagerEngine *QGeoServiceProviderFactoryMapboxGL::createGeocodingMana
QGeoMappingManagerEngine *QGeoServiceProviderFactoryMapboxGL::createMappingManagerEngine(
const QVariantMap &parameters, 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);
}