0002-fix-compilation-for-no-opengl-builds.patch 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. From 4bcacd0dc8f73de7b9e5e5f5fa2129fd88bdff3b Mon Sep 17 00:00:00 2001
  2. From: Michal Klocek <michal.klocek@qt.io>
  3. Date: Mon, 11 Jan 2021 16:02:14 +0100
  4. Subject: [PATCH] Fix compilation for no opengl builds
  5. Disables experimental labs qml plugin, which
  6. since a4469cad40 depends heavily on opengl backend.
  7. Fix warnings with msvc when compiling without experimental
  8. plugin.
  9. Task-number: QTBUG-91623
  10. Fixes: QTBUG-88017
  11. Change-Id: I53c5da915981bd05f39134ba57f585d0a0786aa8
  12. Signed-off-by: Michal Klocek <michal.klocek@qt.io>
  13. Signed-off-by: Alex Blasche <alexander.blasche@qt.io>
  14. [Retrieved from: https://codereview.qt-project.org/c/qt/qtlocation/+/340353]
  15. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  16. ---
  17. src/location/configure.json | 1 +
  18. .../qdeclarativecirclemapitem.cpp | 20 +++++++++++--
  19. .../qdeclarativecirclemapitem_p_p.h | 2 ++
  20. .../qdeclarativepolygonmapitem.cpp | 27 +++++++++++++----
  21. .../qdeclarativepolygonmapitem_p_p.h | 6 ++++
  22. .../qdeclarativepolylinemapitem.cpp | 30 +++++++++++++++----
  23. .../qdeclarativepolylinemapitem_p.h | 2 ++
  24. .../qdeclarativepolylinemapitem_p_p.h | 5 +++-
  25. .../qdeclarativerectanglemapitem.cpp | 17 +++++++++--
  26. .../qdeclarativerectanglemapitem_p_p.h | 2 ++
  27. src/location/location.pro | 9 +++++-
  28. .../itemsoverlay/qgeomapitemsoverlay.cpp | 9 +++++-
  29. 12 files changed, 109 insertions(+), 21 deletions(-)
  30. diff --git a/src/location/configure.json b/src/location/configure.json
  31. index 62ab029..6d01a9a 100644
  32. --- a/src/location/configure.json
  33. +++ b/src/location/configure.json
  34. @@ -9,6 +9,7 @@
  35. "label": "Qt.labs.location experimental QML plugin",
  36. "purpose": "Provides experimental QtLocation QML types",
  37. "section": "Location",
  38. + "condition": "config.opengl",
  39. "output": [ "privateFeature" ]
  40. },
  41. "geoservices_osm": {
  42. diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
  43. index 841c29a..955de2c 100644
  44. --- a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
  45. +++ b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
  46. @@ -446,6 +446,7 @@ void QDeclarativeCircleMapItem::updatePolish()
  47. */
  48. void QDeclarativeCircleMapItem::possiblySwitchBackend(const QGeoCoordinate &oldCenter, qreal oldRadius, const QGeoCoordinate &newCenter, qreal newRadius)
  49. {
  50. +#if QT_CONFIG(opengl)
  51. if (m_backend != QDeclarativeCircleMapItem::OpenGL)
  52. return;
  53. @@ -459,6 +460,9 @@ void QDeclarativeCircleMapItem::possiblySwitchBackend(const QGeoCoordinate &oldC
  54. QScopedPointer<QDeclarativeCircleMapItemPrivate> d(static_cast<QDeclarativeCircleMapItemPrivate *>(new QDeclarativeCircleMapItemPrivateOpenGL(*this)));
  55. m_d.swap(d);
  56. }
  57. +#else
  58. + return;
  59. +#endif
  60. }
  61. /*!
  62. @@ -534,9 +538,17 @@ void QDeclarativeCircleMapItem::setBackend(QDeclarativeCircleMapItem::Backend b)
  63. if (b == m_backend)
  64. return;
  65. m_backend = b;
  66. - QScopedPointer<QDeclarativeCircleMapItemPrivate> d((m_backend == Software)
  67. - ? static_cast<QDeclarativeCircleMapItemPrivate *>(new QDeclarativeCircleMapItemPrivateCPU(*this))
  68. - : static_cast<QDeclarativeCircleMapItemPrivate * >(new QDeclarativeCircleMapItemPrivateOpenGL(*this)));
  69. + QScopedPointer<QDeclarativeCircleMapItemPrivate> d(
  70. + (m_backend == Software) ? static_cast<QDeclarativeCircleMapItemPrivate *>(
  71. + new QDeclarativeCircleMapItemPrivateCPU(*this))
  72. +#if QT_CONFIG(opengl)
  73. + : static_cast<QDeclarativeCircleMapItemPrivate *>(
  74. + new QDeclarativeCircleMapItemPrivateOpenGL(*this)));
  75. +#else
  76. + : nullptr);
  77. + qFatal("Requested non software rendering backend, but source code is compiled wihtout opengl "
  78. + "support");
  79. +#endif
  80. m_d.swap(d);
  81. m_d->onGeoGeometryChanged();
  82. emit backendChanged();
  83. @@ -565,7 +577,9 @@ QDeclarativeCircleMapItemPrivate::~QDeclarativeCircleMapItemPrivate() {}
  84. QDeclarativeCircleMapItemPrivateCPU::~QDeclarativeCircleMapItemPrivateCPU() {}
  85. +#if QT_CONFIG(opengl)
  86. QDeclarativeCircleMapItemPrivateOpenGL::~QDeclarativeCircleMapItemPrivateOpenGL() {}
  87. +#endif
  88. bool QDeclarativeCircleMapItemPrivate::preserveCircleGeometry (QList<QDoubleVector2D> &path,
  89. const QGeoCoordinate &center, qreal distance, const QGeoProjectionWebMercator &p)
  90. diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem_p_p.h b/src/location/declarativemaps/qdeclarativecirclemapitem_p_p.h
  91. index 4cf4217..dbe6c8b 100644
  92. --- a/src/location/declarativemaps/qdeclarativecirclemapitem_p_p.h
  93. +++ b/src/location/declarativemaps/qdeclarativecirclemapitem_p_p.h
  94. @@ -275,6 +275,7 @@ public:
  95. MapPolygonNode *m_node = nullptr;
  96. };
  97. +#if QT_CONFIG(opengl)
  98. class Q_LOCATION_PRIVATE_EXPORT QDeclarativeCircleMapItemPrivateOpenGL: public QDeclarativeCircleMapItemPrivate
  99. {
  100. public:
  101. @@ -443,6 +444,7 @@ public:
  102. MapPolygonNodeGL *m_node = nullptr;
  103. MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr;
  104. };
  105. +#endif // QT_CONFIG(opengl)
  106. QT_END_NAMESPACE
  107. diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
  108. index fa6ee17..af4f55e 100644
  109. --- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
  110. +++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
  111. @@ -334,6 +334,7 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map, qreal stroke
  112. this->translate(QPointF(strokeWidth, strokeWidth));
  113. }
  114. +#if QT_CONFIG(opengl)
  115. QGeoMapPolygonGeometryOpenGL::QGeoMapPolygonGeometryOpenGL(){
  116. }
  117. @@ -344,6 +345,7 @@ void QGeoMapPolygonGeometryOpenGL::updateSourcePoints(const QGeoMap &map, const
  118. geopath.append(QWebMercator::mercatorToCoord(c));
  119. updateSourcePoints(map, geopath);
  120. }
  121. +#endif
  122. // wrapPath always preserves the geometry
  123. // This one handles holes
  124. @@ -452,6 +454,7 @@ static void cutPathEars(const QList<QDoubleVector2D> &wrappedPath,
  125. screenIndices << quint32(i);
  126. }
  127. +#if QT_CONFIG(opengl)
  128. /*!
  129. \internal
  130. */
  131. @@ -594,7 +597,7 @@ void QGeoMapPolygonGeometryOpenGL::updateQuickGeometry(const QGeoProjectionWebMe
  132. sourceBounds_.setWidth(brect.width());
  133. sourceBounds_.setHeight(brect.height());
  134. }
  135. -
  136. +#endif // QT_CONFIG(opengl)
  137. /*
  138. * QDeclarativePolygonMapItem Private Implementations
  139. */
  140. @@ -603,8 +606,9 @@ QDeclarativePolygonMapItemPrivate::~QDeclarativePolygonMapItemPrivate() {}
  141. QDeclarativePolygonMapItemPrivateCPU::~QDeclarativePolygonMapItemPrivateCPU() {}
  142. +#if QT_CONFIG(opengl)
  143. QDeclarativePolygonMapItemPrivateOpenGL::~QDeclarativePolygonMapItemPrivateOpenGL() {}
  144. -
  145. +#endif
  146. /*
  147. * QDeclarativePolygonMapItem Implementation
  148. */
  149. @@ -689,9 +693,17 @@ void QDeclarativePolygonMapItem::setBackend(QDeclarativePolygonMapItem::Backend
  150. if (b == m_backend)
  151. return;
  152. m_backend = b;
  153. - QScopedPointer<QDeclarativePolygonMapItemPrivate> d((m_backend == Software)
  154. - ? static_cast<QDeclarativePolygonMapItemPrivate *>(new QDeclarativePolygonMapItemPrivateCPU(*this))
  155. - : static_cast<QDeclarativePolygonMapItemPrivate * >(new QDeclarativePolygonMapItemPrivateOpenGL(*this)));
  156. + QScopedPointer<QDeclarativePolygonMapItemPrivate> d(
  157. + (m_backend == Software) ? static_cast<QDeclarativePolygonMapItemPrivate *>(
  158. + new QDeclarativePolygonMapItemPrivateCPU(*this))
  159. +#if QT_CONFIG(opengl)
  160. + : static_cast<QDeclarativePolygonMapItemPrivate *>(
  161. + new QDeclarativePolygonMapItemPrivateOpenGL(*this)));
  162. +#else
  163. + : nullptr);
  164. + qFatal("Requested non software rendering backend, but source code is compiled wihtout opengl "
  165. + "support");
  166. +#endif
  167. m_d.swap(d);
  168. m_d->onGeoGeometryChanged();
  169. emit backendChanged();
  170. @@ -898,6 +910,7 @@ void QDeclarativePolygonMapItem::geometryChanged(const QRectF &newGeometry, cons
  171. //////////////////////////////////////////////////////////////////////
  172. +#if QT_CONFIG(opengl)
  173. QSGMaterialShader *MapPolygonMaterial::createShader() const
  174. {
  175. return new MapPolygonShader();
  176. @@ -916,6 +929,7 @@ QSGMaterialType *MapPolygonMaterial::type() const
  177. static QSGMaterialType type;
  178. return &type;
  179. }
  180. +#endif
  181. MapPolygonNode::MapPolygonNode() :
  182. border_(new MapPolylineNode()),
  183. @@ -967,6 +981,7 @@ void MapPolygonNode::update(const QColor &fillColor, const QColor &borderColor,
  184. }
  185. }
  186. +#if QT_CONFIG(opengl)
  187. MapPolygonNodeGL::MapPolygonNodeGL() :
  188. //fill_material_(this),
  189. fill_material_(),
  190. @@ -1052,5 +1067,5 @@ void MapPolygonShader::updateState(const QSGMaterialShader::RenderState &state,
  191. program()->setUniformValue(m_center_lowpart_id, vecCenter_lowpart);
  192. program()->setUniformValue(m_wrapOffset_id, float(newMaterial->wrapOffset()));
  193. }
  194. -
  195. +#endif // QT_CONFIG(opengl)
  196. QT_END_NAMESPACE
  197. diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h b/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h
  198. index 8d566e6..5e75deb 100644
  199. --- a/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h
  200. +++ b/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h
  201. @@ -89,6 +89,7 @@ protected:
  202. bool assumeSimple_;
  203. };
  204. +#if QT_CONFIG(opengl)
  205. class Q_LOCATION_PRIVATE_EXPORT QGeoMapPolygonGeometryOpenGL : public QGeoMapItemGeometry
  206. {
  207. public:
  208. @@ -197,6 +198,7 @@ private:
  209. int m_color_id;
  210. int m_wrapOffset_id;
  211. };
  212. +#endif // QT_CONFIG(opengl)
  213. class Q_LOCATION_PRIVATE_EXPORT MapPolygonMaterial : public QSGFlatColorMaterial
  214. {
  215. @@ -269,6 +271,7 @@ private:
  216. QSGGeometry geometry_;
  217. };
  218. +#if QT_CONFIG(opengl)
  219. class Q_LOCATION_PRIVATE_EXPORT MapPolygonNodeGL : public MapItemGeometryNode
  220. {
  221. @@ -284,6 +287,7 @@ public:
  222. MapPolygonMaterial fill_material_;
  223. QSGGeometry geometry_;
  224. };
  225. +#endif // QT_CONFIG(opengl)
  226. class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolygonMapItemPrivate
  227. {
  228. @@ -479,6 +483,7 @@ public:
  229. MapPolygonNode *m_node = nullptr;
  230. };
  231. +#if QT_CONFIG(opengl)
  232. class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolygonMapItemPrivateOpenGL: public QDeclarativePolygonMapItemPrivate
  233. {
  234. public:
  235. @@ -662,6 +667,7 @@ public:
  236. MapPolygonNodeGL *m_node = nullptr;
  237. MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr;
  238. };
  239. +#endif // QT_CONFIG(opengl)
  240. QT_END_NAMESPACE
  241. diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
  242. index d59704d..83d253f 100644
  243. --- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
  244. +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
  245. @@ -769,6 +769,7 @@ bool QGeoMapPolylineGeometry::contains(const QPointF &point) const
  246. return false;
  247. }
  248. +#if QT_CONFIG(opengl)
  249. void QGeoMapPolylineGeometryOpenGL::updateSourcePoints(const QGeoMap &map, const QGeoPolygon &poly)
  250. {
  251. if (!sourceDirty_)
  252. @@ -921,6 +922,7 @@ void QGeoMapPolylineGeometryOpenGL::updateQuickGeometry(const QGeoProjectionWebM
  253. sourceBounds_.setWidth(brect.width() + strokeWidth);
  254. sourceBounds_.setHeight(brect.height() + strokeWidth);
  255. }
  256. +#endif // QT_CONFIG(opengl)
  257. /*
  258. * QDeclarativePolygonMapItem Private Implementations
  259. @@ -928,12 +930,13 @@ void QGeoMapPolylineGeometryOpenGL::updateQuickGeometry(const QGeoProjectionWebM
  260. QDeclarativePolylineMapItemPrivate::~QDeclarativePolylineMapItemPrivate() {}
  261. -
  262. QDeclarativePolylineMapItemPrivateCPU::~QDeclarativePolylineMapItemPrivateCPU() {}
  263. +#if QT_CONFIG(opengl)
  264. QDeclarativePolylineMapItemPrivateOpenGLLineStrip::~QDeclarativePolylineMapItemPrivateOpenGLLineStrip() {}
  265. QDeclarativePolylineMapItemPrivateOpenGLExtruded::~QDeclarativePolylineMapItemPrivateOpenGLExtruded() {}
  266. +#endif
  267. /*
  268. * QDeclarativePolygonMapItem Implementation
  269. @@ -941,10 +944,12 @@ QDeclarativePolylineMapItemPrivateOpenGLExtruded::~QDeclarativePolylineMapItemPr
  270. struct PolylineBackendSelector
  271. {
  272. +#if QT_CONFIG(opengl)
  273. PolylineBackendSelector()
  274. {
  275. backend = (qgetenv("QTLOCATION_OPENGL_ITEMS").toInt()) ? QDeclarativePolylineMapItem::OpenGLExtruded : QDeclarativePolylineMapItem::Software;
  276. }
  277. +#endif
  278. QDeclarativePolylineMapItem::Backend backend = QDeclarativePolylineMapItem::Software;
  279. };
  280. @@ -1236,11 +1241,22 @@ void QDeclarativePolylineMapItem::setBackend(QDeclarativePolylineMapItem::Backen
  281. if (b == m_backend)
  282. return;
  283. m_backend = b;
  284. - QScopedPointer<QDeclarativePolylineMapItemPrivate> d((m_backend == Software)
  285. - ? static_cast<QDeclarativePolylineMapItemPrivate *>(new QDeclarativePolylineMapItemPrivateCPU(*this))
  286. - : ((m_backend == OpenGLExtruded)
  287. - ? static_cast<QDeclarativePolylineMapItemPrivate * >(new QDeclarativePolylineMapItemPrivateOpenGLExtruded(*this))
  288. - : static_cast<QDeclarativePolylineMapItemPrivate * >(new QDeclarativePolylineMapItemPrivateOpenGLLineStrip(*this))));
  289. + QScopedPointer<QDeclarativePolylineMapItemPrivate> d(
  290. + (m_backend == Software)
  291. + ? static_cast<QDeclarativePolylineMapItemPrivate *>(
  292. + new QDeclarativePolylineMapItemPrivateCPU(*this))
  293. +#if QT_CONFIG(opengl)
  294. + : ((m_backend == OpenGLExtruded)
  295. + ? static_cast<QDeclarativePolylineMapItemPrivate *>(
  296. + new QDeclarativePolylineMapItemPrivateOpenGLExtruded(*this))
  297. + : static_cast<QDeclarativePolylineMapItemPrivate *>(
  298. + new QDeclarativePolylineMapItemPrivateOpenGLLineStrip(
  299. + *this))));
  300. +#else
  301. + : nullptr);
  302. + qFatal("Requested non software rendering backend, but source code is compiled wihtout opengl "
  303. + "support");
  304. +#endif
  305. m_d.swap(d);
  306. m_d->onGeoGeometryChanged();
  307. emit backendChanged();
  308. @@ -1477,6 +1493,7 @@ void MapPolylineNode::update(const QColor &fillColor,
  309. }
  310. }
  311. +#if QT_CONFIG(opengl)
  312. MapPolylineNodeOpenGLLineStrip::MapPolylineNodeOpenGLLineStrip()
  313. : geometry_(QSGGeometry::defaultAttributes_Point2D(), 0)
  314. {
  315. @@ -2080,5 +2097,6 @@ unsigned int QGeoMapItemLODGeometry::zoomForLOD(unsigned int zoom)
  316. return res;
  317. return res + 1; // give more resolution when closing in
  318. }
  319. +#endif // QT_CONFIG(opengl)
  320. QT_END_NAMESPACE
  321. diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
  322. index 9cd20ea..d3d0ebd 100644
  323. --- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
  324. +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
  325. @@ -97,8 +97,10 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItem : public QDeclarativ
  326. public:
  327. enum Backend {
  328. Software = 0,
  329. +#if QT_CONFIG(opengl)
  330. OpenGLLineStrip = 1,
  331. OpenGLExtruded = 2,
  332. +#endif
  333. };
  334. explicit QDeclarativePolylineMapItem(QQuickItem *parent = 0);
  335. diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h
  336. index 2a921e2..e184391 100644
  337. --- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h
  338. +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h
  339. @@ -213,6 +213,7 @@ protected:
  340. QSGGeometry geometry_;
  341. };
  342. +#if QT_CONFIG(opengl)
  343. class Q_LOCATION_PRIVATE_EXPORT QGeoMapItemLODGeometry
  344. {
  345. public:
  346. @@ -566,6 +567,7 @@ protected:
  347. MapPolylineMaterialExtruded fill_material_;
  348. QSGGeometry m_geometryTriangulating;
  349. };
  350. +#endif // QT_CONFIG(opengl)
  351. class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItemPrivate
  352. {
  353. @@ -720,6 +722,7 @@ public:
  354. MapPolylineNode *m_node = nullptr;
  355. };
  356. +#if QT_CONFIG(opengl)
  357. class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItemPrivateOpenGLLineStrip: public QDeclarativePolylineMapItemPrivate
  358. {
  359. public:
  360. @@ -884,7 +887,7 @@ public:
  361. MapPolylineNodeOpenGLExtruded *m_nodeTri = nullptr;
  362. };
  363. -
  364. +#endif // QT_CONFIG(opengl)
  365. QT_END_NAMESPACE
  366. #endif // QDECLARATIVEPOLYLINEMAPITEM_P_P_H
  367. diff --git a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
  368. index 74d2cc1..6192be0 100644
  369. --- a/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
  370. +++ b/src/location/declarativemaps/qdeclarativerectanglemapitem.cpp
  371. @@ -185,9 +185,18 @@ void QDeclarativeRectangleMapItem::setBackend(QDeclarativeRectangleMapItem::Back
  372. if (b == m_backend)
  373. return;
  374. m_backend = b;
  375. - QScopedPointer<QDeclarativeRectangleMapItemPrivate> d((m_backend == Software)
  376. - ? static_cast<QDeclarativeRectangleMapItemPrivate *>(new QDeclarativeRectangleMapItemPrivateCPU(*this))
  377. - : static_cast<QDeclarativeRectangleMapItemPrivate * >(new QDeclarativeRectangleMapItemPrivateOpenGL(*this)));
  378. + QScopedPointer<QDeclarativeRectangleMapItemPrivate> d(
  379. + (m_backend == Software) ? static_cast<QDeclarativeRectangleMapItemPrivate *>(
  380. + new QDeclarativeRectangleMapItemPrivateCPU(*this))
  381. +#if QT_CONFIG(opengl)
  382. + : static_cast<QDeclarativeRectangleMapItemPrivate *>(
  383. + new QDeclarativeRectangleMapItemPrivateOpenGL(*this)));
  384. +#else
  385. + : nullptr);
  386. + qFatal("Requested non software rendering backend, but source code is compiled wihtout opengl "
  387. + "support");
  388. +#endif
  389. +
  390. m_d.swap(d);
  391. m_d->onGeoGeometryChanged();
  392. emit backendChanged();
  393. @@ -397,6 +406,8 @@ QDeclarativeRectangleMapItemPrivate::~QDeclarativeRectangleMapItemPrivate() {}
  394. QDeclarativeRectangleMapItemPrivateCPU::~QDeclarativeRectangleMapItemPrivateCPU() {}
  395. +#if QT_CONFIG(opengl)
  396. QDeclarativeRectangleMapItemPrivateOpenGL::~QDeclarativeRectangleMapItemPrivateOpenGL() {}
  397. +#endif
  398. QT_END_NAMESPACE
  399. diff --git a/src/location/declarativemaps/qdeclarativerectanglemapitem_p_p.h b/src/location/declarativemaps/qdeclarativerectanglemapitem_p_p.h
  400. index 65d2f61..f7ecd2a 100644
  401. --- a/src/location/declarativemaps/qdeclarativerectanglemapitem_p_p.h
  402. +++ b/src/location/declarativemaps/qdeclarativerectanglemapitem_p_p.h
  403. @@ -244,6 +244,7 @@ public:
  404. MapPolygonNode *m_node = nullptr;
  405. };
  406. +#if QT_CONFIG(opengl)
  407. class Q_LOCATION_PRIVATE_EXPORT QDeclarativeRectangleMapItemPrivateOpenGL: public QDeclarativeRectangleMapItemPrivate
  408. {
  409. public:
  410. @@ -410,6 +411,7 @@ public:
  411. MapPolygonNodeGL *m_node = nullptr;
  412. MapPolylineNodeOpenGLExtruded *m_polylinenode = nullptr;
  413. };
  414. +#endif // QT_CONFIG(opengl)
  415. QT_END_NAMESPACE
  416. diff --git a/src/location/location.pro b/src/location/location.pro
  417. index b0e2c3f..ae20271 100644
  418. --- a/src/location/location.pro
  419. +++ b/src/location/location.pro
  420. @@ -39,7 +39,14 @@ include(maps/maps.pri)
  421. include(places/places.pri)
  422. include(declarativemaps/declarativemaps.pri)
  423. include(declarativeplaces/declarativeplaces.pri)
  424. -qtConfig(location-labs-plugin):include(labs/labs.pri)
  425. +qtConfig(location-labs-plugin) {
  426. + include(labs/labs.pri)
  427. +} else {
  428. + # FIXME: this should be moved out of plugin source code, geojson is referenced from other places
  429. + # within codebase,however compilation of location-labs-plugin is optional
  430. + PRIVATE_HEADERS += labs/qgeojson_p.h
  431. + SOURCES += labs/qgeojson.cpp
  432. +}
  433. HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
  434. diff --git a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
  435. index 1ebad08..a764438 100644
  436. --- a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
  437. +++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
  438. @@ -103,6 +103,7 @@ QGeoMap::Capabilities QGeoMapItemsOverlay::capabilities() const
  439. bool QGeoMapItemsOverlay::createMapObjectImplementation(QGeoMapObject *obj)
  440. {
  441. #ifndef LOCATIONLABS
  442. + Q_UNUSED(obj);
  443. return false;
  444. #else
  445. Q_D(QGeoMapItemsOverlay);
  446. @@ -132,7 +133,9 @@ QSGNode *QGeoMapItemsOverlay::updateSceneGraph(QSGNode *node, QQuickWindow *wind
  447. void QGeoMapItemsOverlay::removeMapObject(QGeoMapObject *obj)
  448. {
  449. -#ifdef LOCATIONLABS
  450. +#ifndef LOCATIONLABS
  451. + Q_UNUSED(obj);
  452. +#else
  453. Q_D(QGeoMapItemsOverlay);
  454. d->removeMapObject(obj);
  455. #endif
  456. @@ -169,7 +172,11 @@ QRectF QGeoMapItemsOverlayPrivate::visibleArea() const
  457. QGeoMapItemsOverlayPrivate::QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine, QGeoMapItemsOverlay *map)
  458. : QGeoMapPrivate(engine, new QGeoProjectionWebMercator)
  459. {
  460. +#ifndef LOCATIONLABS
  461. + Q_UNUSED(map);
  462. +#else
  463. m_qsgSupport.m_map = map;
  464. +#endif
  465. }
  466. QGeoMapItemsOverlayPrivate::~QGeoMapItemsOverlayPrivate()
  467. --
  468. 2.33.1