Skip to content
Permalink
Browse files
Merge pull request #45737 from nirvn/delimitedtext_static
Unlock static build support for a bunch of providers
  • Loading branch information
nirvn committed Oct 31, 2021
2 parents 768ccc6 + d5302fc commit 9322dc6ffa94bb8e2d454f9536b589154b535a25
Showing with 935 additions and 351 deletions.
  1. +16 −1 src/core/CMakeLists.txt
  2. +24 −0 src/core/providers/qgsproviderregistry.cpp
  3. +15 −1 src/gui/CMakeLists.txt
  4. +26 −1 src/gui/qgsproviderguiregistry.cpp
  5. +10 −9 src/providers/CMakeLists.txt
  6. +86 −32 src/providers/arcgisrest/CMakeLists.txt
  7. +7 −0 src/providers/arcgisrest/qgsafsprovider.cpp
  8. +2 −0 src/providers/arcgisrest/qgsafsprovider.h
  9. +4 −0 src/providers/arcgisrest/qgsamsprovider.cpp
  10. +2 −0 src/providers/arcgisrest/qgsamsprovider.h
  11. +26 −25 src/providers/arcgisrest/qgsarcgisrestprovidergui.cpp
  12. +28 −0 src/providers/arcgisrest/qgsarcgisrestprovidergui.h
  13. +70 −30 src/providers/delimitedtext/CMakeLists.txt
  14. +7 −0 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  15. +2 −0 src/providers/delimitedtext/qgsdelimitedtextprovider.h
  16. +13 −14 src/providers/delimitedtext/qgsdelimitedtextprovidergui.cpp
  17. +26 −0 src/providers/delimitedtext/qgsdelimitedtextprovidergui.h
  18. +1 −0 src/providers/postgres/qgspostgresprovidergui.cpp
  19. +76 −30 src/providers/spatialite/CMakeLists.txt
  20. +6 −1 src/providers/spatialite/qgsspatialiteprovider.cpp
  21. +2 −0 src/providers/spatialite/qgsspatialiteprovider.h
  22. +19 −19 src/providers/spatialite/qgsspatialiteprovidergui.cpp
  23. +31 −0 src/providers/spatialite/qgsspatialiteprovidergui.h
  24. +2 −0 src/providers/spatialite/qgsspatialitesourceselect.h
  25. +79 −43 src/providers/virtual/CMakeLists.txt
  26. +12 −52 src/providers/virtual/qgsvirtuallayerprovider.cpp
  27. +7 −13 src/providers/virtual/qgsvirtuallayerprovider.h
  28. +58 −0 src/providers/virtual/qgsvirtuallayerprovidergui.cpp
  29. +23 −0 src/providers/virtual/qgsvirtuallayerprovidergui.h
  30. +59 −12 src/providers/wcs/CMakeLists.txt
  31. +9 −1 src/providers/wcs/qgswcsprovider.cpp
  32. +2 −0 src/providers/wcs/qgswcsprovider.h
  33. +18 −19 src/providers/wcs/qgswcsprovidergui.cpp
  34. +27 −0 src/providers/wcs/qgswcsprovidergui.h
  35. +67 −21 src/providers/wfs/CMakeLists.txt
  36. +1 −1 src/providers/wfs/qgsbasenetworkrequest.cpp
  37. +2 −2 src/providers/wfs/qgsbasenetworkrequest.h
  38. +5 −0 src/providers/wfs/qgsoapifprovider.cpp
  39. +2 −0 src/providers/wfs/qgsoapifprovider.h
  40. +8 −0 src/providers/wfs/qgswfsprovider.cpp
  41. +2 −0 src/providers/wfs/qgswfsprovider.h
  42. +23 −24 src/providers/wfs/qgswfsprovidergui.cpp
  43. +30 −0 src/providers/wfs/qgswfsprovidergui.h
@@ -2133,8 +2133,23 @@ endif()
if (FORCE_STATIC_LIBS)
target_link_libraries(qgis_core
provider_wms_a
provider_postgres_a
provider_wcs_a
provider_delimitedtext_a
provider_arcgisfeatureserver_a
provider_arcgismapserver_a
)
if (HAVE_SPATIALITE)
target_link_libraries(qgis_core
provider_spatialite_a
provider_wfs_a
provider_virtuallayer_a
)
endif()
if (HAVE_POSTGRESQL)
target_link_libraries(qgis_core
provider_postgres_a
)
endif()

if (WITH_AUTH)
target_link_libraries(qgis_core
@@ -44,8 +44,20 @@

#ifdef HAVE_STATIC_PROVIDERS
#include "qgswmsprovider.h"
#include "qgswcsprovider.h"
#include "qgsdelimitedtextprovider.h"
#include "qgsafsprovider.h"
#include "qgsamsprovider.h"
#ifdef HAVE_SPATIALITE
#include "qgsspatialiteprovider.h"
#include "qgswfsprovider.h"
#include "qgsoapifprovider.h"
#include "qgsvirtuallayerprovider.h"
#endif
#ifdef HAVE_POSTGRESQL
#include "qgspostgresprovider.h"
#endif
#endif

#include <QString>
#include <QDir>
@@ -190,7 +202,19 @@ void QgsProviderRegistry::init()

#ifdef HAVE_STATIC_PROVIDERS
mProviders[ QgsWmsProvider::providerKey() ] = new QgsWmsProviderMetadata();
mProviders[ QgsWcsProvider::providerKey() ] = new QgsWcsProviderMetadata();
mProviders[ QgsDelimitedTextProvider::providerKey() ] = new QgsDelimitedTextProviderMetadata();
mProviders[ QgsAfsProvider::providerKey() ] = new QgsAfsProviderMetadata();
mProviders[ QgsAmsProvider::providerKey() ] = new QgsAmsProviderMetadata();
#ifdef HAVE_SPATIALITE
mProviders[ QgsSpatiaLiteProvider::providerKey() ] = new QgsSpatiaLiteProviderMetadata();
mProviders[ QgsWFSProvider::providerKey() ] = new QgsWfsProviderMetadata();
mProviders[ QgsOapifProvider::providerKey() ] = new QgsOapifProviderMetadata();
mProviders[ QgsVirtualLayerProvider::providerKey() ] = new QgsVirtualLayerProviderMetadata();
#endif
#ifdef HAVE_POSTGRESQL
mProviders[ QgsPostgresProvider::providerKey() ] = new QgsPostgresProviderMetadata();
#endif
#endif

// add dynamic providers
@@ -1544,8 +1544,22 @@ endif()
if (FORCE_STATIC_LIBS)
target_link_libraries(qgis_gui
provider_wms_gui_a
provider_postgres_gui_a
provider_wcs_gui_a
provider_delimitedtext_gui_a
provider_arcgisfeatureserver_gui_a
)
if (HAVE_SPATIALITE)
target_link_libraries(qgis_gui
provider_spatialite_gui_a
provider_wfs_gui_a
provider_virtuallayer_gui_a
)
endif()
if (HAVE_POSTGRESQL)
target_link_libraries(qgis_gui
provider_postgres_gui_a
)
endif()
endif()

if(ENABLE_MODELTEST)
@@ -35,8 +35,18 @@

#ifdef HAVE_STATIC_PROVIDERS
#include "qgswmsprovidergui.h"
#include "qgswcsprovidergui.h"
#include "qgsdelimitedtextprovidergui.h"
#include "qgsarcgisrestprovidergui.h"
#ifdef HAVE_SPATIALITE
#include "qgsspatialiteprovidergui.h"
#include "qgswfsprovidergui.h"
#include "qgsvirtuallayerprovidergui.h"
#endif
#ifdef HAVE_POSTGRESQL
#include "qgspostgresprovidergui.h"
#endif
#endif

/**
* Convenience function for finding any existing data providers that match "providerKey"
@@ -92,10 +102,25 @@ void QgsProviderGuiRegistry::loadStaticProviders( )
#ifdef HAVE_STATIC_PROVIDERS
QgsProviderGuiMetadata *wms = new QgsWmsProviderGuiMetadata();
mProviders[ wms->key() ] = wms;

QgsProviderGuiMetadata *wcs = new QgsWcsProviderGuiMetadata();
mProviders[ wcs->key() ] = wcs;
QgsProviderGuiMetadata *delimitedtext = new QgsDelimitedTextProviderGuiMetadata();
mProviders[ delimitedtext->key() ] = delimitedtext;
QgsProviderGuiMetadata *arc = new QgsArcGisRestProviderGuiMetadata();
mProviders[ arc->key() ] = arc;
#ifdef HAVE_SPATIALITE
QgsProviderGuiMetadata *spatialite = new QgsSpatiaLiteProviderGuiMetadata();
mProviders[ spatialite->key() ] = spatialite;
QgsProviderGuiMetadata *wfs = new QgsWfsProviderGuiMetadata();
mProviders[ wfs->key() ] = wfs;
QgsProviderGuiMetadata *virtuallayer = new QgsVirtualLayerProviderGuiMetadata();
mProviders[ virtuallayer->key() ] = virtuallayer;
#endif
#ifdef HAVE_POSTGRESQL
QgsProviderGuiMetadata *postgres = new QgsPostgresProviderGuiMetadata();
mProviders[ postgres->key() ] = postgres;
#endif
#endif
}

void QgsProviderGuiRegistry::loadDynamicProviders( const QString &pluginPath )
@@ -4,29 +4,30 @@ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_PLUGIN_SUBDI

# providers with implemented both static and dynamic building
add_subdirectory(wms)
add_subdirectory(wcs)
add_subdirectory(delimitedtext)
add_subdirectory(arcgisrest)

if (WITH_SPATIALITE)
add_subdirectory(spatialite)
add_subdirectory(wfs)
add_subdirectory(virtual)
endif()

if (POSTGRES_FOUND)
add_subdirectory(postgres)
endif()

if (NOT FORCE_STATIC_LIBS)
add_subdirectory(arcgisrest)
add_subdirectory(delimitedtext)
add_subdirectory(geonode)
add_subdirectory(mssql)
add_subdirectory(wcs)
add_subdirectory(gpx)
add_subdirectory(db2)
add_subdirectory(mdal)
if (WITH_ANALYSIS)
add_subdirectory(virtualraster)
endif()

if (WITH_SPATIALITE)
add_subdirectory(spatialite)
add_subdirectory(virtual)
add_subdirectory(wfs)
endif()

if (WITH_ORACLE)
add_subdirectory(oracle)
endif()
@@ -1,14 +1,3 @@
include_directories(

${CMAKE_BINARY_DIR}/src/ui
)

if (WITH_GUI)
include_directories(SYSTEM
${QSCINTILLA_INCLUDE_DIR}
)
endif()

###############################################################################

set (AFS_SRCS
@@ -18,63 +7,128 @@ set (AFS_SRCS
qgsarcgisrestdataitems.cpp
)
if (WITH_GUI)
set(AFS_SRCS ${AFS_SRCS}
set(AFS_GUI_SRCS
qgsarcgisrestdataitemguiprovider.cpp
qgsarcgisrestprovidergui.cpp
qgsarcgisrestsourceselect.cpp
qgsarcgisrestsourcewidget.cpp
qgsnewarcgisrestconnection.cpp
)

set(AFS_UIS
qgsarcgisrestsourcewidgetbase.ui
qgsarcgisservicesourceselectbase.ui
qgsnewarcgisrestconnectionbase.ui
)
endif()

add_library (provider_arcgisfeatureserver_a STATIC ${AFS_SRCS})
add_library(provider_arcgisfeatureserver MODULE ${AFS_SRCS})

target_include_directories(provider_arcgisfeatureserver_a PUBLIC
${CMAKE_SOURCE_DIR}/src/providers/arcgisrest
)

# require c++17
target_compile_features(provider_arcgisfeatureserver_a PRIVATE cxx_std_17)
target_compile_features(provider_arcgisfeatureserver PRIVATE cxx_std_17)

target_link_libraries(provider_arcgisfeatureserver
qgis_core
${QCA_LIBRARY}
)

target_link_libraries (provider_arcgisfeatureserver_a
qgis_core
${QCA_LIBRARY}
)

if (WITH_GUI)
target_link_libraries(provider_arcgisfeatureserver
if (WITH_QT6)
QT6_WRAP_UI(AFS_UIS_H ${AFS_UIS})
else()
QT5_WRAP_UI(AFS_UIS_H ${AFS_UIS})
endif()

add_library(provider_arcgisfeatureserver_gui_a STATIC ${AFS_GUI_SRCS} ${AFS_UIS_H})

# require c++17
target_compile_features(provider_arcgisfeatureserver_gui_a PRIVATE cxx_std_17)

target_link_libraries(provider_arcgisfeatureserver_a
qgis_gui
)
target_link_libraries(provider_arcgisfeatureserver_a
target_link_libraries(provider_arcgisfeatureserver_gui_a
qgis_gui
)
add_dependencies(provider_arcgisfeatureserver ui)
add_dependencies(provider_arcgisfeatureserver_a ui)

include_directories(SYSTEM
${CMAKE_BINARY_DIR}/src/ui
${QSCINTILLA_INCLUDE_DIR}
)

add_dependencies(provider_arcgisfeatureserver_gui_a ui)
endif()

install (TARGETS provider_arcgisfeatureserver
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS provider_arcgisfeatureserver_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
if (WITH_GUI)
install (TARGETS provider_arcgisfeatureserver_gui_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
endif()
else()
add_library(provider_arcgisfeatureserver MODULE ${AFS_SRCS} ${AFS_GUI_SRCS} ${AFS_UIS_H})

target_link_libraries(provider_arcgisfeatureserver
qgis_core
${QCA_LIBRARY}
)

# require c++17
target_compile_features(provider_arcgisfeatureserver PRIVATE cxx_std_17)

if (WITH_GUI)
target_link_libraries(provider_arcgisfeatureserver
qgis_gui
)
add_dependencies(provider_arcgisfeatureserver ui)
endif()

install (TARGETS provider_arcgisfeatureserver
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()

###############################################################################

set (AMS_SRCS
qgsamsprovider.cpp
)

add_library(provider_arcgismapserver MODULE ${AMS_SRCS})
add_library (provider_arcgismapserver_a STATIC ${AMS_SRCS})

target_include_directories(provider_arcgismapserver_a PUBLIC
${CMAKE_SOURCE_DIR}/src/providers/arcgisrest
)

# require c++17
target_compile_features(provider_arcgismapserver PRIVATE cxx_std_17)
target_compile_features(provider_arcgismapserver_a PRIVATE cxx_std_17)

target_link_libraries(provider_arcgismapserver
target_link_libraries (provider_arcgismapserver_a
qgis_core
${QCA_LIBRARY}
)

install (TARGETS provider_arcgismapserver
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS provider_arcgismapserver_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
else()
add_library(provider_arcgismapserver MODULE ${AMS_SRCS})

# require c++17
target_compile_features(provider_arcgismapserver PRIVATE cxx_std_17)

target_link_libraries(provider_arcgismapserver
qgis_core
${QCA_LIBRARY}
)

install (TARGETS provider_arcgismapserver
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()
@@ -353,6 +353,11 @@ QString QgsAfsProvider::name() const
return AFS_PROVIDER_KEY;
}

QString QgsAfsProvider::providerKey()
{
return AFS_PROVIDER_KEY;
}

QString QgsAfsProvider::description() const
{
return AFS_PROVIDER_DESCRIPTION;
@@ -469,7 +474,9 @@ QgsAfsProvider *QgsAfsProviderMetadata::createProvider( const QString &uri, cons
}


#ifndef HAVE_STATIC_PROVIDERS
QGISEXTERN QgsProviderMetadata *providerMetadataFactory()
{
return new QgsAfsProviderMetadata();
}
#endif
@@ -78,6 +78,8 @@ class QgsAfsProvider : public QgsVectorDataProvider
QgsAbstractVectorLayerLabeling *createLabeling( const QVariantMap &configuration = QVariantMap() ) const override;
bool renderInPreview( const QgsDataProvider::PreviewContext &context ) override;

static QString providerKey();

private:
bool mValid = false;
std::shared_ptr<QgsAfsSharedData> mSharedData;
@@ -350,6 +350,8 @@ QgsRasterDataProvider::ProviderCapabilities QgsAmsProvider::providerCapabilities

QString QgsAmsProvider::name() const { return AMS_PROVIDER_KEY; }

QString QgsAmsProvider::providerKey() { return AMS_PROVIDER_KEY; }

QString QgsAmsProvider::description() const { return AMS_PROVIDER_DESCRIPTION; }

QStringList QgsAmsProvider::subLayerStyles() const
@@ -1318,7 +1320,9 @@ QString QgsAmsProviderMetadata::encodeUri( const QVariantMap &parts ) const
return dsUri.uri( false );
}

#ifndef HAVE_STATIC_PROVIDERS
QGISEXTERN QgsProviderMetadata *providerMetadataFactory()
{
return new QgsAmsProviderMetadata();
}
#endif
@@ -88,6 +88,8 @@ class QgsAmsProvider : public QgsRasterDataProvider
bool renderInPreview( const QgsDataProvider::PreviewContext &context ) override;
QgsLayerMetadata layerMetadata() const override;

static QString providerKey();

/* Inherited from QgsRasterInterface */
int bandCount() const override { return 1; }
int capabilities() const override { return Identify | IdentifyText | IdentifyFeature | Prefetch; }
Loading

0 comments on commit 9322dc6

Please sign in to comment.