mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
fix grass tests on windows
This commit is contained in:
parent
92af85b7a2
commit
fa464111c8
@ -390,6 +390,7 @@ IF (PEDANTIC)
|
|||||||
# disable warnings
|
# disable warnings
|
||||||
SET(_warnings "${_warnings} /wd4100 ") # unused formal parameters
|
SET(_warnings "${_warnings} /wd4100 ") # unused formal parameters
|
||||||
SET(_warnings "${_warnings} /wd4127 ") # constant conditional expressions (used in Qt template classes)
|
SET(_warnings "${_warnings} /wd4127 ") # constant conditional expressions (used in Qt template classes)
|
||||||
|
SET(_warnings "${_warnings} /wd4190 ") # 'identifier' has C-linkage specified, but returns UDT 'identifier2' which is incompatible with C
|
||||||
SET(_warnings "${_warnings} /wd4231 ") # nonstandard extension used : 'identifier' before template explicit instantiation (used in Qt template classes)
|
SET(_warnings "${_warnings} /wd4231 ") # nonstandard extension used : 'identifier' before template explicit instantiation (used in Qt template classes)
|
||||||
SET(_warnings "${_warnings} /wd4244 ") # conversion from '...' to '...' possible loss of data
|
SET(_warnings "${_warnings} /wd4244 ") # conversion from '...' to '...' possible loss of data
|
||||||
SET(_warnings "${_warnings} /wd4251 ") # needs to have dll-interface to be used by clients of class (occurs in Qt template classes)
|
SET(_warnings "${_warnings} /wd4251 ") # needs to have dll-interface to be used by clients of class (occurs in Qt template classes)
|
||||||
|
@ -127,7 +127,7 @@ QString QgsOpenVectorLayerDialog::openDirectory()
|
|||||||
//process path if it is grass
|
//process path if it is grass
|
||||||
if ( cmbDirectoryTypes->currentText() == "Grass Vector" )
|
if ( cmbDirectoryTypes->currentText() == "Grass Vector" )
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
//replace backslashes with forward slashes
|
//replace backslashes with forward slashes
|
||||||
path.replace( "\\", "/" );
|
path.replace( "\\", "/" );
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,10 +47,10 @@
|
|||||||
// Do we need this?
|
// Do we need this?
|
||||||
// #define TESTLIB
|
// #define TESTLIB
|
||||||
#ifdef TESTLIB
|
#ifdef TESTLIB
|
||||||
// This doesn't work on WIN32 and causes problems with plugins
|
// This doesn't work on windows and causes problems with plugins
|
||||||
// on OS X (the code doesn't cause a problem but including dlfcn.h
|
// on OS X (the code doesn't cause a problem but including dlfcn.h
|
||||||
// renders plugins unloadable)
|
// renders plugins unloadable)
|
||||||
#if !defined(WIN32) && !defined(Q_OS_MACX)
|
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACX)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -291,7 +291,7 @@ void QgsPluginManager::savePluginState( QString id, bool state )
|
|||||||
void QgsPluginManager::getCppPluginsMetadata()
|
void QgsPluginManager::getCppPluginsMetadata()
|
||||||
{
|
{
|
||||||
QString sharedLibExtension;
|
QString sharedLibExtension;
|
||||||
#if defined(WIN32) || defined(__CYGWIN__)
|
#if defined(Q_OS_WIN) || defined(__CYGWIN__)
|
||||||
sharedLibExtension = "*.dll";
|
sharedLibExtension = "*.dll";
|
||||||
#else
|
#else
|
||||||
sharedLibExtension = "*.so*";
|
sharedLibExtension = "*.so*";
|
||||||
@ -325,12 +325,12 @@ void QgsPluginManager::getCppPluginsMetadata()
|
|||||||
QString lib = QString( "%1/%2" ).arg( myPluginDir ).arg( pluginDir[i] );
|
QString lib = QString( "%1/%2" ).arg( myPluginDir ).arg( pluginDir[i] );
|
||||||
|
|
||||||
#ifdef TESTLIB
|
#ifdef TESTLIB
|
||||||
// This doesn't work on WIN32 and causes problems with plugins
|
// This doesn't work on windows and causes problems with plugins
|
||||||
// on OS X (the code doesn't cause a problem but including dlfcn.h
|
// on OS X (the code doesn't cause a problem but including dlfcn.h
|
||||||
// renders plugins unloadable)
|
// renders plugins unloadable)
|
||||||
#if !defined(WIN32) && !defined(Q_OS_MACX)
|
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACX)
|
||||||
// test code to help debug loading problems
|
// test code to help debug loading problems
|
||||||
// This doesn't work on WIN32 and causes problems with plugins
|
// This doesn't work on windows and causes problems with plugins
|
||||||
// on OS X (the code doesn't cause a problem but including dlfcn.h
|
// on OS X (the code doesn't cause a problem but including dlfcn.h
|
||||||
// renders plugins unloadable)
|
// renders plugins unloadable)
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ void QgsPluginManager::getCppPluginsMetadata()
|
|||||||
QgsDebugMsg( "dlopen suceeded for " + lib );
|
QgsDebugMsg( "dlopen suceeded for " + lib );
|
||||||
dlclose( handle );
|
dlclose( handle );
|
||||||
}
|
}
|
||||||
#endif //#ifndef WIN32 && Q_OS_MACX
|
#endif //#ifndef Q_OS_WIN && Q_OS_MACX
|
||||||
#endif //#ifdef TESTLIB
|
#endif //#ifdef TESTLIB
|
||||||
|
|
||||||
QgsDebugMsg( "Examining: " + lib );
|
QgsDebugMsg( "Examining: " + lib );
|
||||||
|
@ -219,7 +219,7 @@ void QgisAppStyleSheet::setActiveValues()
|
|||||||
#else
|
#else
|
||||||
mLinuxOS = false;
|
mLinuxOS = false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN
|
||||||
mWinOS = true;
|
mWinOS = true;
|
||||||
#else
|
#else
|
||||||
mWinOS = false;
|
mWinOS = false;
|
||||||
|
@ -351,7 +351,7 @@ void QgsPluginRegistry::loadCppPlugin( QString theFullPathName )
|
|||||||
QgsDebugMsg( QString( "plugin object name: %1" ).arg( o->objectName() ) );
|
QgsDebugMsg( QString( "plugin object name: %1" ).arg( o->objectName() ) );
|
||||||
if ( o->objectName().isEmpty() )
|
if ( o->objectName().isEmpty() )
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef Q_OS_WIN
|
||||||
baseName = baseName.mid( 3 );
|
baseName = baseName.mid( 3 );
|
||||||
#endif
|
#endif
|
||||||
QgsDebugMsg( QString( "object name to %1" ).arg( baseName ) );
|
QgsDebugMsg( QString( "object name to %1" ).arg( baseName ) );
|
||||||
@ -449,7 +449,7 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
|
|||||||
{
|
{
|
||||||
QSettings mySettings;
|
QSettings mySettings;
|
||||||
|
|
||||||
#if defined(WIN32) || defined(__CYGWIN__)
|
#if defined(Q_OS_WIN) || defined(__CYGWIN__)
|
||||||
QString pluginExt = "*.dll";
|
QString pluginExt = "*.dll";
|
||||||
#elif ANDROID
|
#elif ANDROID
|
||||||
QString pluginExt = "*plugin.so";
|
QString pluginExt = "*plugin.so";
|
||||||
|
@ -76,7 +76,7 @@ void QgsTicksScaleBarStyle::draw( QPainter* p, double xOffset ) const
|
|||||||
if ( !segmentInfo.isEmpty() )
|
if ( !segmentInfo.isEmpty() )
|
||||||
{
|
{
|
||||||
double lastTickPositionX = segmentInfo.last().first + mScaleBar->segmentMillimeters() + xOffset;
|
double lastTickPositionX = segmentInfo.last().first + mScaleBar->segmentMillimeters() + xOffset;
|
||||||
double verticalPos;
|
double verticalPos = 0.0;
|
||||||
switch ( mTickPosition )
|
switch ( mTickPosition )
|
||||||
{
|
{
|
||||||
case TicksDown:
|
case TicksDown:
|
||||||
|
@ -203,21 +203,21 @@ class CORE_EXPORT QGis
|
|||||||
*/
|
*/
|
||||||
enum DataType
|
enum DataType
|
||||||
{
|
{
|
||||||
/*! Unknown or unspecified type */ UnknownDataType = 0,
|
/** Unknown or unspecified type */ UnknownDataType = 0,
|
||||||
/*! Eight bit unsigned integer (quint8) */ Byte = 1,
|
/** Eight bit unsigned integer (quint8) */ Byte = 1,
|
||||||
/*! Sixteen bit unsigned integer (quint16) */ UInt16 = 2,
|
/** Sixteen bit unsigned integer (quint16) */ UInt16 = 2,
|
||||||
/*! Sixteen bit signed integer (qint16) */ Int16 = 3,
|
/** Sixteen bit signed integer (qint16) */ Int16 = 3,
|
||||||
/*! Thirty two bit unsigned integer (quint32) */ UInt32 = 4,
|
/** Thirty two bit unsigned integer (quint32) */ UInt32 = 4,
|
||||||
/*! Thirty two bit signed integer (qint32) */ Int32 = 5,
|
/** Thirty two bit signed integer (qint32) */ Int32 = 5,
|
||||||
/*! Thirty two bit floating point (float) */ Float32 = 6,
|
/** Thirty two bit floating point (float) */ Float32 = 6,
|
||||||
/*! Sixty four bit floating point (double) */ Float64 = 7,
|
/** Sixty four bit floating point (double) */ Float64 = 7,
|
||||||
/*! Complex Int16 */ CInt16 = 8,
|
/** Complex Int16 */ CInt16 = 8,
|
||||||
/*! Complex Int32 */ CInt32 = 9,
|
/** Complex Int32 */ CInt32 = 9,
|
||||||
/*! Complex Float32 */ CFloat32 = 10,
|
/** Complex Float32 */ CFloat32 = 10,
|
||||||
/*! Complex Float64 */ CFloat64 = 11,
|
/** Complex Float64 */ CFloat64 = 11,
|
||||||
/*! Color, alpha, red, green, blue, 4 bytes the same as
|
/** Color, alpha, red, green, blue, 4 bytes the same as
|
||||||
QImage::Format_ARGB32 */ ARGB32 = 12,
|
QImage::Format_ARGB32 */ ARGB32 = 12,
|
||||||
/*! Color, alpha, red, green, blue, 4 bytes the same as
|
/** Color, alpha, red, green, blue, 4 bytes the same as
|
||||||
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied = 13
|
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied = 13
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -435,12 +435,12 @@ const double MINIMUM_POINT_SIZE = 0.1;
|
|||||||
const double DEFAULT_POINT_SIZE = 2.0;
|
const double DEFAULT_POINT_SIZE = 2.0;
|
||||||
const double DEFAULT_LINE_WIDTH = 0.26;
|
const double DEFAULT_LINE_WIDTH = 0.26;
|
||||||
|
|
||||||
/** default snapping tolerance for segments */
|
/** Default snapping tolerance for segments */
|
||||||
const double DEFAULT_SEGMENT_EPSILON = 1e-8;
|
const double DEFAULT_SEGMENT_EPSILON = 1e-8;
|
||||||
|
|
||||||
typedef QMap<QString, QString> QgsStringMap;
|
typedef QMap<QString, QString> QgsStringMap;
|
||||||
|
|
||||||
/** qgssize is used instead of size_t, because size_t is stdlib type, unknown
|
/** Qgssize is used instead of size_t, because size_t is stdlib type, unknown
|
||||||
* by SIP, and it would be hard to define size_t correctly in SIP.
|
* by SIP, and it would be hard to define size_t correctly in SIP.
|
||||||
* Currently used "unsigned long long" was introduced in C++11 (2011)
|
* Currently used "unsigned long long" was introduced in C++11 (2011)
|
||||||
* but it was supported already before C++11 on common platforms.
|
* but it was supported already before C++11 on common platforms.
|
||||||
@ -466,7 +466,7 @@ typedef unsigned long long qgssize;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef QGISEXTERN
|
#ifndef QGISEXTERN
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
# define QGISEXTERN extern "C" __declspec( dllexport )
|
# define QGISEXTERN extern "C" __declspec( dllexport )
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
// do not warn about C bindings returing QString
|
// do not warn about C bindings returing QString
|
||||||
|
@ -154,7 +154,7 @@ void QgsApplication::init( QString customConfigPath )
|
|||||||
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
|
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
|
||||||
if ( !prefixPath )
|
if ( !prefixPath )
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_MACX) || defined(Q_OS_WIN32) || defined(WIN32)
|
#if defined(Q_OS_MACX) || defined(Q_OS_WIN)
|
||||||
setPrefixPath( applicationDirPath(), true );
|
setPrefixPath( applicationDirPath(), true );
|
||||||
#elif defined(ANDROID)
|
#elif defined(ANDROID)
|
||||||
// this is "/data/data/org.qgis.qgis" in android
|
// this is "/data/data/org.qgis.qgis" in android
|
||||||
@ -924,7 +924,7 @@ bool QgsApplication::createDB( QString *errorMessage )
|
|||||||
myDir.mkpath( myPamPath ); //fail silently
|
myDir.mkpath( myPamPath ); //fail silently
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32) || defined(WIN32)
|
#if defined(Q_OS_WIN)
|
||||||
CPLSetConfigOption( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
|
CPLSetConfigOption( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
|
||||||
#else
|
#else
|
||||||
//under other OS's we use an environment var so the user can
|
//under other OS's we use an environment var so the user can
|
||||||
|
@ -783,7 +783,7 @@ bool QgsCoordinateTransform::writeXML( QDomNode & theNode, QDomDocument & theDoc
|
|||||||
const char *finder( const char *name )
|
const char *finder( const char *name )
|
||||||
{
|
{
|
||||||
QString proj;
|
QString proj;
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
proj = QApplication::applicationDirPath()
|
proj = QApplication::applicationDirPath()
|
||||||
+ "/share/proj/" + QString( name );
|
+ "/share/proj/" + QString( name );
|
||||||
#else
|
#else
|
||||||
|
@ -731,7 +731,9 @@ QgsDataCollectionItem::~QgsDataCollectionItem()
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// QVector<QgsDataProvider*> QgsDirectoryItem::mProviders = QVector<QgsDataProvider*>();
|
// QVector<QgsDataProvider*> QgsDirectoryItem::mProviders = QVector<QgsDataProvider*>();
|
||||||
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
QVector<QLibrary*> QgsDirectoryItem::mLibraries = QVector<QLibrary*>();
|
QVector<QLibrary*> QgsDirectoryItem::mLibraries = QVector<QLibrary*>();
|
||||||
|
Q_NOWARN_DEPRECATED_POP
|
||||||
|
|
||||||
QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, QString name, QString path )
|
QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, QString name, QString path )
|
||||||
: QgsDataCollectionItem( parent, name, path )
|
: QgsDataCollectionItem( parent, name, path )
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#include "qgslabel.h"
|
#include "qgslabel.h"
|
||||||
|
|
||||||
// use M_PI define PI 3.141592654
|
// use M_PI define PI 3.141592654
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
#undef M_PI
|
#undef M_PI
|
||||||
#define M_PI 4*atan(1.0)
|
#define M_PI 4*atan(1.0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -72,7 +72,7 @@ QgsProviderRegistry::QgsProviderRegistry( QString pluginPath )
|
|||||||
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
|
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
|
||||||
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
|
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
|
||||||
|
|
||||||
#if defined(WIN32) || defined(__CYGWIN__)
|
#if defined(Q_OS_WIN) || defined(__CYGWIN__)
|
||||||
mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
|
mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
|
||||||
#elif ANDROID
|
#elif ANDROID
|
||||||
mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );
|
mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );
|
||||||
@ -242,7 +242,7 @@ QgsProviderRegistry::~QgsProviderRegistry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** convenience function for finding any existing data providers that match "providerKey"
|
/** Convenience function for finding any existing data providers that match "providerKey"
|
||||||
|
|
||||||
Necessary because [] map operator will create a QgsProviderMetadata
|
Necessary because [] map operator will create a QgsProviderMetadata
|
||||||
instance. Also you cannot use the map [] operator in const members for that
|
instance. Also you cannot use the map [] operator in const members for that
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#include "qwt5_histogram_item.h"
|
#include "qwt5_histogram_item.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ void QgsHelpViewer::showHelp( QString help )
|
|||||||
webView->setHtml( helpContents );
|
webView->setHtml( helpContents );
|
||||||
setWindowTitle( tr( "QGIS Help" ) );
|
setWindowTitle( tr( "QGIS Help" ) );
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef Q_OS_WIN
|
||||||
setWindowState( windowState() & ~Qt::WindowMinimized );
|
setWindowState( windowState() & ~Qt::WindowMinimized );
|
||||||
#endif
|
#endif
|
||||||
raise();
|
raise();
|
||||||
|
@ -65,7 +65,7 @@ eVisDatabaseConnectionGui::eVisDatabaseConnectionGui( QList<QTemporaryFile*>* th
|
|||||||
connect( mDatabaseLayerFieldSelector, SIGNAL( eVisDatabaseLayerFieldsSelected( QString, QString, QString ) ), this, SLOT( drawNewVectorLayer( QString, QString, QString ) ) );
|
connect( mDatabaseLayerFieldSelector, SIGNAL( eVisDatabaseLayerFieldsSelected( QString, QString, QString ) ), this, SLOT( drawNewVectorLayer( QString, QString, QString ) ) );
|
||||||
|
|
||||||
//Populate gui components
|
//Populate gui components
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
cboxDatabaseType->insertItem( 0, "MSAccess" );
|
cboxDatabaseType->insertItem( 0, "MSAccess" );
|
||||||
#endif
|
#endif
|
||||||
cboxDatabaseType->insertItem( 0, "MYSQL" );
|
cboxDatabaseType->insertItem( 0, "MYSQL" );
|
||||||
|
@ -788,14 +788,14 @@ void GlobePlugin::setupProxy()
|
|||||||
if ( !settings.value( "/proxyUser" ).toString().isEmpty() )
|
if ( !settings.value( "/proxyUser" ).toString().isEmpty() )
|
||||||
{
|
{
|
||||||
QString auth = settings.value( "/proxyUser" ).toString() + ":" + settings.value( "/proxyPassword" ).toString();
|
QString auth = settings.value( "/proxyUser" ).toString() + ":" + settings.value( "/proxyPassword" ).toString();
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
putenv( QString( "OSGEARTH_CURL_PROXYAUTH=%1" ).arg( auth ).toAscii() );
|
putenv( QString( "OSGEARTH_CURL_PROXYAUTH=%1" ).arg( auth ).toAscii() );
|
||||||
#else
|
#else
|
||||||
setenv( "OSGEARTH_CURL_PROXYAUTH", auth.toStdString().c_str(), 0 );
|
setenv( "OSGEARTH_CURL_PROXYAUTH", auth.toStdString().c_str(), 0 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
//TODO: settings.value("/proxyType")
|
//TODO: settings.value("/proxyType")
|
||||||
//TODO: URL exlusions
|
//TODO: URL exclusions
|
||||||
HTTPClient::setProxySettings( proxySettings );
|
HTTPClient::setProxySettings( proxySettings );
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
@ -72,7 +72,7 @@ QString QgsGrassModule::findExec( QString file )
|
|||||||
QString path = getenv( "PATH" );
|
QString path = getenv( "PATH" );
|
||||||
QgsDebugMsg( "path = " + path );
|
QgsDebugMsg( "path = " + path );
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
mExecPath = path.split( ";" );
|
mExecPath = path.split( ";" );
|
||||||
mExecPath.prepend( QgsGrass::shortPath( QgsApplication::applicationDirPath() ) );
|
mExecPath.prepend( QgsGrass::shortPath( QgsApplication::applicationDirPath() ) );
|
||||||
#else
|
#else
|
||||||
@ -85,7 +85,7 @@ QString QgsGrassModule::findExec( QString file )
|
|||||||
if ( QFile::exists( file ) )
|
if ( QFile::exists( file ) )
|
||||||
return file; // full path
|
return file; // full path
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
// On windows try .bat first
|
// On windows try .bat first
|
||||||
for ( QStringList::iterator it = mExecPath.begin();
|
for ( QStringList::iterator it = mExecPath.begin();
|
||||||
it != mExecPath.end(); ++it )
|
it != mExecPath.end(); ++it )
|
||||||
@ -141,7 +141,7 @@ QStringList QgsGrassModule::execArguments( QString module )
|
|||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32)
|
#ifdef Q_OS_WIN
|
||||||
if ( exe.endsWith( ".py" ) )
|
if ( exe.endsWith( ".py" ) )
|
||||||
{
|
{
|
||||||
arguments.append( "python" );
|
arguments.append( "python" );
|
||||||
@ -213,7 +213,7 @@ QgsGrassModule::QgsGrassModule( QgsGrassTools *tools, QString moduleName, QgisIn
|
|||||||
// but not all modules have to be binary (can be scripts)
|
// but not all modules have to be binary (can be scripts)
|
||||||
// => test if the module is in path and if it is not
|
// => test if the module is in path and if it is not
|
||||||
// add .exe and test again
|
// add .exe and test again
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
if ( inExecPath( xName ) )
|
if ( inExecPath( xName ) )
|
||||||
{
|
{
|
||||||
mXName = xName;
|
mXName = xName;
|
||||||
@ -749,7 +749,7 @@ void QgsGrassModuleStandardOptions::freezeOutput()
|
|||||||
{
|
{
|
||||||
QgsDebugMsg( "called." );
|
QgsDebugMsg( "called." );
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
for ( unsigned int i = 0; i < mItems.size(); i++ )
|
for ( unsigned int i = 0; i < mItems.size(); i++ )
|
||||||
{
|
{
|
||||||
QgsGrassModuleOption *opt = dynamic_cast<QgsGrassModuleOption *>( mItems[i] );
|
QgsGrassModuleOption *opt = dynamic_cast<QgsGrassModuleOption *>( mItems[i] );
|
||||||
@ -824,7 +824,7 @@ void QgsGrassModuleStandardOptions::thawOutput()
|
|||||||
{
|
{
|
||||||
QgsDebugMsg( "called." );
|
QgsDebugMsg( "called." );
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
for ( unsigned int i = 0; i < mItems.size(); i++ )
|
for ( unsigned int i = 0; i < mItems.size(); i++ )
|
||||||
{
|
{
|
||||||
QgsGrassModuleOption *opt = dynamic_cast<QgsGrassModuleOption *>( mItems[i] );
|
QgsGrassModuleOption *opt = dynamic_cast<QgsGrassModuleOption *>( mItems[i] );
|
||||||
@ -1695,7 +1695,7 @@ void QgsGrassModule::run()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32)
|
#ifdef Q_OS_WIN
|
||||||
// we already know it exists from execArguments()
|
// we already know it exists from execArguments()
|
||||||
QString exe = QgsGrassModule::findExec( mXName );
|
QString exe = QgsGrassModule::findExec( mXName );
|
||||||
QFileInfo fi( exe );
|
QFileInfo fi( exe );
|
||||||
|
@ -1268,7 +1268,7 @@ void QgsGrassNewMapset::createMapset()
|
|||||||
// database path
|
// database path
|
||||||
( void )QgsGrass::activeMode(); // because it calls private QgsGrass::init()
|
( void )QgsGrass::activeMode(); // because it calls private QgsGrass::init()
|
||||||
|
|
||||||
#if defined(WIN32)
|
#ifdef Q_OS_WIN
|
||||||
G__setenv(( char * ) "GISDBASE", QgsGrass::shortPath( mDatabaseLineEdit->text() ).toUtf8().data() );
|
G__setenv(( char * ) "GISDBASE", QgsGrass::shortPath( mDatabaseLineEdit->text() ).toUtf8().data() );
|
||||||
#else
|
#else
|
||||||
G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toUtf8().data() );
|
G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toUtf8().data() );
|
||||||
|
@ -173,7 +173,7 @@ void QgsGrassElementDialog::textChanged()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
if ( !mSource.isNull() && text.toLower() == mSource.toLower() )
|
if ( !mSource.isNull() && text.toLower() == mSource.toLower() )
|
||||||
#else
|
#else
|
||||||
if ( !mSource.isNull() && text == mSource )
|
if ( !mSource.isNull() && text == mSource )
|
||||||
|
@ -201,7 +201,7 @@ static int cell_draw( char *name,
|
|||||||
set = G_malloc( ncols );
|
set = G_malloc( ncols );
|
||||||
|
|
||||||
/* some buggy C libraries require BOTH setmode() and fdopen(bin) */
|
/* some buggy C libraries require BOTH setmode() and fdopen(bin) */
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
if ( _setmode( _fileno( stdout ), _O_BINARY ) == -1 )
|
if ( _setmode( _fileno( stdout ), _O_BINARY ) == -1 )
|
||||||
G_fatal_error( "Cannot set stdout mode" );
|
G_fatal_error( "Cannot set stdout mode" );
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,6 @@ extern "C"
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
@ -93,7 +92,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
name = map->answer;
|
name = map->answer;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN
|
||||||
_setmode( _fileno( stdin ), _O_BINARY );
|
_setmode( _fileno( stdin ), _O_BINARY );
|
||||||
_setmode( _fileno( stdout ), _O_BINARY );
|
_setmode( _fileno( stdout ), _O_BINARY );
|
||||||
//setvbuf( stdin, NULL, _IONBF, BUFSIZ );
|
//setvbuf( stdin, NULL, _IONBF, BUFSIZ );
|
||||||
@ -176,9 +175,9 @@ int main( int argc, char **argv )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint32 *cell;
|
qint32 *cell = 0;
|
||||||
float *fcell;
|
float *fcell = 0;
|
||||||
double *dcell;
|
double *dcell = 0;
|
||||||
if ( grass_type == CELL_TYPE )
|
if ( grass_type == CELL_TYPE )
|
||||||
cell = ( qint32* ) byteArray.data();
|
cell = ( qint32* ) byteArray.data();
|
||||||
else if ( grass_type == FCELL_TYPE )
|
else if ( grass_type == FCELL_TYPE )
|
||||||
|
@ -134,7 +134,7 @@ int main( int argc, char **argv )
|
|||||||
if ( G_parser( argc, argv ) )
|
if ( G_parser( argc, argv ) )
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN
|
||||||
_setmode( _fileno( stdin ), _O_BINARY );
|
_setmode( _fileno( stdin ), _O_BINARY );
|
||||||
_setmode( _fileno( stdout ), _O_BINARY );
|
_setmode( _fileno( stdout ), _O_BINARY );
|
||||||
#endif
|
#endif
|
||||||
|
@ -333,7 +333,11 @@ void GRASS_LIB_EXPORT QgsGrass::init( void )
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// Use the applicationDirPath()/grass
|
// Use the applicationDirPath()/grass
|
||||||
gisBase = shortPath( QCoreApplication::applicationDirPath() + "/grass" );
|
#ifdef _MSC_VER
|
||||||
|
gisBase = shortPath( QCoreApplication::applicationDirPath() + ( QgsApplication::isRunningFromBuildDir() ? + "/../.." : "" ) + "/grass" );
|
||||||
|
#else
|
||||||
|
gisBase = shortPath( QCoreApplication::applicationDirPath() + ( QgsApplication::isRunningFromBuildDir() ? + "/.." : "" ) + "/grass" );
|
||||||
|
#endif
|
||||||
QgsDebugMsg( QString( "GRASS gisBase = %1" ).arg( gisBase ) );
|
QgsDebugMsg( QString( "GRASS gisBase = %1" ).arg( gisBase ) );
|
||||||
#elif defined(Q_OS_MACX)
|
#elif defined(Q_OS_MACX)
|
||||||
// check for bundled GRASS, fall back to configured path
|
// check for bundled GRASS, fall back to configured path
|
||||||
@ -380,7 +384,7 @@ void GRASS_LIB_EXPORT QgsGrass::init( void )
|
|||||||
userGisbase = false;
|
userGisbase = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN
|
||||||
gisBase = shortPath( gisBase );
|
gisBase = shortPath( gisBase );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1692,7 +1696,7 @@ QString GRASS_LIB_EXPORT QgsGrass::getInfo( const QString& info, const QString&
|
|||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
|
|
||||||
QString cmd = QgsApplication::libexecPath() + "grass/modules/qgis.g.info";
|
QString cmd = qgisGrassModulePath() + "/qgis.g.info";
|
||||||
|
|
||||||
arguments.append( "info=" + info );
|
arguments.append( "info=" + info );
|
||||||
if ( !map.isEmpty() )
|
if ( !map.isEmpty() )
|
||||||
@ -2200,7 +2204,7 @@ QString GRASS_LIB_EXPORT QgsGrass::versionString()
|
|||||||
|
|
||||||
Qt::CaseSensitivity GRASS_LIB_EXPORT QgsGrass::caseSensitivity()
|
Qt::CaseSensitivity GRASS_LIB_EXPORT QgsGrass::caseSensitivity()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
return Qt::CaseInsensitive;
|
return Qt::CaseInsensitive;
|
||||||
#else
|
#else
|
||||||
return Qt::CaseSensitive;
|
return Qt::CaseSensitive;
|
||||||
@ -2250,7 +2254,7 @@ struct Map_info GRASS_LIB_EXPORT *QgsGrass::vectNewMapStruct()
|
|||||||
// may have different sizes of types, see issue #13002. Because there is no Vect_new_map_struct (GRASS 7.0.0, July 2015)
|
// may have different sizes of types, see issue #13002. Because there is no Vect_new_map_struct (GRASS 7.0.0, July 2015)
|
||||||
// the structure is allocated here using doubled (should be enough) space.
|
// the structure is allocated here using doubled (should be enough) space.
|
||||||
// TODO: replace by Vect_new_map_struct once it appears in GRASS
|
// TODO: replace by Vect_new_map_struct once it appears in GRASS
|
||||||
#if defined(WIN32)
|
#ifdef Q_OS_WIN
|
||||||
return ( struct Map_info* ) qgsMalloc( 2*sizeof( struct Map_info ) );
|
return ( struct Map_info* ) qgsMalloc( 2*sizeof( struct Map_info ) );
|
||||||
#else
|
#else
|
||||||
return ( struct Map_info* ) qgsMalloc( sizeof( struct Map_info ) );
|
return ( struct Map_info* ) qgsMalloc( sizeof( struct Map_info ) );
|
||||||
|
@ -147,7 +147,7 @@ class QgsGrass
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Get info about the mode
|
//! Get info about the mode
|
||||||
/*! QgsGrass may be running in active or passive mode.
|
/** QgsGrass may be running in active or passive mode.
|
||||||
* Active mode means that GISRC is set up and GISRC file is available,
|
* Active mode means that GISRC is set up and GISRC file is available,
|
||||||
* in that case default GISDBASE, LOCATION and MAPSET may be read by GetDefaul*() functions.
|
* in that case default GISDBASE, LOCATION and MAPSET may be read by GetDefaul*() functions.
|
||||||
* Passive mode means, that GISRC is not available. */
|
* Passive mode means, that GISRC is not available. */
|
||||||
@ -409,12 +409,21 @@ class QgsGrass
|
|||||||
// set environment variable
|
// set environment variable
|
||||||
static GRASS_LIB_EXPORT void putEnv( QString name, QString value );
|
static GRASS_LIB_EXPORT void putEnv( QString name, QString value );
|
||||||
|
|
||||||
#if defined(WIN32)
|
#ifdef Q_OS_WIN
|
||||||
static GRASS_LIB_EXPORT QString shortPath( const QString &path );
|
static GRASS_LIB_EXPORT QString shortPath( const QString &path );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// path to QGIS GRASS modules like qgis.g.info etc.
|
// path to QGIS GRASS modules like qgis.g.info etc.
|
||||||
static GRASS_LIB_EXPORT QString qgisGrassModulePath() { return QgsApplication::libexecPath() + "grass/modules"; }
|
static GRASS_LIB_EXPORT QString qgisGrassModulePath()
|
||||||
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
if ( QgsApplication::isRunningFromBuildDir() )
|
||||||
|
{
|
||||||
|
return QCoreApplication::applicationDirPath() + "/../../grass/modules/" + QgsApplication::cfgIntDir();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return QgsApplication::libexecPath() + "grass/modules";
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate struct Map_info
|
// Allocate struct Map_info
|
||||||
static GRASS_LIB_EXPORT struct Map_info * vectNewMapStruct();
|
static GRASS_LIB_EXPORT struct Map_info * vectNewMapStruct();
|
||||||
|
@ -245,7 +245,7 @@ QSqlDatabase QgsMssqlProvider::GetDatabase( QString service, QString host, QStri
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
connectionString = "driver={SQL Server}";
|
connectionString = "driver={SQL Server}";
|
||||||
#else
|
#else
|
||||||
connectionString = "driver={FreeTDS};port=1433";
|
connectionString = "driver={FreeTDS};port=1433";
|
||||||
|
@ -1686,7 +1686,7 @@ QString createFilters( QString type )
|
|||||||
else if ( driverName.startsWith( "PGeo" ) )
|
else if ( driverName.startsWith( "PGeo" ) )
|
||||||
{
|
{
|
||||||
myDatabaseDrivers += QObject::tr( "ESRI Personal GeoDatabase" ) + ",PGeo;";
|
myDatabaseDrivers += QObject::tr( "ESRI Personal GeoDatabase" ) + ",PGeo;";
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
myFileFilters += createFileFilter_( QObject::tr( "ESRI Personal GeoDatabase" ), "*.mdb" );
|
myFileFilters += createFileFilter_( QObject::tr( "ESRI Personal GeoDatabase" ), "*.mdb" );
|
||||||
myExtensions << "mdb";
|
myExtensions << "mdb";
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,7 +38,7 @@ QString QgsMSUtils::createTempFilePath()
|
|||||||
QString tempFilePath;
|
QString tempFilePath;
|
||||||
//on windows, store the temporary file in current_path/tmp directory,
|
//on windows, store the temporary file in current_path/tmp directory,
|
||||||
//on unix, store it in /tmp/qgis_wms_serv
|
//on unix, store it in /tmp/qgis_wms_serv
|
||||||
#ifndef WIN32
|
#ifndef Q_OS_WIN
|
||||||
QDir tempFileDir( "/tmp/qgis_map_serv" );
|
QDir tempFileDir( "/tmp/qgis_map_serv" );
|
||||||
if ( !tempFileDir.exists() ) //make sure the directory exists
|
if ( !tempFileDir.exists() ) //make sure the directory exists
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ QString QgsMSUtils::createTempFilePath()
|
|||||||
currentDir.mkdir( "tmp" );
|
currentDir.mkdir( "tmp" );
|
||||||
}
|
}
|
||||||
tempFilePath = QDir::currentPath() + "/tmp" + "/" + tempFileName;
|
tempFilePath = QDir::currentPath() + "/tmp" + "/" + tempFileName;
|
||||||
#endif //WIN32
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
QFileInfo testFile( tempFilePath );
|
QFileInfo testFile( tempFilePath );
|
||||||
while ( testFile.exists() )
|
while ( testFile.exists() )
|
||||||
|
@ -724,13 +724,13 @@ int QgsSOAPRequestHandler::setUrlToFile( QImage* img )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
if ( !QFile::exists( QDir::currentPath() + "/tmp" ) )
|
if ( !QFile::exists( QDir::currentPath() + "/tmp" ) )
|
||||||
{
|
{
|
||||||
QDir::current().mkdir( "tmp" );
|
QDir::current().mkdir( "tmp" );
|
||||||
}
|
}
|
||||||
tmpDir = QDir( QDir::currentPath() + "/tmp" );
|
tmpDir = QDir( QDir::currentPath() + "/tmp" );
|
||||||
#else //WIN32
|
#else // Q_OS_WIN
|
||||||
tmpDir = QDir( "/tmp" );
|
tmpDir = QDir( "/tmp" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
// Open files in binary mode
|
// Open files in binary mode
|
||||||
#include <fcntl.h> /* _O_BINARY */
|
#include <fcntl.h> /* _O_BINARY */
|
||||||
#ifdef MSVC
|
#ifdef MSVC
|
||||||
@ -61,7 +61,7 @@ typedef SInt32 SRefCon;
|
|||||||
#include "qgslogger.h"
|
#include "qgslogger.h"
|
||||||
|
|
||||||
|
|
||||||
/** print usage text
|
/** Print usage text
|
||||||
*/
|
*/
|
||||||
void usage( std::string const & appName )
|
void usage( std::string const & appName )
|
||||||
{
|
{
|
||||||
@ -112,13 +112,13 @@ static QStringList myFileList;
|
|||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
#ifdef WIN32 // Windows
|
#ifdef Q_OS_WIN // Windows
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_set_fmode( _O_BINARY );
|
_set_fmode( _O_BINARY );
|
||||||
#else //MinGW
|
#else //MinGW
|
||||||
_fmode = _O_BINARY;
|
_fmode = _O_BINARY;
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
#endif // WIN32
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Command line options 'behaviour' flag setup
|
// Command line options 'behaviour' flag setup
|
||||||
@ -152,7 +152,7 @@ int main( int argc, char *argv[] )
|
|||||||
// user settings (~/.qgis) and it will be used for QSettings INI file
|
// user settings (~/.qgis) and it will be used for QSettings INI file
|
||||||
QString configpath;
|
QString configpath;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef Q_OS_WIN
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// USe the GNU Getopts utility to parse cli arguments
|
// USe the GNU Getopts utility to parse cli arguments
|
||||||
// Invokes ctor `GetOpt (int argc, char **argv, char *optstring);'
|
// Invokes ctor `GetOpt (int argc, char **argv, char *optstring);'
|
||||||
@ -349,7 +349,7 @@ int main( int argc, char *argv[] )
|
|||||||
myFileList.append( QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
|
myFileList.append( QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //WIN32
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// Now we have the handlers for the different behaviours...
|
// Now we have the handlers for the different behaviours...
|
||||||
@ -416,7 +416,7 @@ int main( int argc, char *argv[] )
|
|||||||
gdalShares << QCoreApplication::applicationDirPath().append( "/share/gdal" )
|
gdalShares << QCoreApplication::applicationDirPath().append( "/share/gdal" )
|
||||||
<< appResources.append( "/share/gdal" )
|
<< appResources.append( "/share/gdal" )
|
||||||
<< appResources.append( "/gdal" );
|
<< appResources.append( "/gdal" );
|
||||||
Q_FOREACH ( const QString& gdalShare, gdalShares )
|
Q_FOREACH( const QString& gdalShare, gdalShares )
|
||||||
{
|
{
|
||||||
if ( QFile::exists( gdalShare ) )
|
if ( QFile::exists( gdalShare ) )
|
||||||
{
|
{
|
||||||
|
@ -23,24 +23,50 @@ MACRO (ADD_QGIS_GRASS_TEST grass_build_version testname testsrc)
|
|||||||
qgis_core
|
qgis_core
|
||||||
qgisgrass${grass_build_version}
|
qgisgrass${grass_build_version}
|
||||||
)
|
)
|
||||||
ADD_TEST(qgis_${testname}${grass_build_version} ${CMAKE_BINARY_DIR}/output/bin/qgis_${testname}${grass_build_version} -maxwarnings 10000)
|
IF(WIN32 AND NOT USING_NMAKE)
|
||||||
IF (WIN32)
|
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${testname}.cmake
|
||||||
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY
|
"
|
||||||
ENVIRONMENT "PATH=${GRASS_PREFIX${grass_build_version}}/lib;$ENV{PATH}"
|
SET(ENV{PATH} \"${GRASS_PREFIX${grass_build_version}}/lib;${CMAKE_BINARY_DIR}/output/bin/\${CMAKE_BUILD_TYPE};${CMAKE_BINARY_DIR}/output/plugins/\${CMAKE_BUILD_TYPE};\$ENV{PATH}\")
|
||||||
)
|
MESSAGE(STATUS \"Running ${CMAKE_BINARY_DIR}/output/bin/\${CMAKE_BUILD_TYPE}/qgis_${testname}${grass_build_version}\")
|
||||||
ELSE (WIN32)
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND ${CMAKE_BINARY_DIR}/output/bin/\${CMAKE_BUILD_TYPE}/qgis_${testname}${grass_build_version}
|
||||||
|
RESULT_VARIABLE import_res
|
||||||
|
OUTPUT_VARIABLE import_output
|
||||||
|
ERROR_VARIABLE import_output
|
||||||
|
)
|
||||||
|
# Pass the output back to ctest
|
||||||
|
IF(import_output)
|
||||||
|
MESSAGE(" \${import_output} ")
|
||||||
|
ENDIF(import_output)
|
||||||
|
IF(import_res)
|
||||||
|
MESSAGE(SEND_ERROR " \${import_res} ")
|
||||||
|
ENDIF(import_res)
|
||||||
|
"
|
||||||
|
)
|
||||||
|
ADD_TEST(NAME qgis_${testname}${grass_build_version} COMMAND ${CMAKE_COMMAND} -D CMAKE_BUILD_TYPE=$<CONFIGURATION> -P ${CMAKE_CURRENT_BINARY_DIR}/${testname}.cmake)
|
||||||
|
ELSE (WIN32 AND NOT USING_NMAKE)
|
||||||
|
ADD_TEST(qgis_${testname}${grass_build_version} ${CMAKE_BINARY_DIR}/output/bin/qgis_${testname}${grass_build_version} -maxwarnings 10000)
|
||||||
|
ENDIF (WIN32 AND NOT USING_NMAKE)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY ENVIRONMENT "GISBASE=${GRASS_PREFIX${grass_build_version}}")
|
||||||
|
IF (USING_NMAKE)
|
||||||
|
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY
|
||||||
|
ENVIRONMENT "PATH=${GRASS_PREFIX${grass_build_version}}/lib;${CMAKE_BINARY_DIR}/output/bin;${CMAKE_BINARY_DIR}/output/plugins;$ENV{PATH}"
|
||||||
|
)
|
||||||
|
ENDIF (USING_NMAKE)
|
||||||
|
ELSE(WIN32)
|
||||||
IF (APPLE)
|
IF (APPLE)
|
||||||
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY
|
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY
|
||||||
ENVIRONMENT "DYLD_LIBRARY_PATH=${GRASS_PREFIX${grass_build_version}}/lib:$ENV{DYLD_LIBRARY_PATH}"
|
ENVIRONMENT "DYLD_LIBRARY_PATH=${GRASS_PREFIX${grass_build_version}}/lib:$ENV{DYLD_LIBRARY_PATH}"
|
||||||
)
|
)
|
||||||
ELSE (APPLE)
|
ELSE (APPLE)
|
||||||
# UNIX
|
# UNIX
|
||||||
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY
|
SET_PROPERTY(TEST qgis_${testname}${grass_build_version} PROPERTY
|
||||||
ENVIRONMENT "LD_LIBRARY_PATH=${GRASS_PREFIX${grass_build_version}}/lib:$ENV{LD_LIBRARY_PATH}"
|
ENVIRONMENT "LD_LIBRARY_PATH=${GRASS_PREFIX${grass_build_version}}/lib:$ENV{LD_LIBRARY_PATH}"
|
||||||
)
|
)
|
||||||
ENDIF (APPLE)
|
ENDIF (APPLE)
|
||||||
ENDIF (WIN32)
|
ENDIF (WIN32)
|
||||||
|
|
||||||
ENDMACRO (ADD_QGIS_GRASS_TEST)
|
ENDMACRO (ADD_QGIS_GRASS_TEST)
|
||||||
|
|
||||||
MACRO (ADD_QGIS_GRASS_TESTS version)
|
MACRO (ADD_QGIS_GRASS_TESTS version)
|
||||||
|
@ -66,7 +66,7 @@ class TestQgsGrassProvider: public QObject
|
|||||||
void reportRow( QString message );
|
void reportRow( QString message );
|
||||||
void reportHeader( QString message );
|
void reportHeader( QString message );
|
||||||
// verify result and report result
|
// verify result and report result
|
||||||
void verify( bool ok );
|
bool verify( bool ok );
|
||||||
// compare expected and got string and set ok to false if not equal
|
// compare expected and got string and set ok to false if not equal
|
||||||
bool compare( QString expected, QString got, bool& ok );
|
bool compare( QString expected, QString got, bool& ok );
|
||||||
// lists are considered equal if contains the same values regardless order
|
// lists are considered equal if contains the same values regardless order
|
||||||
@ -81,6 +81,7 @@ class TestQgsGrassProvider: public QObject
|
|||||||
QString mBuildMapset;
|
QString mBuildMapset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GVERIFY(x) QVERIFY( verify(x) )
|
||||||
|
|
||||||
void TestQgsGrassProvider::reportRow( QString message )
|
void TestQgsGrassProvider::reportRow( QString message )
|
||||||
{
|
{
|
||||||
@ -108,7 +109,11 @@ void TestQgsGrassProvider::initTestCase()
|
|||||||
mReport += QString( "<h1>GRASS %1 provider tests</h1>\n" ).arg( GRASS_BUILD_VERSION );
|
mReport += QString( "<h1>GRASS %1 provider tests</h1>\n" ).arg( GRASS_BUILD_VERSION );
|
||||||
mReport += "<p>" + mySettings + "</p>\n";
|
mReport += "<p>" + mySettings + "</p>\n";
|
||||||
|
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
reportRow( "LD_LIBRARY_PATH: " + QString( getenv( "LD_LIBRARY_PATH" ) ) );
|
reportRow( "LD_LIBRARY_PATH: " + QString( getenv( "LD_LIBRARY_PATH" ) ) );
|
||||||
|
#else
|
||||||
|
reportRow( "PATH: " + QString( getenv( "PATH" ) ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
QgsGrass::init();
|
QgsGrass::init();
|
||||||
|
|
||||||
@ -138,11 +143,11 @@ void TestQgsGrassProvider::cleanupTestCase()
|
|||||||
//QgsApplication::exitQgis();
|
//QgsApplication::exitQgis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::verify( bool ok )
|
bool TestQgsGrassProvider::verify( bool ok )
|
||||||
{
|
{
|
||||||
reportRow( "" );
|
reportRow( "" );
|
||||||
reportRow( QString( "Test result: " ) + ( ok ? "ok" : "error" ) );
|
reportRow( QString( "Test result: " ) + ( ok ? "ok" : "error" ) );
|
||||||
QVERIFY( ok );
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestQgsGrassProvider::compare( QString expected, QString got, bool &ok )
|
bool TestQgsGrassProvider::compare( QString expected, QString got, bool &ok )
|
||||||
@ -199,7 +204,7 @@ void TestQgsGrassProvider::fatalError()
|
|||||||
compare( errorMessage, e.what(), ok );
|
compare( errorMessage, e.what(), ok );
|
||||||
}
|
}
|
||||||
compare( errorMessage, QgsGrass::errorMessage(), ok );
|
compare( errorMessage, QgsGrass::errorMessage(), ok );
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::locations()
|
void TestQgsGrassProvider::locations()
|
||||||
@ -212,7 +217,7 @@ void TestQgsGrassProvider::locations()
|
|||||||
reportRow( "expectedLocations: " + expectedLocations.join( ", " ) );
|
reportRow( "expectedLocations: " + expectedLocations.join( ", " ) );
|
||||||
reportRow( "locations: " + locations.join( ", " ) );
|
reportRow( "locations: " + locations.join( ", " ) );
|
||||||
compare( expectedLocations, locations, ok );
|
compare( expectedLocations, locations, ok );
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::mapsets()
|
void TestQgsGrassProvider::mapsets()
|
||||||
@ -274,7 +279,7 @@ void TestQgsGrassProvider::mapsets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::maps()
|
void TestQgsGrassProvider::maps()
|
||||||
@ -295,7 +300,7 @@ void TestQgsGrassProvider::maps()
|
|||||||
reportRow( "expectedRasters: " + expectedRasters.join( ", " ) );
|
reportRow( "expectedRasters: " + expectedRasters.join( ", " ) );
|
||||||
reportRow( "rasters: " + rasters.join( ", " ) );
|
reportRow( "rasters: " + rasters.join( ", " ) );
|
||||||
compare( expectedRasters, rasters, ok );
|
compare( expectedRasters, rasters, ok );
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::vectorLayers()
|
void TestQgsGrassProvider::vectorLayers()
|
||||||
@ -322,7 +327,7 @@ void TestQgsGrassProvider::vectorLayers()
|
|||||||
ok = false;
|
ok = false;
|
||||||
reportRow( QString( "ERROR: %1" ).arg( e.what() ) );
|
reportRow( QString( "ERROR: %1" ).arg( e.what() ) );
|
||||||
}
|
}
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::region()
|
void TestQgsGrassProvider::region()
|
||||||
@ -352,7 +357,7 @@ void TestQgsGrassProvider::region()
|
|||||||
reportRow( "regionCopy: " + regionCopy );
|
reportRow( "regionCopy: " + regionCopy );
|
||||||
compare( expectedRegion, regionCopy, ok );
|
compare( expectedRegion, regionCopy, ok );
|
||||||
}
|
}
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::info()
|
void TestQgsGrassProvider::info()
|
||||||
@ -408,7 +413,7 @@ void TestQgsGrassProvider::info()
|
|||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
// create temporary output location
|
// create temporary output location
|
||||||
@ -458,7 +463,7 @@ void TestQgsGrassProvider::rasterImport()
|
|||||||
if ( !createTmpLocation( tmpGisdbase, tmpLocation, tmpMapset ) )
|
if ( !createTmpLocation( tmpGisdbase, tmpLocation, tmpMapset ) )
|
||||||
{
|
{
|
||||||
reportRow( "cannot create temporary location" );
|
reportRow( "cannot create temporary location" );
|
||||||
verify( false );
|
GVERIFY( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +520,7 @@ void TestQgsGrassProvider::rasterImport()
|
|||||||
delete import;
|
delete import;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsGrassProvider::vectorImport()
|
void TestQgsGrassProvider::vectorImport()
|
||||||
@ -530,7 +535,7 @@ void TestQgsGrassProvider::vectorImport()
|
|||||||
if ( !createTmpLocation( tmpGisdbase, tmpLocation, tmpMapset ) )
|
if ( !createTmpLocation( tmpGisdbase, tmpLocation, tmpMapset ) )
|
||||||
{
|
{
|
||||||
reportRow( "cannot create temporary location" );
|
reportRow( "cannot create temporary location" );
|
||||||
verify( false );
|
GVERIFY( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,7 +575,7 @@ void TestQgsGrassProvider::vectorImport()
|
|||||||
QStringList layers = QgsGrass::vectorLayers( tmpGisdbase, tmpLocation, tmpMapset, name );
|
QStringList layers = QgsGrass::vectorLayers( tmpGisdbase, tmpLocation, tmpMapset, name );
|
||||||
reportRow( "created layers: " + layers.join( "," ) );
|
reportRow( "created layers: " + layers.join( "," ) );
|
||||||
}
|
}
|
||||||
verify( ok );
|
GVERIFY( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN( TestQgsGrassProvider )
|
QTEST_MAIN( TestQgsGrassProvider )
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <qgswcscapabilities.h>
|
#include <qgswcscapabilities.h>
|
||||||
#include <testqgswcspublicservers.h>
|
#include <testqgswcspublicservers.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef Q_OS_WIN
|
||||||
// Open files in binary mode
|
// Open files in binary mode
|
||||||
#include <fcntl.h> /* _O_BINARY */
|
#include <fcntl.h> /* _O_BINARY */
|
||||||
#ifdef MSVC
|
#ifdef MSVC
|
||||||
@ -875,13 +875,13 @@ void usage( std::string const & appName )
|
|||||||
|
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
#ifdef WIN32 // Windows
|
#ifdef Q_OS_WIN // Windows
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
_set_fmode( _O_BINARY );
|
_set_fmode( _O_BINARY );
|
||||||
#else //MinGW
|
#else //MinGW
|
||||||
_fmode = _O_BINARY;
|
_fmode = _O_BINARY;
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
#endif // WIN32
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
QString myServer;
|
QString myServer;
|
||||||
QString myCoverage;
|
QString myCoverage;
|
||||||
@ -889,7 +889,7 @@ int main( int argc, char *argv[] )
|
|||||||
int myMaxCoverages = 2;
|
int myMaxCoverages = 2;
|
||||||
bool myForce = false;
|
bool myForce = false;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef Q_OS_WIN
|
||||||
int optionChar;
|
int optionChar;
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user