able to build without zstd and lazperf

This commit is contained in:
Peter Petrik 2020-10-23 19:14:23 +02:00 committed by Nyall Dawson
parent 8536c564fb
commit bb5b625bc4
3 changed files with 39 additions and 2 deletions

View File

@ -351,7 +351,13 @@ IF(WITH_CORE)
MESSAGE(STATUS "Found zlib: ${ZLIB_LIBRARIES}")
FIND_PACKAGE(ZSTD REQUIRED) # for decompression of point clouds
IF (ZSTD_FOUND)
SET(HAVE_ZSTD TRUE) # used in qgsconfig.h
ENDIF (ZSTD_FOUND)
FIND_PACKAGE(LazPerf REQUIRED) # for decompression of point clouds
IF (LazPerf_FOUND)
SET(HAVE_LAZPERF TRUE) # used in qgsconfig.h
ENDIF (LazPerf_FOUND)
# optional
IF (WITH_POSTGRESQL)
@ -380,6 +386,7 @@ IF(WITH_CORE)
ELSE (WITH_QTWEBKIT)
MESSAGE(STATUS "Qt WebKit support DISABLED.")
ENDIF(WITH_QTWEBKIT)
#############################################################
# search for Qt5
SET(QT_MIN_VERSION 5.9.0)

View File

@ -76,5 +76,9 @@
#cmakedefine HAVE_STATIC_PROVIDERS
#cmakedefine HAVE_ZSTD
#cmakedefine HAVE_LAZPERF
#endif

View File

@ -18,13 +18,19 @@
#include "qgseptdecoder.h"
#include "qgseptpointcloudindex.h"
#include "qgsvector3d.h"
#include "qgsconfig.h"
#include <zstd.h>
#include <QFile>
#include <iostream>
#if defined ( HAVE_ZSTD )
#include <zstd.h>
#endif
#if defined ( HAVE_LAZPERF )
#include "laz-perf/io.hpp"
#include "laz-perf/common/common.hpp"
#endif
///@cond PRIVATE
@ -78,6 +84,8 @@ QVector<char> QgsEptDecoder::decompressBinaryClasses( const QString &filename, i
/* *************************************************************************************** */
#if defined(HAVE_ZSTD)
QByteArray decompressZtdStream( const QByteArray &dataCompressed )
{
// NOTE: this is very primitive implementation because we expect the uncompressed
@ -135,8 +143,18 @@ QVector<qint32> QgsEptDecoder::decompressZStandard( const QString &filename, int
return data;
}
#else // defined(HAVE_ZSTD)
QVector<qint32> QgsEptDecoder::decompressZStandard( const QString &filename, int pointRecordSize )
{
//TODO graceful error
Q_ASSERT( false );
}
#endif // defined(HAVE_ZSTD)
/* *************************************************************************************** */
#if defined ( HAVE_LAZPERF )
QVector<qint32> QgsEptDecoder::decompressLaz( const QString &filename )
{
std::ifstream file( filename.toLatin1().constData(), std::ios::binary );
@ -165,4 +183,12 @@ QVector<qint32> QgsEptDecoder::decompressLaz( const QString &filename )
return data;
}
#else // defined ( HAVE_LAZPERF )
QVector<qint32> QgsEptDecoder::decompressLaz( const QString &filename )
{
//TODO graceful return and error message
Q_ASSERT( false );
}
#endif
///@endcond