381 changes: 195 additions & 186 deletions src/app/main.cpp

Large diffs are not rendered by default.

54 changes: 34 additions & 20 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6368,26 +6368,40 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion )
if ( settings.value( "/qgis/warnOldProjectVersion", QVariant( true ) ).toBool() )
{
QApplication::setOverrideCursor( Qt::ArrowCursor );
QMessageBox::warning( NULL, tr( "Project file is older" ),
tr( "<p>This project file was saved by an older version of QGIS."
" When saving this project file, QGIS will update it to the latest version, "
"possibly rendering it useless for older versions of QGIS."
"<p>Even though QGIS developers try to maintain backwards "
"compatibility, some of the information from the old project "
"file might be lost."
" To improve the quality of QGIS, we appreciate "
"if you file a bug report at %3."
" Be sure to include the old project file, and state the version of "
"QGIS you used to discover the error."
"<p>To remove this warning when opening an older project file, "
"uncheck the box '%5' in the %4 menu."
"<p>Version of the project file: %1<br>Current version of QGIS: %2" )
.arg( oldVersion )
.arg( QGis::QGIS_VERSION )
.arg( "<a href=\"http://hub.qgis.org/projects/quantum-gis\">http://hub.qgis.org/projects/quantum-gis</a> " )
.arg( tr( "<tt>Settings:Options:General</tt>", "Menu path to setting options" ) )
.arg( tr( "Warn me when opening a project file saved with an older version of QGIS" ) )
);
QString text = tr( "<p>This project file was saved by an older version of QGIS."
" When saving this project file, QGIS will update it to the latest version, "
"possibly rendering it useless for older versions of QGIS."
"<p>Even though QGIS developers try to maintain backwards "
"compatibility, some of the information from the old project "
"file might be lost."
" To improve the quality of QGIS, we appreciate "
"if you file a bug report at %3."
" Be sure to include the old project file, and state the version of "
"QGIS you used to discover the error."
"<p>To remove this warning when opening an older project file, "
"uncheck the box '%5' in the %4 menu."
"<p>Version of the project file: %1<br>Current version of QGIS: %2" )
.arg( oldVersion )
.arg( QGis::QGIS_VERSION )
.arg( "<a href=\"http://hub.qgis.org/projects/quantum-gis\">http://hub.qgis.org/projects/quantum-gis</a> " )
.arg( tr( "<tt>Settings:Options:General</tt>", "Menu path to setting options" ) )
.arg( tr( "Warn me when opening a project file saved with an older version of QGIS" ) );
QString title = tr( "Project file is older" );

#ifdef ANDROID
//this is needed to deal with http://hub.qgis.org/issues/4573
QMessageBox box(QMessageBox::Warning,title, tr("This project file was saved by an older version of QGIS"), QMessageBox::Ok, NULL);
box.setDetailedText(
text.remove(0, 3)
.replace(QString("<p>"),QString("\n\n"))
.replace(QString("<br>"),QString("\n"))
.replace(QString("<a href=\"http://hub.qgis.org/projects/quantum-gis\">http://hub.qgis.org/projects/quantum-gis</a> "),QString("\nhttp://hub.qgis.org/projects/quantum-gis"))
.replace(QRegExp("</?tt>"),QString(""))
);
box.exec();
#else
QMessageBox::warning( NULL, title, text );
#endif
QApplication::restoreOverrideCursor();
}
return;
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgspluginregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )

#ifdef WIN32
QString pluginExt = "*.dll";
#elif ANDROID
QString pluginExt = "*plugin.so";
#else
QString pluginExt = "*.so*";
#endif
Expand Down
170 changes: 170 additions & 0 deletions src/app/qtmain_android.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
/*
Copyright (c) 2009-2011, BogDan Vatra <bog_dan_ro@yahoo.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the BogDan Vatra <bog_dan_ro@yahoo.com> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY BogDan Vatra <bog_dan_ro@yahoo.com> ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL BogDan Vatra <bog_dan_ro@yahoo.com> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <android/log.h>
#include <pthread.h>
#include <QSemaphore>
#include <QDir>
#include <QDebug>
#include <qglobal.h>

#include <stdlib.h>

#include <jni.h>

static JavaVM *m_javaVM = NULL;
static JNIEnv *m_env = NULL;
static jobject objptr;
static QSemaphore m_quitAppSemaphore;
static QList<QByteArray> m_applicationParams;
static const char * const QtNativeClassPathName = "org/kde/necessitas/industrius/QtNative";

extern "C" int main(int, char **); //use the standard main method to start the application
static void * startMainMethod(void * /*data*/)
{

char ** params;
params=(char**)malloc(sizeof(char*)*m_applicationParams.length());
for (int i=0;i<m_applicationParams.size();i++)
params[i]= (char*)m_applicationParams[i].constData();

int ret = main(m_applicationParams.length(), params);

qDebug()<<"MainMethod finished, it's time to cleanup";
free(params);
Q_UNUSED(ret);

JNIEnv* env;
if (m_javaVM->AttachCurrentThread(&env, NULL)<0)
{
qCritical()<<"AttachCurrentThread failed";
return false;
}
jclass applicationClass = env->GetObjectClass(objptr);
if (applicationClass){
jmethodID quitApp = env->GetStaticMethodID(applicationClass, "quitApp", "()V");
env->CallStaticVoidMethod(applicationClass, quitApp);
}
m_javaVM->DetachCurrentThread();
return NULL;
}

static jboolean startQtApp(JNIEnv* env, jobject /*object*/, jstring paramsString, jstring environmentString)
{
qDebug()<<"startQtApp";
const char * nativeString = env->GetStringUTFChars(environmentString, 0);
QByteArray string=nativeString;
env->ReleaseStringUTFChars(environmentString, nativeString);
m_applicationParams=string.split('\t');
qDebug()<<"environmentString"<<string<<m_applicationParams;
foreach (string, m_applicationParams)
if (putenv(string.constData()))
qWarning()<<"Can't set environment"<<string;

nativeString = env->GetStringUTFChars(paramsString, 0);
string=nativeString;
env->ReleaseStringUTFChars(paramsString, nativeString);

qDebug()<<"paramsString"<<string;
m_applicationParams=string.split('\t');

// Go home
QDir::setCurrent(QDir::homePath());

pthread_t appThread;
return pthread_create(&appThread, NULL, startMainMethod, NULL)==0;
}


static JNINativeMethod methods[] = {
{"startQtApp", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApp}
};

/*
* Register several native methods for one class.
*/
static int registerNativeMethods(JNIEnv* env, const char* className,
JNINativeMethod* gMethods, int numMethods)
{
jclass clazz=env->FindClass(className);
if (clazz == NULL)
{
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
jmethodID constr = env->GetMethodID(clazz, "<init>", "()V");
if(!constr) {
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find constructor for class '%s'", className);
return JNI_FALSE;;
}
jobject obj = env->NewObject(clazz, constr);
objptr = env->NewGlobalRef(obj);
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0)
{
__android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed for '%s'", className);
return JNI_FALSE;
}
return JNI_TRUE;
}

/*
* Register native methods for all classes we know about.
*/
static int registerNatives(JNIEnv* env)
{
if (!registerNativeMethods(env, QtNativeClassPathName, methods, sizeof(methods) / sizeof(methods[0])))
return JNI_FALSE;

return JNI_TRUE;
}

typedef union {
JNIEnv* nativeEnvironment;
void* venv;
} UnionJNIEnvToVoid;

Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
{
__android_log_print(ANDROID_LOG_INFO,"Qt", "qt start");
UnionJNIEnvToVoid uenv;
uenv.venv = NULL;
m_javaVM = 0;

if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK)
{
__android_log_print(ANDROID_LOG_FATAL,"Qt","GetEnv failed");
return -1;
}
m_env = uenv.nativeEnvironment;
if (!registerNatives(m_env))
{
__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
return -1;
}
m_javaVM = vm;
return JNI_VERSION_1_4;
}
21 changes: 15 additions & 6 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ ELSE(WIN32)
ENDIF(WIN32)

IF (WITH_INTERNAL_SPATIALITE)
IF (WIN32 OR APPLE)
IF (WIN32 OR APPLE OR ANDROID)
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
ENDIF (WIN32 OR APPLE)
ENDIF (WIN32 OR APPLE OR ANDROID)
IF (WIN32)
ADD_DEFINITIONS(-DDLL_EXPORT)
ENDIF (WIN32)
Expand Down Expand Up @@ -464,8 +464,6 @@ ENDIF (WITH_INTERNAL_SPATIALINDEX)
ADD_LIBRARY(qgis_core SHARED ${QGIS_CORE_SRCS} ${QGIS_CORE_MOC_SRCS} ${INDEX_SRC} ${QGIS_CORE_HDRS} ${QGIS_CORE_MOC_HDRS})

SET_TARGET_PROPERTIES(qgis_core PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
PUBLIC_HEADER "${QGIS_CORE_HDRS};${QGIS_CORE_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
Expand All @@ -474,6 +472,14 @@ SET_TARGET_PROPERTIES(qgis_core PROPERTIES
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_core)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgis_core PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

# make sure to create qgsversion.h before compiling
ADD_DEPENDENCIES(qgis_core version)

Expand Down Expand Up @@ -504,9 +510,12 @@ IF (WITH_INTERNAL_SPATIALITE)
IF (WIN32 OR APPLE)
TARGET_LINK_LIBRARIES(qgis_core ${ICONV_LIBRARY})
ENDIF (WIN32 OR APPLE)
IF (UNIX)
IF (ANDROID)
TARGET_LINK_LIBRARIES(qgis_core ${ICONV_LIBRARY} ${CHARSET_LIBRARY})
ENDIF (ANDROID)
IF (UNIX AND NOT ANDROID)
TARGET_LINK_LIBRARIES(qgis_core pthread ${CMAKE_DL_LIBS})
ENDIF (UNIX)
ENDIF (UNIX AND NOT ANDROID)
ELSE (WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(qgis_core ${SQLITE3_LIBRARY})
ENDIF (WITH_INTERNAL_SPATIALITE)
Expand Down
74 changes: 74 additions & 0 deletions src/core/qgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,80 @@ void QgsCoordinateTransform::transformInPlace( std::vector<double>& x,
}
}

#ifdef ANDROID
void QgsCoordinateTransform::transformInPlace( float& x, float& y, float& z,
TransformDirection direction ) const
{
if ( mShortCircuit || !mInitialisedFlag )
return;
#ifdef QGISDEBUG
// QgsDebugMsg(QString("Using transform in place %1 %2").arg(__FILE__).arg(__LINE__));
#endif
// transform x
try
{
double xd = x;
double yd = y;
double zd = z;
transformCoords( 1, &xd, &yd, &zd, direction );
x = xd;
y = yd;
z = zd;
}
catch ( QgsCsException &cse )
{
// rethrow the exception
QgsDebugMsg( "rethrowing exception" );
throw cse;
}
}

void QgsCoordinateTransform::transformInPlace( std::vector<float>& x,
std::vector<float>& y, std::vector<float>& z,
TransformDirection direction ) const
{
if ( mShortCircuit || !mInitialisedFlag )
return;

Q_ASSERT( x.size() == y.size() );

// Apparently, if one has a std::vector, it is valid to use the
// address of the first element in the vector as a pointer to an
// array of the vectors data, and hence easily interface with code
// that wants C-style arrays.

try
{
//copy everything to double vectors since proj needs double
int vectorSize = x.size();
std::vector<double> xd( x.size() );
std::vector<double> yd( y.size() );
std::vector<double> zd( z.size() );
for( int i = 0; i < vectorSize; ++i )
{
xd[i] = x[i];
yd[i] = y[i];
zd[i] = z[i];
}
transformCoords( x.size(), &xd[0], &yd[0], &zd[0], direction );

//copy back
for( int i = 0; i < vectorSize; ++i )
{
x[i] = xd[i];
y[i] = yd[i];
z[i] = zd[i];
}
}
catch ( QgsCsException &cse )
{
// rethrow the exception
QgsDebugMsg( "rethrowing exception" );
throw cse;
}
}
#endif //ANDROID


QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle rect, TransformDirection direction ) const
{
Expand Down
7 changes: 7 additions & 0 deletions src/core/qgscoordinatetransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ class CORE_EXPORT QgsCoordinateTransform: public QObject
void transformInPlace( std::vector<double>& x, std::vector<double>& y, std::vector<double>& z,
TransformDirection direction = ForwardTransform ) const;

#ifdef ANDROID
void transformInPlace( float& x, float& y, float& z, TransformDirection direction = ForwardTransform ) const;

void transformInPlace( std::vector<float>& x, std::vector<float>& y, std::vector<float>& z,
TransformDirection direction = ForwardTransform ) const;
#endif

/*! Transform a QgsRectangle to the dest Coordinate system
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
* otherwise points are transformed from map canvas CS to layerCS.
Expand Down
16 changes: 16 additions & 0 deletions src/core/qgsmaptopixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,19 @@ void QgsMapToPixel::transformInPlace( std::vector<double>& x,
for ( unsigned int i = 0; i < x.size(); ++i )
transformInPlace( x[i], y[i] );
}

#ifdef ANDROID
void QgsMapToPixel::transformInPlace( float& x, float& y ) const
{
x = ( x - xMin ) / mMapUnitsPerPixel;
y = yMax - ( y - yMin ) / mMapUnitsPerPixel;
}

void QgsMapToPixel::transformInPlace( std::vector<float>& x,
std::vector<float>& y ) const
{
assert( x.size() == y.size() );
for ( unsigned int i = 0; i < x.size(); ++i )
transformInPlace( x[i], y[i] );
}
#endif
6 changes: 6 additions & 0 deletions src/core/qgsmaptopixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ class CORE_EXPORT QgsMapToPixel
void transformInPlace( std::vector<double>& x,
std::vector<double>& y ) const;

#ifdef ANDROID
void transformInPlace( float& x, float& y ) const;
void transformInPlace( std::vector<float>& x,
std::vector<float>& y ) const;
#endif

QgsPoint toMapCoordinates( int x, int y ) const;

/*! Transform device coordinates to map (world) coordinates
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsproviderregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ QgsProviderRegistry::QgsProviderRegistry( QString pluginPath )

#ifdef WIN32
mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
#elif ANDROID
mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );
#else
mLibraryDirectory.setNameFilters( QStringList( "*.so" ) );
#endif
Expand Down
12 changes: 6 additions & 6 deletions src/core/spatialite/spatialite.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ extern const char * locale_charset (void);
#include <localcharset.h>
#endif /* end localcharset */
#else /* not WINDOWS */
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__ANDROID__)
#include <iconv.h>
#include <localcharset.h>
#else /* not Mac OsX */
#else /* neither Mac OsX nor Android */
#include <iconv.h>
#include <langinfo.h>
#endif
Expand Down Expand Up @@ -8732,7 +8732,7 @@ extern const char * locale_charset (void);
/* #include <localcharset.h> */
#endif /* end localcharset */
#else /* not MINGW32 - WIN32 */
#ifdef __APPLE__
#if defined ( __APPLE__) || (__ANDROID__)
/* #include <iconv.h> */
/* #include <localcharset.h> */
#else /* not Mac OsX */
Expand All @@ -8750,9 +8750,9 @@ gaiaGetLocaleCharset ()
#if defined(__MINGW32__) || defined(_WIN32)
return locale_charset ();
#else /* not MINGW32 - WIN32 */
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__ANDROID__)
return locale_charset ();
#else /* not Mac OsX */
#else /* neither Mac OsX nor Android */
return nl_langinfo (CODESET);
#endif
#endif
Expand Down Expand Up @@ -18753,7 +18753,7 @@ extern const char * locale_charset (void);
/* #include <localcharset.h> */
#endif /* end localcharset */
#else /* not MINGW32 */
#ifdef __APPLE__
#if defined ( __APPLE__) || (__ANDROID__)
/* #include <iconv.h> */
/* #include <localcharset.h> */
#else /* not Mac OsX */
Expand Down
15 changes: 11 additions & 4 deletions src/core/symbology-ng/qgsrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ unsigned char* QgsFeatureRendererV2::_getLineString( QPolygonF& pts, QgsRenderCo
wkb += sizeof( unsigned int );

bool hasZValue = ( wkbType == QGis::WKBLineString25D );
double x, y, z;

double x, y;
#ifdef ANDROID
qreal z;
#else
double z;
#endif //ANDROID
const QgsCoordinateTransform* ct = context.coordinateTransform();
const QgsMapToPixel& mtp = context.mapToPixel();

Expand Down Expand Up @@ -116,8 +120,11 @@ unsigned char* QgsFeatureRendererV2::_getPolygon( QPolygonF& pts, QList<QPolygon

const QgsCoordinateTransform* ct = context.coordinateTransform();
const QgsMapToPixel& mtp = context.mapToPixel();
double z = 0; // dummy variable for coordiante transform

#ifdef ANDROID
qreal z = 0; // dummy variable for coordiante transform
#else
double z = 0; // dummy variable for coordiante transform
#endif
const QgsRectangle& e = context.extent();
double cw = e.width() / 10; double ch = e.height() / 10;
QgsRectangle clipRect( e.xMinimum() - cw, e.yMinimum() - ch, e.xMaximum() + cw, e.yMaximum() + ch );
Expand Down
10 changes: 8 additions & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ ENDIF(MSVC)
ADD_LIBRARY(qgis_gui SHARED ${QGIS_GUI_SRCS} ${QGIS_GUI_MOC_SRCS} ${QGIS_GUI_HDRS} ${QGIS_GUI_MOC_HDRS})

SET_TARGET_PROPERTIES(qgis_gui PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
PUBLIC_HEADER "${QGIS_GUI_HDRS};${QGIS_GUI_MOC_HDRS}"
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
Expand All @@ -252,6 +250,14 @@ SET_TARGET_PROPERTIES(qgis_gui PROPERTIES
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis_gui)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgis_gui PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

# make sure that UI files will be processed first
ADD_DEPENDENCIES(qgis_gui ui)

Expand Down
4 changes: 3 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
//disable the update that leads to the resize crash
if ( viewport() )
{
viewport()->setAttribute( Qt::WA_PaintOnScreen, true );
#ifndef ANDROID
viewport()->setAttribute( Qt::WA_PaintOnScreen, true );
#endif //ANDROID
}

mScene = new QGraphicsScene();
Expand Down
10 changes: 8 additions & 2 deletions src/providers/grass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ INCLUDE_DIRECTORIES(
ADD_LIBRARY(qgisgrass SHARED qgsgrass.cpp)

SET_TARGET_PROPERTIES(qgisgrass PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
Expand All @@ -29,6 +27,14 @@ SET_TARGET_PROPERTIES(qgisgrass PROPERTIES
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgisgrass
COMPILE_FLAGS "\"-DGRASS_LIB_EXPORT=${DLLEXPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\"" )

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgisgrass PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

TARGET_LINK_LIBRARIES(qgisgrass
qgis_core
${GRASS_LIBRARY_gis}
Expand Down
14 changes: 12 additions & 2 deletions src/providers/ogr/qgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,18 @@ void QgsOgrProvider::loadFields()

mAttributeFields.insert(
i, QgsField(
mEncoding->toUnicode( OGR_Fld_GetNameRef( fldDef ) ), varType,
mEncoding->toUnicode( OGR_GetFieldTypeName( ogrType ) ),
//TODO: fix this hack
#ifdef ANDROID
OGR_Fld_GetNameRef( fldDef ),
#else
mEncoding->toUnicode( OGR_Fld_GetNameRef( fldDef ) ),
#endif
varType,
#ifdef ANDROID
OGR_GetFieldTypeName( ogrType ),
#else
mEncoding->toUnicode( OGR_GetFieldTypeName( ogrType ) ),
#endif
OGR_Fld_GetWidth( fldDef ),
OGR_Fld_GetPrecision( fldDef ) ) );
}
Expand Down
10 changes: 8 additions & 2 deletions src/providers/sqlanywhere/sqlanyconnection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@ INCLUDE_DIRECTORIES(
ADD_LIBRARY (qgissqlanyconnection SHARED ${SACONN_SRCS})

SET_TARGET_PROPERTIES(qgissqlanyconnection PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
CLEAN_DIRECT_OUTPUT 1
FRAMEWORK 1
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgisgrass)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgissqlanyconnection PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

TARGET_LINK_LIBRARIES(qgissqlanyconnection
qgis_core
)
Expand Down
10 changes: 8 additions & 2 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ INCLUDE_DIRECTORIES(
ADD_LIBRARY (qgispython SHARED ${QGISPYTHON_SRCS})

SET_TARGET_PROPERTIES(qgispython PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
CLEAN_DIRECT_OUTPUT 1)

#generate unversioned libs for android
IF (NOT ANDROID)
SET_TARGET_PROPERTIES(qgispython PROPERTIES
VERSION ${COMPLETE_VERSION}
SOVERSION ${COMPLETE_VERSION}
)
ENDIF (NOT ANDROID)

TARGET_LINK_LIBRARIES(qgispython
qgis_core
${PYTHON_LIBRARY}
Expand Down