do not require PDAL >= 2.5 for QGIS, make it requirement only for

processing provider
This commit is contained in:
Alexander Bruy 2023-03-13 16:57:42 +02:00 committed by Martin Dobias
parent 38da6956bc
commit ed1378b527
14 changed files with 58 additions and 28 deletions

View File

@ -22,7 +22,6 @@ cmake -GNinja \
-DSUPPRESS_QT_WARNINGS=ON \
-DENABLE_MODELTEST=OFF \
-DENABLE_PGTEST=OFF \
-DENABLE_SAGA_TESTS=OFF \
-DENABLE_MSSQLTEST=OFF \
-DENABLE_TESTS=OFF \
-DWITH_QSPATIALITE=OFF \

View File

@ -433,6 +433,9 @@ if(WITH_CORE)
endif()
find_package(PDAL REQUIRED) # PDAL provider
set(HAVE_PDAL_QGIS TRUE) # used in qgisconfig.h. note -- we can't use HAVE_PDAL here as the grass public headers redefine this!
if (PDAL_VERSION_MAJOR GREATER 3 OR (PDAL_VERSION_MAJOR EQUAL 2 AND PDAL_VERSION_MINOR GREATER_EQUAL 5))
set(PDAL_2_5_OR_HIGHER TRUE)
endif()
endif()
#############################################################

View File

@ -67,11 +67,8 @@ IF (PDAL_FOUND)
MESSAGE(STATUS "Found PDAL: ${PDAL_LIBRARIES} (${PDAL_VERSION})")
ENDIF (NOT PDAL_FIND_QUIETLY)
IF (PDAL_VERSION_MAJOR LESS 2)
MESSAGE (FATAL_ERROR "PDAL version is too old (${PDAL_VERSION}). Use 2.5 or higher.")
ENDIF (PDAL_VERSION_MAJOR LESS 2)
IF ((PDAL_VERSION_MAJOR EQUAL 2) AND (PDAL_VERSION_MINOR LESS 5))
MESSAGE (FATAL_ERROR "PDAL version is too old (${PDAL_VERSION}). Use 2.5 or higher.")
IF ((PDAL_VERSION_MAJOR EQUAL 1) AND (PDAL_VERSION_MINOR LESS 7))
MESSAGE (FATAL_ERROR "PDAL version is too old (${PDAL_VERSION}). Use 1.7 or higher.")
ENDIF()
ELSE (PDAL_FOUND)

View File

@ -193,6 +193,10 @@ set (PY_MODULES core)
if(WITH_ANALYSIS)
set(PY_MODULES ${PY_MODULES} analysis)
if (NOT WITH_PDAL OR (WITH_PDAL AND NOT PDAL_2_5_OR_HIGHER))
set(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} HAVE_PDAL_PROVIDER)
endif()
endif()
# gui module
@ -282,13 +286,16 @@ endif()
if(WITH_ANALYSIS)
include_directories(BEFORE
${CMAKE_BINARY_DIR}/src/analysis/processing
${CMAKE_BINARY_DIR}/src/analysis/processing/pdal
${CMAKE_BINARY_DIR}/src/analysis/georeferencing
${CMAKE_BINARY_DIR}/src/analysis/vector
${CMAKE_BINARY_DIR}/src/analysis/mesh
${CMAKE_BINARY_DIR}/src/analysis/raster
${CMAKE_BINARY_DIR}/src/analysis/network
${CMAKE_BINARY_DIR}/src/analysis/interpolation
if (WITH_PDAL AND NOT PDAL_2_5_OR_HIGHER)
${CMAKE_SOURCE_DIR}/src/analysis/processing/pdal
endif()
)
# analysis module

View File

@ -9,4 +9,6 @@ ${DEFAULTDOCSTRINGSIGNATURE}
%Import core/core.sip
%Feature HAVE_PDAL_PROVIDER
%Include analysis_auto.sip

View File

@ -46,4 +46,6 @@
%Include auto_generated/vector/qgsgeometrysnapper.sip
%Include auto_generated/vector/qgsgeometrysnappersinglesource.sip
%Include auto_generated/vector/qgszonalstatistics.sip
%If ( HAVE_PDAL_PROVIDER )
%Include auto_generated/processing/pdal/qgspdalalgorithms.sip
%End

View File

@ -9,6 +9,8 @@
class QgsPdalAlgorithms: QgsProcessingProvider
{
%Docstring(signature="appended")
@ -18,7 +20,7 @@ PDAL Processing algorithm provider.
%End
%TypeHeaderCode
#include "processing/pdal/qgspdalalgorithms.h"
#include "qgspdalalgorithms.h"
%End
public:

View File

@ -417,7 +417,7 @@ if (${QT_VERSION_BASE}PrintSupport_FOUND)
)
endif()
if (WITH_PDAL)
if (WITH_PDAL AND PDAL_2_5_OR_HIGHER)
set(QGIS_ANALYSIS_SRCS ${QGIS_ANALYSIS_SRCS}
processing/pdal/qgspdalalgorithms.cpp
@ -510,6 +510,10 @@ target_include_directories(qgis_analysis PUBLIC
${CMAKE_SOURCE_DIR}/src/analysis/vector/geometry_checker
${CMAKE_BINARY_DIR}/src/analysis
if (WITH_PDAL AND NOT PDAL_2_5_OR_HIGHER)
${CMAKE_SOURCE_DIR}/src/analysis/processing/pdal
endif()
)
GENERATE_EXPORT_HEADER(

View File

@ -22,12 +22,15 @@
#include "qgis_sip.h"
#include "qgsprocessingprovider.h"
SIP_IF_MODULE( HAVE_PDAL_PROVIDER )
/**
* \ingroup analysis
* \class QgsPdalAlgorithms
* \brief PDAL Processing algorithm provider.
* \since QGIS 3.32
*/
class ANALYSIS_EXPORT QgsPdalAlgorithms: public QgsProcessingProvider
{
Q_OBJECT

View File

@ -476,7 +476,9 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#ifdef HAVE_PDAL_QGIS
#include <pdal/pdal.hpp>
#include "processing/pdal/qgspdalalgorithms.h"
#if PDAL_VERSION_MAJOR_INT > 2 || (PDAL_VERSION_MAJOR_INT == 2 && PDAL_VERSION_MINOR_INT >= 5)
#include "qgspdalalgorithms.h"
#endif
#endif
//
@ -13028,8 +13030,10 @@ void QgisApp::initNativeProcessing()
#endif
#ifdef HAVE_PDAL_QGIS
#if PDAL_VERSION_MAJOR_INT > 1 && PDAL_VERSION_MINOR_INT >= 5
QgsApplication::processingRegistry()->addProvider( new QgsPdalAlgorithms( QgsApplication::processingRegistry() ) );
#endif
#endif
}
void QgisApp::initLayouts()

View File

@ -24,7 +24,9 @@
#include "qgs3dalgorithms.h"
#endif
#ifdef HAVE_PDAL_QGIS
#include "processing/pdal/qgspdalalgorithms.h"
#if PDAL_VERSION_MAJOR_INT > 2 || (PDAL_VERSION_MAJOR_INT == 2 && PDAL_VERSION_MINOR_INT >= 5)
#include "qgspdalalgorithms.h"
#endif
#endif
#include "qgssettings.h"
#include "qgsapplication.h"
@ -277,9 +279,12 @@ int QgsProcessingExec::run( const QStringList &constArgs )
#ifdef HAVE_3D
QgsApplication::processingRegistry()->addProvider( new Qgs3DAlgorithms( QgsApplication::processingRegistry() ) );
#endif
#ifdef HAVE_PDAL_QGIS
#if PDAL_VERSION_MAJOR_INT > 1 && PDAL_VERSION_MINOR_INT >= 5
QgsApplication::processingRegistry()->addProvider( new QgsPdalAlgorithms( QgsApplication::processingRegistry() ) );
#endif
#endif
#ifdef WITH_BINDINGS
if ( !mSkipPython )

View File

@ -172,23 +172,25 @@ else()
target_include_directories(untwine PRIVATE ${CMAKE_SOURCE_DIR}/external)
endif()
add_executable(pdal_wrench ${PDAL_WRENCH_SRCS})
target_compile_features(pdal_wrench PRIVATE cxx_std_17)
if (PDAL_2_5_OR_HIGHER)
add_executable(pdal_wrench ${PDAL_WRENCH_SRCS})
target_compile_features(pdal_wrench PRIVATE cxx_std_17)
set_target_properties(pdal_wrench PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIBEXEC_SUBDIR}
)
set_target_properties(pdal_wrench PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIBEXEC_SUBDIR}
)
target_include_directories(pdal_wrench PRIVATE
${PDAL_INCLUDE_DIR}
${GDAL_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/external
)
target_include_directories(pdal_wrench PRIVATE
${PDAL_INCLUDE_DIR}
${GDAL_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/external
)
target_link_libraries (pdal_wrench PRIVATE
${PDAL_LIBRARIES}
${GDAL_LIBRARY}
)
target_link_libraries (pdal_wrench PRIVATE
${PDAL_LIBRARIES}
${GDAL_LIBRARY}
)
endif()
add_library (provider_pdal MODULE ${PDAL_SRCS} ${PDAL_HDRS} ${PDAL_GUI_SRCS} ${PDAL_GUI_HDRS})

View File

@ -37,7 +37,7 @@ if(HAVE_GSL)
set(TESTS ${TESTS} testqgsgcptransformer.cpp)
endif()
if(HAVE_PDAL_QGIS)
if (WITH_PDAL AND PDAL_2_5_OR_HIGHER)
set(TESTS ${TESTS} testqgsprocessingpdalalgs.cpp)
endif()

View File

@ -20,8 +20,8 @@
#include "qgstest.h"
#include "qgsprocessingregistry.h"
#include "qgsprocessingcontext.h"
#include "processing/pdal/qgspdalalgorithms.h"
#include "processing/pdal/qgspdalalgorithmbase.h"
#include "qgspdalalgorithms.h"
#include "qgspdalalgorithmbase.h"
class TestQgsProcessingPdalAlgs: public QObject