Skip to content

Commit

Permalink
Fix build using mingw
Browse files Browse the repository at this point in the history
Changes many  #if defined (Q_OS_WIN) to #ifdef _MSC_VER, where
they relate specifically to msvc compiler
  • Loading branch information
Theuns authored and nyalldawson committed Nov 5, 2017
1 parent 394c531 commit d269f34
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/app/mainwin.cpp
Expand Up @@ -105,7 +105,13 @@ int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
}
}

#ifdef _MSC_VER
HINSTANCE hGetProcIDDLL = LoadLibrary( "qgis_app.dll" );
#else
// MinGW
HINSTANCE hGetProcIDDLL = LoadLibrary( "libqgis_app.dll" );
#endif

if ( !hGetProcIDDLL )
{
std::cerr << "Could not load the qgis_app.dll" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -12090,7 +12090,7 @@ void QgisApp::keyPressEvent( QKeyEvent *e )
{
stopRendering();
}
#if defined(Q_OS_WIN) && defined(QGISDEBUG)
#if defined(_MSC_VER) && defined(QGISDEBUG)
else if ( e->key() == Qt::Key_Backslash && e->modifiers() & Qt::ControlModifier )
{
QgsCrashHandler::handle( 0 );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgscrashhandler.cpp
Expand Up @@ -23,7 +23,7 @@
#include "qgscrashreport.h"
#include "qgsstacktrace.h"

#ifdef Q_OS_WIN
#ifdef _MSC_VER
LONG WINAPI QgsCrashHandler::handle( struct _EXCEPTION_POINTERS *ExceptionInfo )
{
QgsStackLines stack = QgsStackTrace::trace( ExceptionInfo );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgscrashhandler.h
Expand Up @@ -32,7 +32,7 @@ class APP_EXPORT QgsCrashHandler
{

public:
#ifdef Q_OS_WIN
#ifdef _MSC_VER
static LONG WINAPI handle( struct _EXCEPTION_POINTERS *ExceptionInfo );
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsapplication.cpp
Expand Up @@ -732,7 +732,7 @@ QString QgsApplication::userLoginName()
if ( !sUserName.isEmpty() )
return sUserName;

#ifdef Q_OS_WIN
#ifdef _MSC_VER
TCHAR name [ UNLEN + 1 ];
DWORD size = UNLEN + 1;

Expand Down Expand Up @@ -767,7 +767,7 @@ QString QgsApplication::userFullName()
if ( !sUserFullName.isEmpty() )
return sUserFullName;

#ifdef Q_OS_WIN
#ifdef _MSC_VER
TCHAR name [ UNLEN + 1 ];
DWORD size = UNLEN + 1;

Expand Down
4 changes: 3 additions & 1 deletion src/core/qgsoptionalexpression.h
Expand Up @@ -77,9 +77,11 @@ class CORE_EXPORT QgsOptionalExpression : public QgsOptional<QgsExpression>
};


#if defined(Q_OS_WIN)
#if defined(_MSC_VER)
#ifndef SIP_RUN
template CORE_EXPORT QgsOptional<QgsExpression>;
#endif
#endif


#endif // QGSOPTIONALEXPRESSION_H
6 changes: 3 additions & 3 deletions src/core/qgsproject.cpp
Expand Up @@ -60,10 +60,10 @@
#include <QDir>
#include <QUrl>

#ifdef Q_OS_UNIX
#include <utime.h>
#elif _MSC_VER
#ifdef _MSC_VER
#include <sys/utime.h>
#else
#include <utime.h>
#endif

// canonical project instance
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsstacktrace.cpp
Expand Up @@ -28,7 +28,7 @@

///@cond PRIVATE

#ifdef Q_OS_WIN
#ifdef _MSC_VER
QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( _EXCEPTION_POINTERS *ExceptionInfo )
{
QgsStackLines stack;
Expand Down Expand Up @@ -145,7 +145,7 @@ void QgsStackTrace::setSymbolPath( QString symbolPaths )
mSymbolPaths = symbolPaths;
}

#endif // Q_OS_WIN
#endif // _MSC_VER

#ifdef Q_OS_LINUX
QVector<QgsStackTrace::StackLine> QgsStackTrace::trace( unsigned int maxFrames )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsstacktrace.h
Expand Up @@ -62,7 +62,7 @@ class CORE_EXPORT QgsStackTrace
bool isValid() const;
};

#ifdef Q_OS_WIN
#ifdef _MSC_VER

/**
* Return a demangled stack backtrace of the caller function.
Expand Down

0 comments on commit d269f34

Please sign in to comment.