Skip to content
Permalink
Browse files
[wcs] Unlock static build support
  • Loading branch information
nirvn committed Oct 31, 2021
1 parent 187389e commit 2733b7e44101d94d07a2b610d02f9b12a61b6ca4
@@ -2133,6 +2133,7 @@ endif()
if (FORCE_STATIC_LIBS)
target_link_libraries(qgis_core
provider_wms_a
provider_wcs_a
provider_delimitedtext_a
provider_arcgisfeatureserver_a
provider_arcgismapserver_a
@@ -44,6 +44,7 @@

#ifdef HAVE_STATIC_PROVIDERS
#include "qgswmsprovider.h"
#include "qgswcsprovider.h"
#include "qgsdelimitedtextprovider.h"
#include "qgsafsprovider.h"
#include "qgsamsprovider.h"
@@ -201,6 +202,7 @@ 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();
@@ -1544,6 +1544,7 @@ endif()
if (FORCE_STATIC_LIBS)
target_link_libraries(qgis_gui
provider_wms_gui_a
provider_wcs_gui_a
provider_delimitedtext_gui_a
provider_arcgisfeatureserver_gui_a
)
@@ -35,6 +35,7 @@

#ifdef HAVE_STATIC_PROVIDERS
#include "qgswmsprovidergui.h"
#include "qgswcsprovidergui.h"
#include "qgsdelimitedtextprovidergui.h"
#include "qgsarcgisrestprovidergui.h"
#ifdef HAVE_SPATIALITE
@@ -101,6 +102,8 @@ 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();
@@ -4,6 +4,7 @@ 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)

@@ -20,7 +21,6 @@ endif()
if (NOT FORCE_STATIC_LIBS)
add_subdirectory(geonode)
add_subdirectory(mssql)
add_subdirectory(wcs)
add_subdirectory(gpx)
add_subdirectory(db2)
add_subdirectory(mdal)
@@ -7,33 +7,80 @@ set (WCS_SRCS
)

if (WITH_GUI)
set(WCS_SRCS ${WCS_SRCS}
set(WCS_GUI_SRCS
qgswcsprovidergui.cpp
qgswcsdataitemguiprovider.cpp
qgswcssourceselect.cpp
)
endif()

include_directories(
########################################################
# Static
add_library(provider_wcs_a STATIC ${WCS_SRCS})

${CMAKE_BINARY_DIR}/src/ui
target_include_directories(provider_wcs_a PUBLIC
${CMAKE_SOURCE_DIR}/src/providers/wcs
)

add_library(provider_wcs MODULE ${WCS_SRCS})
target_link_libraries(provider_wcs_a
qgis_core
)

# require c++17
target_compile_features(provider_wcs PRIVATE cxx_std_17)
target_compile_features(provider_wcs_a PRIVATE cxx_std_17)

target_link_libraries(provider_wcs
qgis_core
)
target_compile_definitions(provider_wcs_a PRIVATE "-DQT_NO_FOREACH")

if (WITH_GUI)
target_link_libraries (provider_wcs
add_library(provider_wcs_gui_a STATIC ${WCS_GUI_SRCS})

target_include_directories(provider_wcs_gui_a PUBLIC
${CMAKE_BINARY_DIR}/src/providers/wcs
)

target_link_libraries(provider_wcs_a
qgis_gui
)
target_link_libraries(provider_wcs_gui_a
qgis_gui
)

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

target_compile_definitions(provider_wcs_gui_a PRIVATE "-DQT_NO_FOREACH")

add_dependencies(provider_wcs_gui_a ui)

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

install (TARGETS provider_wcs
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_wcs_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
if (WITH_GUI)
install (TARGETS provider_wcs_gui_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
endif()
else()
add_library(provider_wcs MODULE ${WCS_SRCS} ${WCS_GUI_SRCS})

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

target_link_libraries(provider_wcs
qgis_core
)

if (WITH_GUI)
target_link_libraries (provider_wcs
qgis_gui
)
endif()

install (TARGETS provider_wcs
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()
@@ -1586,7 +1586,12 @@ QString QgsWcsProvider::lastErrorFormat()
return mErrorFormat;
}

QString QgsWcsProvider::name() const
QString QgsWcsProvider::name() const
{
return WCS_KEY;
}

QString QgsWcsProvider::providerKey()
{
return WCS_KEY;
}
@@ -1979,7 +1984,10 @@ QList< QgsDataItemProvider * > QgsWcsProviderMetadata::dataItemProviders() const
QgsWcsProviderMetadata::QgsWcsProviderMetadata():
QgsProviderMetadata( QgsWcsProvider::WCS_KEY, QgsWcsProvider::WCS_DESCRIPTION ) {}


#ifndef HAVE_STATIC_PROVIDERS
QGISEXTERN QgsProviderMetadata *providerMetadataFactory()
{
return new QgsWcsProviderMetadata();
}
#endif
@@ -190,6 +190,8 @@ class QgsWcsProvider final: public QgsRasterDataProvider, QgsGdalProviderBase
QgsRasterDataProvider::ProviderCapabilities providerCapabilities() const override;
QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo )const override;

static QString providerKey();

int colorInterpretation( int bandNo ) const override;

static QMap<QString, QString> supportedMimes();
@@ -13,8 +13,9 @@
* *
***************************************************************************/

#include "qgswcsprovider.h"
#include "qgswcsprovidergui.h"

#include "qgswcsprovider.h"
#include "qgswcssourceselect.h"
#include "qgssourceselectprovider.h"
#include "qgsproviderguimetadata.h"
@@ -37,30 +38,28 @@ class QgsWcsSourceSelectProvider : public QgsSourceSelectProvider
};


class QgsWcsProviderGuiMetadata: public QgsProviderGuiMetadata
QgsWcsProviderGuiMetadata::QgsWcsProviderGuiMetadata()
: QgsProviderGuiMetadata( QgsWcsProvider::WCS_KEY )
{
public:
QgsWcsProviderGuiMetadata()
: QgsProviderGuiMetadata( QgsWcsProvider::WCS_KEY )
{
}
}

QList<QgsSourceSelectProvider *> sourceSelectProviders() override
{
QList<QgsSourceSelectProvider *> providers;
providers << new QgsWcsSourceSelectProvider;
return providers;
}
QList<QgsSourceSelectProvider *> QgsWcsProviderGuiMetadata::sourceSelectProviders()
{
QList<QgsSourceSelectProvider *> providers;
providers << new QgsWcsSourceSelectProvider;
return providers;
}

QList<QgsDataItemGuiProvider *> dataItemGuiProviders() override
{
return QList<QgsDataItemGuiProvider *>()
<< new QgsWcsDataItemGuiProvider;
}
};
QList<QgsDataItemGuiProvider *> QgsWcsProviderGuiMetadata::dataItemGuiProviders()
{
return QList<QgsDataItemGuiProvider *>()
<< new QgsWcsDataItemGuiProvider;
}


#ifndef HAVE_STATIC_PROVIDERS
QGISEXTERN QgsProviderGuiMetadata *providerGuiMetadataFactory()
{
return new QgsWcsProviderGuiMetadata();
}
#endif
@@ -0,0 +1,27 @@
/***************************************************************************
qgswcsprovidergui.h
--------------------------------------
Date : June 2019
Copyright : (C) 2019 by Martin Dobias
Email : wonder dot sk at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgswcsprovider.h"
#include "qgsproviderguimetadata.h"

class QgsWcsProviderGuiMetadata: public QgsProviderGuiMetadata
{
public:
QgsWcsProviderGuiMetadata();

QList<QgsSourceSelectProvider *> sourceSelectProviders() override;
QList<QgsDataItemGuiProvider *> dataItemGuiProviders() override;
};

0 comments on commit 2733b7e

Please sign in to comment.