Skip to content
Permalink
Browse files

Move QGISDEBUG definition to header

Because having it as a compiler flag means that when compiling a dependant application we need to have extra knowledge of this setting at compile time of the dependant application.

If this is not guaranteed (and the dependant application is compiled without QGISDEBUG while libqgis_core.so is compiled with QGISDEBUG) will result in different class definitions being found in header and library. For example for the optional QgsCoordinateTransform::mHasContext member. This in turn leads to crashes with funky traces and no chance to find out what's going on.
  • Loading branch information
m-kuhn committed Jan 4, 2018
1 parent c8cb68a commit ab05bfb1bbebacdd85edd6bf73ad347455debd16
@@ -462,7 +462,9 @@ ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")

IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
MESSAGE (STATUS "Debug output enabled")
ADD_DEFINITIONS(-DQGISDEBUG=1)
SET(QGISDEBUG TRUE)
ELSE (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
SET(QGISDEBUG FALSE)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)

IF(MSVC)
@@ -62,5 +62,7 @@

#cmakedefine USE_THREAD_LOCAL

#cmakedefine QGISDEBUG

#endif

@@ -19,6 +19,7 @@

#include <QExplicitlySharedDataPointer>

#include "qgsconfig.h"
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgscoordinatereferencesystem.h"
@@ -27,6 +27,7 @@
#include "qgis.h"
#include "qgsdatasourceuri.h"
#include "qgswkbtypes.h"
#include "qgsconfig.h"

extern "C"
{
@@ -710,7 +710,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, in
int col0, col1, row0, row1;
tm->viewExtentIntersection( viewExtent, tml, col0, row0, col1, row1 );

#if QGISDEBUG
#ifdef QGISDEBUG
int n = ( col1 - col0 + 1 ) * ( row1 - row0 + 1 );
QgsDebugMsg( QString( "tile number: %1x%2 = %3" ).arg( col1 - col0 + 1 ).arg( row1 - row0 + 1 ).arg( n ) );
if ( n > 256 )

1 comment on commit ab05bfb

@3nids

This comment has been minimized.

Copy link
Member

@3nids 3nids commented on ab05bfb Jan 4, 2018

I'm getting some warning for unused variables

screen shot 2018-01-04 at 14 13 02

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