Skip to content
Permalink
Browse files

* fix server plugin build on windows

* move src/mapserver to src/server (IMHO better name and in sync with
  python/server)
* rename cmake option WITH_MAPSERVER to WITH_SERVER
* rename define MAPSERVER_HAVE_PYTHON_PLUGINS to HAVE_SERVER_PYTHON_PLUGINS
  • Loading branch information
jef-n committed Nov 28, 2014
1 parent 0454c0d commit 6a1e1bb668171cdc314bff345ab14b75d3a7a804
@@ -13,6 +13,6 @@ before_install:
install:
- mkdir build
- cd build
- cmake -DWITH_MAPSERVER=ON -DWITH_STAGED_PLUGINS=OFF -DWITH_GRASS=OFF -DSUPPRESS_QT_WARNINGS=ON ..
- cmake -DWITH_SERVER=ON -DWITH_STAGED_PLUGINS=OFF -DWITH_GRASS=OFF -DSUPPRESS_QT_WARNINGS=ON ..

script: xvfb-run ctest -V -E 'PyQgsPalLabelingCanvas|PyQgsPalLabelingServer|qgis_wcsprovidertest' -S ../qgis-test-travis.ctest --output-on-failure
@@ -40,16 +40,16 @@ ENDIF (WITH_GRASS)

SET (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be built")

# mapserver by us disabled default because it needs FastCGI (which is optional dependency)
SET (WITH_MAPSERVER FALSE CACHE BOOL "Determines whether QGIS mapserver should be built")
IF(WITH_MAPSERVER)
SET (MAPSERVER_SKIP_ECW FALSE CACHE BOOL "Determines whether QGIS mapserver should disable ECW (ECW in server apps requires a special license)")
# server disabled default because it needs FastCGI (which is optional dependency)
SET (WITH_SERVER FALSE CACHE BOOL "Determines whether QGIS server should be built")
IF(WITH_SERVER)
SET (SERVER_SKIP_ECW FALSE CACHE BOOL "Determines whether QGIS server should disable ECW (ECW in server apps requires a special license)")

SET (WITH_SERVER_PLUGINS TRUE CACHE BOOL "Determines whether QGIS mapserver support for python plugins should be built")
SET (WITH_SERVER_PLUGINS TRUE CACHE BOOL "Determines whether QGIS server support for python plugins should be built")
IF(WITH_SERVER_PLUGINS)
SET(MAPSERVER_HAVE_PYTHON_PLUGINS TRUE)
SET(HAVE_SERVER_PYTHON_PLUGINS TRUE)
ENDIF(WITH_SERVER_PLUGINS)
ENDIF(WITH_MAPSERVER)
ENDIF(WITH_SERVER)

# Custom widgets
SET (WITH_CUSTOM_WIDGETS FALSE CACHE BOOL "Determines whether QGIS custom widgets for Qt Designer should be built")
@@ -540,6 +540,7 @@ ADD_DEFINITIONS("-DPYTHON_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DCUSTOMWIDGETS_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DSERVER_EXPORT=${DLLIMPORT}")

#############################################################
# user-changeable settings which can be used to customize
@@ -115,7 +115,7 @@ FUNCTION (UPDATEQGISPATHS LIBFROM LIBTO)
INSTALLNAMETOOL_CHANGE ("${LIBFROM}" "${LIB_CHG_TO}" "${QBINDIR}/${QA}.app/Contents/MacOS/${QA}")
ENDFOREACH (QA)
# qgis-mapserver
IF (${WITH_MAPSERVER})
IF (${WITH_SERVER})
IF (${OSX_HAVE_LOADERPATH})
SET (LIB_CHG_TO "${ATEXECUTABLE}/${QGIS_CGIBIN_SUBDIR_REV}/${LIBMID}/${LIBPOST}")
ENDIF ()
@@ -54,9 +54,9 @@

#cmakedefine HAVE_OSGEARTHQT

#cmakedefine MAPSERVER_SKIP_ECW
#cmakedefine SERVER_SKIP_ECW

#cmakedefine MAPSERVER_HAVE_PYTHON_PLUGINS
#cmakedefine HAVE_SERVER_PYTHON_PLUGINS

#endif

@@ -50,8 +50,8 @@ CMAKE_OPTS := \
-DBINDINGS_GLOBAL_INSTALL=TRUE \
-DPEDANTIC=TRUE \
-DWITH_QSPATIALITE=TRUE \
-DWITH_MAPSERVER=TRUE \
-DMAPSERVER_SKIP_ECW=TRUE \
-DWITH_SERVER=TRUE \
-DSERVER_SKIP_ECW=TRUE \
-DQGIS_CGIBIN_SUBDIR=/usr/lib/cgi-bin \
-DWITH_APIDOC=TRUE \
-DWITH_CUSTOM_WIDGETS=TRUE \
@@ -883,7 +883,7 @@ component on Leopard and Snow, add the following line before the last line in
the above configuration:

```
-D WITH_MAPSERVER=TRUE \
-D WITH_SERVER=TRUE \
```

On Lion you are on your own to figure out how to install libfcgi and add fcgi
@@ -38,7 +38,7 @@ SET (QGIS_DATA_SUBDIR_REV "@QGIS_DATA_SUBDIR_REV@")
# optional components
SET (WITH_GLOBE "@WITH_GLOBE@")
SET (WITH_GRASS "@WITH_GRASS@")
SET (WITH_MAPSERVER "@WITH_MAPSERVER@")
SET (WITH_SERVER "@WITH_SERVER@")
SET (WITH_POSTGRESQL "@WITH_POSTGRESQL@")
SET (WITH_QSPATIALITE "@WITH_QSPATIALITE@")

@@ -12,7 +12,7 @@ cmake -D BUILDNAME="cygwin" \
-D WITH_GRASS=FALSE \
-D WITH_SPATIALITE=TRUE \
-D WITH_QSPATIALITE=TRUE \
-D WITH_MAPSERVER=TRUE \
-D WITH_SERVER=TRUE \
-D WITH_ASTYLE=TRUE \
-D WITH_GLOBE=TRUE \
-D WITH_TOUCH=TRUE \
@@ -141,8 +141,8 @@ cmake %CMAKE_OPT% ^
-D SITE="qgis.org" ^
-D PEDANTIC=TRUE ^
-D WITH_QSPATIALITE=TRUE ^
-D WITH_MAPSERVER=TRUE ^
-D MAPSERVER_SKIP_ECW=TRUE ^
-D WITH_SERVER=TRUE ^
-D SERVER_SKIP_ECW=TRUE ^
-D WITH_ASTYLE=TRUE ^
-D WITH_GLOBE=TRUE ^
-D WITH_TOUCH=TRUE ^
@@ -134,8 +134,8 @@ set GRASS_PREFIX=%O4W_ROOT%/apps/grass/grass-%GRASS_VERSION%
cmake %CMAKE_OPT% ^
-D PEDANTIC=TRUE ^
-D WITH_QSPATIALITE=TRUE ^
-D WITH_MAPSERVER=TRUE ^
-D MAPSERVER_SKIP_ECW=TRUE ^
-D WITH_SERVER=TRUE ^
-D SERVER_SKIP_ECW=TRUE ^
-D WITH_GLOBE=TRUE ^
-D WITH_TOUCH=TRUE ^
-D WITH_ORACLE=TRUE ^
@@ -268,8 +268,11 @@ tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-server/%PACKAGENAME
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/bin/qgis_mapserv.fcgi.exe" ^
"apps/%PACKAGENAME%/bin/qgis_server.dll" ^
"apps/%PACKAGENAME%/bin/admin.sld" ^
"apps/%PACKAGENAME%/bin/wms_metadata.xml" ^
"apps/%PACKAGENAME%/python/_server.pyd" ^
"apps/%PACKAGENAME%/python/server" ^
"httpd.d/httpd_%PACKAGENAME%.conf.tmpl" ^
"etc/postinstall/%PACKAGENAME%-server.bat" ^
"etc/preremove/%PACKAGENAME%-server.bat"
@@ -298,6 +301,8 @@ if not exist %ARCH%\release\qgis\%PACKAGENAME% mkdir %ARCH%\release\qgis\%PACKAG
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%/%PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
--exclude "apps/%PACKAGENAME%/python/_server.pyd" ^
--exclude "apps/%PACKAGENAME%/python/server" ^
"bin/%PACKAGENAME%-browser-bin.exe" ^
"bin/%PACKAGENAME%-bin.exe" ^
"apps/%PACKAGENAME%/bin/qgis.reg.tmpl" ^
@@ -166,10 +166,10 @@ ADD_SIP_PYTHON_MODULE(qgis._gui gui/gui.sip qgis_core qgis_gui)
SET(PY_MODULES core gui analysis networkanalysis)

# server module
IF (WITH_MAPSERVER AND WITH_SERVER_PLUGINS)
IF (WITH_SERVER AND WITH_SERVER_PLUGINS)
INCLUDE_DIRECTORIES(
../src/mapserver
${CMAKE_BINARY_DIR}/src/mapserver
../src/server
${CMAKE_BINARY_DIR}/src/server
)

SET(PY_MODULES ${PY_MODULES} server)
@@ -180,7 +180,7 @@ IF (WITH_MAPSERVER AND WITH_SERVER_PLUGINS)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_server})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.server.api)
ADD_SIP_PYTHON_MODULE(qgis._server server/server.sip qgis_core qgis_server)
ENDIF (WITH_MAPSERVER AND WITH_SERVER_PLUGINS)
ENDIF (WITH_SERVER AND WITH_SERVER_PLUGINS)

# additional analysis includes
INCLUDE_DIRECTORIES(
@@ -21,7 +21,7 @@
* \class QgsCapabilitiesCache
* \brief A cache for capabilities xml documents (by configuration file path)
*/
class QgsCapabilitiesCache: public QObject
class QgsCapabilitiesCache: QObject
{
%TypeHeaderCode
#include "qgscapabilitiescache.h"
@@ -16,9 +16,9 @@ IF (WITH_BINDINGS)
ADD_SUBDIRECTORY(python)
ENDIF (WITH_BINDINGS)

IF (WITH_MAPSERVER)
ADD_SUBDIRECTORY(mapserver)
ENDIF (WITH_MAPSERVER)
IF (WITH_SERVER)
ADD_SUBDIRECTORY(server)
ENDIF (WITH_SERVER)

IF (WITH_CUSTOM_WIDGETS)
ADD_SUBDIRECTORY(customwidgets)
@@ -25,7 +25,7 @@


class QgisInterface;
#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
class QgsServerInterface;
#endif

@@ -52,7 +52,7 @@ class PYTHON_EXPORT QgsPythonUtils
//! initialize python and import bindings
virtual void initPython( QgisInterface* interface ) = 0;

#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
//! initialize python and import server bindings
virtual void initServerPython( QgsServerInterface* interface ) = 0;

@@ -181,8 +181,8 @@ void QgsPythonUtilsImpl::initPython( QgisInterface* interface )
}


#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
void QgsPythonUtilsImpl::initServerPython( QgsServerInterface* interface)
#ifdef HAVE_SERVER_PYTHON_PLUGINS
void QgsPythonUtilsImpl::initServerPython( QgsServerInterface* interface )
{
// initialize python
Py_Initialize();
@@ -330,7 +330,7 @@ bool QgsPythonUtilsImpl::startServerPlugin( QString packageName )
return ( output == "True" );
}

#endif // End MAPSERVER_HAVE_PYTHON_PLUGINS
#endif // End HAVE_SERVER_PYTHON_PLUGINS

void QgsPythonUtilsImpl::exitPython()
{
@@ -39,7 +39,7 @@ class QgsPythonUtilsImpl : public QgsPythonUtils
//! initialize python and import bindings
void initPython( QgisInterface* interface );

#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
//! initialize python for server and import bindings
void initServerPython( QgsServerInterface* interface );
bool startServerPlugin( QString packageName );
@@ -68,9 +68,7 @@ SET (qgis_mapserv_RCCS
# qgis_server library


SET(qgis_mapserv_MOC_HDRS ${qgis_mapserv_MOC_HDRS}

)
SET(qgis_mapserv_MOC_HDRS ${qgis_mapserv_MOC_HDRS})

SET(qgis_mapserv_SRCS ${qgis_mapserv_SRCS}
qgsserverplugins.cpp
@@ -79,6 +77,15 @@ SET(qgis_mapserv_SRCS ${qgis_mapserv_SRCS}
qgsserverinterfaceimpl.cpp
)

IF (WIN32)
IF (MSVC)
ADD_DEFINITIONS("-DSERVER_EXPORT=${DLLEXPORT}")
ELSE (MSVC)
ADD_DEFINITIONS("-USERVER_EXPORT \"-DSERVER_EXPORT=${DLLEXPORT}\"")
ENDIF (MSVC)
ENDIF (WIN32)


QT4_WRAP_CPP(qgis_mapserv_MOC_SRCS ${qgis_mapserv_MOC_HDRS})

ADD_LIBRARY(qgis_server SHARED ${qgis_mapserv_SRCS} ${qgis_mapserv_MOC_SRCS} ${qgis_mapserv_HDRS} ${qgis_mapserv_MOC_HDRS} )
@@ -169,7 +176,7 @@ TARGET_LINK_LIBRARIES(qgis_mapserv.fcgi
########################################################
# Install

INSTALL(CODE "MESSAGE(\"Installing mapserver...\")")
INSTALL(CODE "MESSAGE(\"Installing server...\")")
INSTALL(TARGETS
qgis_mapserv.fcgi
DESTINATION ${QGIS_CGIBIN_DIR}
@@ -38,7 +38,7 @@
#include "qgsmaplayerregistry.h"
#include "qgsserverlogger.h"

#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
#include "qgsserverplugins.h"
#include "qgsserverfilter.h"
#include "qgsserverinterfaceimpl.h"
@@ -270,7 +270,7 @@ int main( int argc, char * argv[] )
QgsApplication::setPrefixPath( CMAKE_INSTALL_PREFIX, TRUE );
#endif

#if defined(MAPSERVER_SKIP_ECW)
#if defined(SERVER_SKIP_ECW)
QgsDebugMsg( "Skipping GDAL ECW drivers in server." );
QgsApplication::skipGdalDriver( "ECW" );
QgsApplication::skipGdalDriver( "JP2ECW" );
@@ -321,7 +321,7 @@ int main( int argc, char * argv[] )
int logLevel = QgsServerLogger::instance()->logLevel();
QTime time; //used for measuring request time if loglevel < 1

#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
// Create the interface
QgsServerInterfaceImpl serverIface( &capabilitiesCache );
// Init plugins
@@ -362,7 +362,7 @@ int main( int argc, char * argv[] )
theRequestHandler->setServiceException( e );
}

#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
// Set the request handler into the interface for plugins to manipulate it
serverIface.setRequestHandler( theRequestHandler.data() );
// Iterate filters and call their requestReady() method
@@ -377,7 +377,7 @@ int main( int argc, char * argv[] )
// 2. allow requestHandler to call sendResponse plugin hook

//TODO: implement this in the requestHandler ctor (far easier if we will get rid of
// MAPSERVER_HAVE_PYTHON_PLUGINS
// HAVE_SERVER_PYTHON_PLUGINS
theRequestHandler->setPluginFilters( pluginFilters );
#endif

@@ -439,7 +439,7 @@ int main( int argc, char * argv[] )
} // end switch
} // end if not exception raised

#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
// Iterate filters and call their responseComplete() method
for ( filtersIterator = pluginFilters.constBegin(); filtersIterator != pluginFilters.constEnd(); ++filtersIterator )
{
@@ -24,7 +24,7 @@
#include <QObject>

/**A cache for capabilities xml documents (by configuration file path)*/
class QgsCapabilitiesCache: public QObject
class SERVER_EXPORT QgsCapabilitiesCache : public QObject
{
Q_OBJECT
public:
@@ -146,7 +146,7 @@ void QgsHttpRequestHandler::sendBody() const
#endif
}

#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
void QgsHttpRequestHandler::setPluginFilters( QgsServerFiltersMap pluginFilters )
{
mPluginFilters = pluginFilters;
@@ -161,7 +161,7 @@ void QgsHttpRequestHandler::sendResponse()
QgsDebugMsg( QString( "Trying to send out an invalid response" ) );
return;
}
#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
// Plugin hook
// Iterate filters and call their sendResponse() method
QgsServerFiltersMap::const_iterator filtersIterator;
@@ -58,7 +58,7 @@ class QgsHttpRequestHandler: public QgsRequestHandler
virtual void setParameter( const QString &key, const QString &value );
virtual QString parameter( const QString &key ) const;
virtual int removeParameter( const QString &key );
#ifdef MAPSERVER_HAVE_PYTHON_PLUGINS
#ifdef HAVE_SERVER_PYTHON_PLUGINS
virtual void setPluginFilters( QgsServerFiltersMap pluginFilters );
#endif
protected:
@@ -26,7 +26,7 @@
"LayerNotDefined" / "StyleNotDefined"
"OperationNotSupported"*/

class QgsMapServiceException
class SERVER_EXPORT QgsMapServiceException
{
public:
QgsMapServiceException( const QString& code, const QString& message );

0 comments on commit 6a1e1bb

Please sign in to comment.
You can’t perform that action at this time.