Switch from silently building broken Entwine point cloud support

when dependancies are missing (libzstd, lazperf) to an explicit
WITH_EPT optional cmake switch which requires those dependancies

This makes it easier people to determine whether they have the
complete set of necessary dependancies to build Entwine point
cloud support, as cmake will show an error if they enable WITH_EPT
but don't have them...
This commit is contained in:
Nyall Dawson 2020-11-06 15:11:31 +10:00
parent 610703c59d
commit f5a4880e70
12 changed files with 78 additions and 78 deletions

View File

@ -242,6 +242,11 @@ IF(WITH_CORE)
SET(HAVE_PDAL TRUE)
ENDIF(WITH_PDAL)
SET (WITH_EPT FALSE CACHE BOOL "Determines whether Entwine Point Cloud (EPT) support should be built")
IF(WITH_EPT)
SET(HAVE_EPT TRUE)
ENDIF(WITH_EPT)
#BUILD WITH QtMobility by default on android only. Other platform can force it
IF (ANDROID)
SET (DEFAULT_WITH_QTMOBILITY TRUE)
@ -355,18 +360,6 @@ IF(WITH_CORE)
FIND_PACKAGE(ZLIB REQUIRED) # for decompression of vector tiles in MBTiles file
MESSAGE(STATUS "Found zlib: ${ZLIB_LIBRARIES}")
FIND_PACKAGE(ZSTD) # for decompression of point clouds
SET(HAVE_ZSTD FALSE)
IF (ZSTD_FOUND)
SET(HAVE_ZSTD TRUE) # used in qgsconfig.h
ENDIF (ZSTD_FOUND)
SET(HAVE_LAZPERF FALSE)
FIND_PACKAGE(LazPerf) # for decompression of point clouds
IF (LazPerf_FOUND)
SET(HAVE_LAZPERF TRUE) # used in qgsconfig.h
ENDIF (LazPerf_FOUND)
# optional
IF (WITH_POSTGRESQL)
FIND_PACKAGE(Postgres) # PostgreSQL provider
@ -395,6 +388,12 @@ IF(WITH_CORE)
MESSAGE(STATUS "Qt WebKit support DISABLED.")
ENDIF(WITH_QTWEBKIT)
IF (WITH_EPT) # EPT provider
FIND_PACKAGE(ZSTD) # for decompression of point clouds
FIND_PACKAGE(LazPerf) # for decompression of point clouds
SET(HAVE_EPT TRUE) # used in qgsconfig.h
ENDIF (WITH_EPT)
IF (WITH_PDAL)
FIND_PACKAGE(PDAL) # PDAL provider
ENDIF (WITH_PDAL)

View File

@ -26,6 +26,5 @@ MARK_AS_ADVANCED(LazPerf_INCLUDE_DIR)
IF (LazPerf_FOUND)
MESSAGE(STATUS "Found laz-perf: ${LazPerf_INCLUDE_DIR}")
ELSE (LazPerf_FOUND)
# optional dependency only
MESSAGE(STATUS "Could not find laz-perf")
MESSAGE(FATAL_ERROR "Could not find laz-perf")
ENDIF (LazPerf_FOUND)

View File

@ -30,5 +30,5 @@ MARK_AS_ADVANCED(ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
IF (ZSTD_FOUND)
MESSAGE(STATUS "Found ZSTD: ${ZSTD_LIBRARY}")
ELSE (ZSTD_FOUND)
MESSAGE(STATUS "Could not find ZSTD")
MESSAGE(FATAL_ERROR "Could not find ZSTD")
ENDIF (ZSTD_FOUND)

View File

@ -76,9 +76,7 @@
#cmakedefine HAVE_STATIC_PROVIDERS
#cmakedefine HAVE_ZSTD
#cmakedefine HAVE_LAZPERF
#cmakedefine HAVE_EPT
#cmakedefine HAVE_PDAL
#define PDAL_VERSION "${PDAL_VERSION}"

View File

@ -204,11 +204,6 @@ SET(QGIS_CORE_SRCS
providers/ogr/qgsogrdbconnection.cpp
providers/ogr/qgsogrtransaction.cpp
providers/ept/qgseptdataitems.cpp
providers/ept/qgseptprovider.cpp
providers/ept/qgseptdecoder.cpp
providers/ept/qgseptpointcloudindex.cpp
scalebar/qgsdoubleboxscalebarrenderer.cpp
scalebar/qgshollowscalebarrenderer.cpp
scalebar/qgsnumericscalebarrenderer.cpp
@ -1384,10 +1379,6 @@ SET(QGIS_CORE_HDRS
providers/ogr/qgsogrdbconnection.h
providers/ogr/qgsogrprovider.h
providers/ogr/qgsogrtransaction.h
providers/ept/qgseptdataitems.h
providers/ept/qgseptprovider.h
providers/ept/qgseptdecoder.h
providers/ept/qgseptpointcloudindex.h
raster/qgsbilinearrasterresampler.h
raster/qgsbrightnesscontrastfilter.h
@ -1612,7 +1603,6 @@ INCLUDE_DIRECTORIES(
providers/gdal
providers/ogr
providers/meshmemory
providers/ept
raster
renderer
scalebar
@ -1645,18 +1635,6 @@ INCLUDE_DIRECTORIES(SYSTEM
${ZLIB_INCLUDE_DIRS}
)
IF (HAVE_ZSTD)
INCLUDE_DIRECTORIES(SYSTEM
${ZSTD_INCLUDE_DIR}
)
ENDIF (HAVE_ZSTD)
IF (HAVE_LAZPERF)
INCLUDE_DIRECTORIES(SYSTEM
${LazPerf_INCLUDE_DIR}
)
ENDIF (HAVE_LAZPERF)
IF (HAVE_PDAL)
INCLUDE_DIRECTORIES(SYSTEM
${PDAL_INCLUDE_DIR}
@ -1673,6 +1651,27 @@ IF (HAVE_OPENCL)
INCLUDE_DIRECTORIES(SYSTEM ${OpenCL_INCLUDE_DIRS})
ENDIF (HAVE_OPENCL)
IF (WITH_EPT)
INCLUDE_DIRECTORIES(providers/ept)
INCLUDE_DIRECTORIES(SYSTEM
${ZSTD_INCLUDE_DIR}
${LazPerf_INCLUDE_DIR}
)
SET(QGIS_CORE_SRCS ${QGIS_CORE_SRCS}
providers/ept/qgseptdataitems.cpp
providers/ept/qgseptprovider.cpp
providers/ept/qgseptdecoder.cpp
providers/ept/qgseptpointcloudindex.cpp
)
SET(QGIS_CORE_HDRS ${QGIS_CORE_HDRS}
providers/ept/qgseptdataitems.h
providers/ept/qgseptprovider.h
providers/ept/qgseptdecoder.h
providers/ept/qgseptpointcloudindex.h
)
ENDIF (WITH_EPT)
IF (APPLE)
# Libtasn1 is for DER-encoded PKI ASN.1 parsing/extracting workarounds
@ -1800,11 +1799,11 @@ TARGET_LINK_LIBRARIES(qgis_core
${ZLIB_LIBRARIES}
)
IF (HAVE_ZSTD)
IF (WITH_EPT)
TARGET_LINK_LIBRARIES(qgis_core
${ZSTD_LIBRARY}
)
ENDIF (HAVE_ZSTD)
ENDIF (WITH_EPT)
IF (HAVE_PDAL)
TARGET_LINK_LIBRARIES(qgis_core

View File

@ -20,20 +20,17 @@
#include "qgspointcloudattribute.h"
#include "qgsvector3d.h"
#include "qgsconfig.h"
#include "qgslogger.h"
#include <QFile>
#include <iostream>
#include <memory>
#include <cstring>
#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
@ -201,8 +198,6 @@ QgsPointCloudBlock *QgsEptDecoder::decompressBinary( const QString &filename, co
/* *************************************************************************************** */
#if defined(HAVE_ZSTD)
QByteArray decompressZtdStream( const QByteArray &dataCompressed )
{
// NOTE: this is very primitive implementation because we expect the uncompressed
@ -246,20 +241,8 @@ QgsPointCloudBlock *QgsEptDecoder::decompressZStandard( const QString &filename,
return _decompressBinary( dataUncompressed, attributes, requestedAttributes );
}
#else // defined(HAVE_ZSTD)
QgsPointCloudBlock *QgsEptDecoder::decompressZStandard( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
{
Q_UNUSED( filename )
Q_UNUSED( attributes )
Q_UNUSED( requestedAttributes )
return nullptr;
}
#endif // defined(HAVE_ZSTD)
/* *************************************************************************************** */
#if defined ( HAVE_LAZPERF )
QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QString &filename,
const QgsPointCloudAttributeCollection &attributes,
const QgsPointCloudAttributeCollection &requestedAttributes )
@ -311,7 +294,7 @@ QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QString &filename,
}
}
float t = common::since( start );
std::cout << "LAZ-PERF Read through the points in " << t << " seconds." << std::endl;
QgsDebugMsgLevel( QStringLiteral( "LAZ-PERF Read through the points in %1 seconds." ).arg( t ), 2 );
return new QgsPointCloudBlock(
count,
requestedAttributes,
@ -319,14 +302,4 @@ QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QString &filename,
);
}
#else // defined ( HAVE_LAZPERF )
QgsPointCloudBlock *QgsEptDecoder::decompressLaz( const QString &filename, const QgsPointCloudAttributeCollection &attributes, const QgsPointCloudAttributeCollection &requestedAttributes )
{
Q_UNUSED( filename )
Q_UNUSED( attributes )
Q_UNUSED( requestedAttributes )
return nullptr;
}
#endif
///@endcond

View File

@ -36,7 +36,11 @@
#include "providers/gdal/qgsgdalprovider.h"
#include "providers/ogr/qgsogrprovider.h"
#include "providers/meshmemory/qgsmeshmemorydataprovider.h"
#ifdef HAVE_EPT
#include "providers/ept/qgseptprovider.h"
#endif
#include "qgsruntimeprofiler.h"
#include "qgsfileutils.h"
@ -139,11 +143,13 @@ void QgsProviderRegistry::init()
QgsProviderMetadata *vt = new QgsVectorTileProviderMetadata();
mProviders[ vt->key() ] = vt;
}
#ifdef HAVE_EPT
{
QgsScopedRuntimeProfile profile( QObject::tr( "Create EPT point cloud provider" ) );
QgsProviderMetadata *pc = new QgsEptProviderMetadata();
mProviders[ pc->key() ] = pc;
}
#endif
#ifdef HAVE_STATIC_PROVIDERS
mProviders[ QgsWmsProvider::providerKey() ] = new QgsWmsProviderMetadata();
mProviders[ QgsPostgresProvider::providerKey() ] = new QgsPostgresProviderMetadata();

View File

@ -349,7 +349,6 @@ SET(QGIS_GUI_SRCS
providers/ept/qgspointcloudsourceselect.cpp
providers/ept/qgseptproviderguimetadata.cpp
providers/ept/qgseptdataitemguiprovider.cpp
tableeditor/qgstableeditordialog.cpp
tableeditor/qgstableeditorformattingwidget.cpp
@ -1110,7 +1109,6 @@ SET(QGIS_GUI_HDRS
providers/ept/qgspointcloudsourceselect.h
providers/ept/qgseptproviderguimetadata.h
providers/ept/qgseptdataitemguiprovider.h
raster/qgscolorrampshaderwidget.h
raster/qgshillshaderendererwidget.h
@ -1308,9 +1306,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/gui/ogr
${CMAKE_SOURCE_DIR}/src/gui/processing
${CMAKE_SOURCE_DIR}/src/gui/processing/models
${CMAKE_SOURCE_DIR}/src/gui/providers/ept
${CMAKE_SOURCE_DIR}/src/gui/providers/gdal
${CMAKE_SOURCE_DIR}/src/gui/providers/ogr
${CMAKE_SOURCE_DIR}/src/gui/providers/ept
${CMAKE_SOURCE_DIR}/src/gui/pointcloud
${CMAKE_SOURCE_DIR}/src/gui/raster
${CMAKE_SOURCE_DIR}/src/gui/vector
@ -1371,6 +1369,16 @@ INCLUDE_DIRECTORIES(SYSTEM
${Protobuf_INCLUDE_DIRS}
)
IF (WITH_EPT)
SET(QGIS_GUI_SRCS ${QGIS_GUI_SRCS}
providers/ept/qgseptdataitemguiprovider.cpp
)
SET(QGIS_GUI_HDRS ${QGIS_GUI_HDRS}
providers/ept/qgseptdataitemguiprovider.h
)
ENDIF (WITH_EPT)
# disable deprecation warnings for classes re-exporting deprecated methods
IF(MSVC)
SET_SOURCE_FILES_PROPERTIES(

View File

@ -18,8 +18,12 @@
#include "qgsapplication.h"
#include "qgssourceselectprovider.h"
#include "qgspointcloudsourceselect.h"
#include "qgseptproviderguimetadata.h"
#ifdef HAVE_EPT
#include "qgseptdataitemguiprovider.h"
#endif
///@cond PRIVATE
@ -42,11 +46,13 @@ QgsEptProviderGuiMetadata::QgsEptProviderGuiMetadata()
{
}
#ifdef HAVE_EPT
QList<QgsDataItemGuiProvider *> QgsEptProviderGuiMetadata::dataItemGuiProviders()
{
return QList<QgsDataItemGuiProvider *>()
<< new QgsEptDataItemGuiProvider;
}
#endif
QList<QgsSourceSelectProvider *> QgsEptProviderGuiMetadata::sourceSelectProviders()
{

View File

@ -31,7 +31,12 @@ class QgsEptProviderGuiMetadata: public QgsProviderGuiMetadata
public:
QgsEptProviderGuiMetadata();
#ifdef HAVE_EPT
QList<QgsDataItemGuiProvider *> dataItemGuiProviders() override;
#endif
// for now we always include the "ept" provider source select provider, as it actually
// forms the generic point cloud source select widget
QList<QgsSourceSelectProvider *> sourceSelectProviders() override;
};

View File

@ -14,7 +14,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/metadata
${CMAKE_SOURCE_DIR}/src/core/pal
${CMAKE_SOURCE_DIR}/src/core/pointcloud
${CMAKE_SOURCE_DIR}/src/core/providers/ept
${CMAKE_SOURCE_DIR}/src/core/raster
${CMAKE_SOURCE_DIR}/src/core/symbology
${CMAKE_SOURCE_DIR}/src/core/effects
@ -24,7 +23,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/providers/arcgisrest
${CMAKE_SOURCE_DIR}/src/providers/mdal
${CMAKE_SOURCE_DIR}/src/providers/ogr
${CMAKE_SOURCE_DIR}/src/providers/ept
${CMAKE_SOURCE_DIR}/src/test
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/external/nlohmann
@ -106,11 +104,20 @@ ADD_QGIS_TEST(postgresconntest testqgspostgresconn.cpp)
TARGET_LINK_LIBRARIES(qgis_postgresconntest postgresprovider_a qgis_core)
IF (NOT FORCE_STATIC_PROVIDERS)
ADD_QGIS_TEST(eptprovidertest testqgseptprovider.cpp)
ADD_QGIS_TEST(mdalprovidertest testqgsmdalprovider.cpp)
ENDIF (NOT FORCE_STATIC_PROVIDERS)
IF (WITH_EPT)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/core/providers/ept
)
ADD_QGIS_TEST(eptprovidertest testqgseptprovider.cpp)
ENDIF(WITH_EPT)
IF (WITH_PDAL)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/providers/pdal
)
ADD_QGIS_TEST(pdalprovidertest testqgspdalprovider.cpp)
TARGET_LINK_LIBRARIES(qgis_pdalprovidertest pdalprovider_a qgis_core)
ENDIF(WITH_PDAL)

View File

@ -27,7 +27,7 @@
#include "qgis.h"
#include "qgsapplication.h"
#include "qgsproviderregistry.h"
#include "qgseptprovider.h"
#include "qgspdalprovider.h"
#include "qgsmaplayer.h"
/**