Skip to content

Commit

Permalink
Fix qgis_analysis build when Qt::PrintSupport isn't available (ie iOs) (
Browse files Browse the repository at this point in the history
#39869)

Disable:
- QgsLayoutAtlasToImageAlgorithm
- QgsLayoutAtlasToPdfAlgorithm
- QgsLayoutToImageAlgorithm
- QgsLayoutToPdfAlgorithm
  • Loading branch information
OlivierLDff committed Nov 10, 2020
1 parent 48be2de commit ccdff23
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ SET(QGIS_ANALYSIS_SRCS
processing/qgsalgorithmjoinbynearest.cpp
processing/qgsalgorithmjoinwithlines.cpp
processing/qgsalgorithmkmeansclustering.cpp
processing/qgsalgorithmlayoutatlastoimage.cpp
processing/qgsalgorithmlayoutatlastopdf.cpp
processing/qgsalgorithmlayouttoimage.cpp
processing/qgsalgorithmlayouttopdf.cpp
processing/qgsalgorithmlinedensity.cpp
processing/qgsalgorithmlineintersection.cpp
processing/qgsalgorithmlinesubstring.cpp
Expand Down Expand Up @@ -374,6 +370,16 @@ SET(QGIS_ANALYSIS_HDRS
vector/qgszonalstatistics.h
)

IF(TARGET Qt5::PrintSupport)
SET(QGIS_ANALYSIS_SRCS ${QGIS_ANALYSIS_SRCS}

processing/qgsalgorithmlayoutatlastoimage.cpp
processing/qgsalgorithmlayoutatlastopdf.cpp
processing/qgsalgorithmlayouttoimage.cpp
processing/qgsalgorithmlayouttopdf.cpp
)
ENDIF()

FIND_PACKAGE(EXIV2 REQUIRED)

INCLUDE_DIRECTORIES(SYSTEM ${SPATIALITE_INCLUDE_DIR})
Expand Down
4 changes: 4 additions & 0 deletions src/analysis/processing/qgsnativealgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@
#include "qgsalgorithminterpolatepoint.h"
#include "qgsalgorithmintersection.h"
#include "qgsalgorithmkmeansclustering.h"
#ifndef QT_NO_PRINTER
#include "qgsalgorithmlayoutatlastoimage.h"
#include "qgsalgorithmlayoutatlastopdf.h"
#include "qgsalgorithmlayouttoimage.h"
#include "qgsalgorithmlayouttopdf.h"
#endif
#include "qgsalgorithmlinedensity.h"
#include "qgsalgorithmlineintersection.h"
#include "qgsalgorithmlinesubstring.h"
Expand Down Expand Up @@ -330,10 +332,12 @@ void QgsNativeAlgorithms::loadAlgorithms()
addAlgorithm( new QgsKMeansClusteringAlgorithm() );
addAlgorithm( new QgsLayerToBookmarksAlgorithm() );
addAlgorithm( new QgsLayoutMapExtentToLayerAlgorithm() );
#ifndef QT_NO_PRINTER
addAlgorithm( new QgsLayoutAtlasToImageAlgorithm() );
addAlgorithm( new QgsLayoutAtlasToPdfAlgorithm() );
addAlgorithm( new QgsLayoutToImageAlgorithm() );
addAlgorithm( new QgsLayoutToPdfAlgorithm() );
#endif
addAlgorithm( new QgsLineDensityAlgorithm() );
addAlgorithm( new QgsLineIntersectionAlgorithm() );
addAlgorithm( new QgsLineSubstringAlgorithm() );
Expand Down
5 changes: 5 additions & 0 deletions tests/src/analysis/testqgsprocessingalgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ class TestQgsProcessingAlgs: public QObject

void saveLog();
void setProjectVariable();

#ifndef QT_NO_PRINTER
void exportLayoutPdf();
void exportLayoutPng();
void exportAtlasLayoutPdf();
void exportAtlasLayoutPng();
#endif

void tinMeshCreation();
void exportMeshVertices();
Expand Down Expand Up @@ -4597,6 +4600,7 @@ void TestQgsProcessingAlgs::setProjectVariable()
QCOMPARE( scope->variable( QStringLiteral( "my_var" ) ).toInt(), 13 );
}

#ifndef QT_NO_PRINTER
void TestQgsProcessingAlgs::exportLayoutPdf()
{
QgsProject p;
Expand Down Expand Up @@ -4793,6 +4797,7 @@ void TestQgsProcessingAlgs::exportAtlasLayoutPng()
QVERIFY( QFile::exists( QDir::tempPath() + "/my_atlas/custom_10.png" ) );
QVERIFY( imageCheck( "export_atlas_custom_layers", QDir::tempPath() + "/my_atlas/custom_1.png" ) );
}
#endif

void TestQgsProcessingAlgs::tinMeshCreation()
{
Expand Down

0 comments on commit ccdff23

Please sign in to comment.