summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-01-10 17:38:48 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2018-01-10 21:42:20 +0200
commit0a7b4e3eb8544ec662a571b5533e9b55913fe732 (patch)
tree518af58b789b6d0ab2a6c21b80084eeedb38652e
parent304ca35f289aef59e29fa18d3a78730c39cad7fa (diff)
downloadqtlocation-mapboxgl-0a7b4e3eb8544ec662a571b5533e9b55913fe732.tar.gz
[qt] Fix import/export symbols declarations
Fixes #10875
-rw-r--r--platform/qt/config.qdocconf2
-rw-r--r--platform/qt/include/qmapbox.hpp24
-rw-r--r--platform/qt/include/qmapboxgl.hpp6
-rw-r--r--platform/qt/qt.cmake4
-rw-r--r--platform/qt/src/qmapbox.cpp6
5 files changed, 26 insertions, 16 deletions
diff --git a/platform/qt/config.qdocconf b/platform/qt/config.qdocconf
index b8ade81bb2..d6f0edbd32 100644
--- a/platform/qt/config.qdocconf
+++ b/platform/qt/config.qdocconf
@@ -4,7 +4,7 @@ include($QT_INSTALL_DOCS/global/compat.qdocconf)
include($QT_INSTALL_DOCS/global/fileextensions.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-online.qdocconf)
-Cpp.ignoretokens = Q_DECL_EXPORT
+Cpp.ignoretokens = Q_MAPBOXGL_EXPORT
project = QMapboxGL
description = Mapbox Qt SDK
diff --git a/platform/qt/include/qmapbox.hpp b/platform/qt/include/qmapbox.hpp
index 2bb5d8705c..5a5198108c 100644
--- a/platform/qt/include/qmapbox.hpp
+++ b/platform/qt/include/qmapbox.hpp
@@ -9,6 +9,12 @@
// This header follows the Qt coding style: https://wiki.qt.io/Qt_Coding_Style
+#if defined(QT_BUILD_MAPBOXGL_LIB)
+ #define Q_MAPBOXGL_EXPORT Q_DECL_EXPORT
+#else
+ #define Q_MAPBOXGL_EXPORT Q_DECL_IMPORT
+#endif
+
namespace QMapbox {
typedef QPair<double, double> Coordinate;
@@ -20,7 +26,7 @@ typedef QList<Coordinates> CoordinatesCollection;
typedef QList<CoordinatesCollection> CoordinatesCollections;
-struct Q_DECL_EXPORT Feature {
+struct Q_MAPBOXGL_EXPORT Feature {
enum Type {
PointType = 1,
LineStringType,
@@ -38,7 +44,7 @@ struct Q_DECL_EXPORT Feature {
QVariant id;
};
-struct Q_DECL_EXPORT ShapeAnnotationGeometry {
+struct Q_MAPBOXGL_EXPORT ShapeAnnotationGeometry {
enum Type {
LineStringType = 1,
PolygonType,
@@ -54,12 +60,12 @@ struct Q_DECL_EXPORT ShapeAnnotationGeometry {
CoordinatesCollections geometry;
};
-struct Q_DECL_EXPORT SymbolAnnotation {
+struct Q_MAPBOXGL_EXPORT SymbolAnnotation {
Coordinate geometry;
QString icon;
};
-struct Q_DECL_EXPORT LineAnnotation {
+struct Q_MAPBOXGL_EXPORT LineAnnotation {
/*! Class constructor. */
LineAnnotation(const ShapeAnnotationGeometry& geometry_ = ShapeAnnotationGeometry(), float opacity_ = 1.0f,
float width_ = 1.0f, const QColor& color_ = Qt::black)
@@ -71,7 +77,7 @@ struct Q_DECL_EXPORT LineAnnotation {
QColor color;
};
-struct Q_DECL_EXPORT FillAnnotation {
+struct Q_MAPBOXGL_EXPORT FillAnnotation {
/*! Class constructor. */
FillAnnotation(const ShapeAnnotationGeometry& geometry_ = ShapeAnnotationGeometry(), float opacity_ = 1.0f,
const QColor& color_ = Qt::black, const QVariant& outlineColor_ = QVariant())
@@ -92,13 +98,13 @@ enum NetworkMode {
Offline,
};
-Q_DECL_EXPORT QList<QPair<QString, QString> >& defaultStyles();
+Q_MAPBOXGL_EXPORT QList<QPair<QString, QString> >& defaultStyles();
-Q_DECL_EXPORT NetworkMode networkMode();
-Q_DECL_EXPORT void setNetworkMode(NetworkMode);
+Q_MAPBOXGL_EXPORT NetworkMode networkMode();
+Q_MAPBOXGL_EXPORT void setNetworkMode(NetworkMode);
// This struct is a 1:1 copy of mbgl::CustomLayerRenderParameters.
-struct Q_DECL_EXPORT CustomLayerRenderParameters {
+struct Q_MAPBOXGL_EXPORT CustomLayerRenderParameters {
double width;
double height;
double latitude;
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp
index ebbd949921..8b319b0453 100644
--- a/platform/qt/include/qmapboxgl.hpp
+++ b/platform/qt/include/qmapboxgl.hpp
@@ -16,7 +16,7 @@ class QMapboxGLPrivate;
// This header follows the Qt coding style: https://wiki.qt.io/Qt_Coding_Style
-class Q_DECL_EXPORT QMapboxGLSettings
+class Q_MAPBOXGL_EXPORT QMapboxGLSettings
{
public:
QMapboxGLSettings();
@@ -77,7 +77,7 @@ private:
std::function<std::string(const std::string &&)> m_resourceTransform;
};
-struct Q_DECL_EXPORT QMapboxGLCameraOptions {
+struct Q_MAPBOXGL_EXPORT QMapboxGLCameraOptions {
QVariant center; // Coordinate
QVariant anchor; // QPointF
QVariant zoom; // double
@@ -85,7 +85,7 @@ struct Q_DECL_EXPORT QMapboxGLCameraOptions {
QVariant pitch; // double
};
-class Q_DECL_EXPORT QMapboxGL : public QObject
+class Q_MAPBOXGL_EXPORT QMapboxGL : public QObject
{
Q_OBJECT
Q_PROPERTY(double latitude READ latitude WRITE setLatitude)
diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake
index 3e81b17d00..aaae199650 100644
--- a/platform/qt/qt.cmake
+++ b/platform/qt/qt.cmake
@@ -70,6 +70,10 @@ target_include_directories(qmapboxgl
PUBLIC platform/qt/include
)
+target_compile_definitions(qmapboxgl
+ PRIVATE "-DQT_BUILD_MAPBOXGL_LIB"
+)
+
target_link_libraries(qmapboxgl
PRIVATE mbgl-core
PRIVATE mbgl-filesource
diff --git a/platform/qt/src/qmapbox.cpp b/platform/qt/src/qmapbox.cpp
index aad32a35dc..ec76ebfe53 100644
--- a/platform/qt/src/qmapbox.cpp
+++ b/platform/qt/src/qmapbox.cpp
@@ -206,7 +206,7 @@ namespace QMapbox {
Returns the current QMapbox::NetworkMode.
*/
-Q_DECL_EXPORT NetworkMode networkMode()
+NetworkMode networkMode()
{
return static_cast<NetworkMode>(mbgl::NetworkStatus::Get());
}
@@ -219,7 +219,7 @@ Q_DECL_EXPORT NetworkMode networkMode()
File source requests uses the available network when \a mode is set to \b
Online, otherwise scoped to the local cache.
*/
-Q_DECL_EXPORT void setNetworkMode(NetworkMode mode)
+void setNetworkMode(NetworkMode mode)
{
mbgl::NetworkStatus::Set(static_cast<mbgl::NetworkStatus::Status>(mode));
}
@@ -230,7 +230,7 @@ Q_DECL_EXPORT void setNetworkMode(NetworkMode mode)
Returns a list containing a pair of string objects, representing the style
URL and name, respectively.
*/
-Q_DECL_EXPORT QList<QPair<QString, QString> >& defaultStyles()
+QList<QPair<QString, QString> >& defaultStyles()
{
static QList<QPair<QString, QString>> styles;