Skip to content

Commit

Permalink
adjustments to build on cygwin
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Apr 6, 2013
1 parent d62d88e commit 82a36f9
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -65,9 +65,9 @@ IF (WITH_SPATIALITE)
IF(WITH_INTERNAL_SPATIALITE)
SET(SPATIALITE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/core/spatialite/headers)
SET(HAVE_SPATIALITE TRUE)
IF(WIN32 OR APPLE)
IF(WIN32 OR APPLE OR CYGWIN)
FIND_PACKAGE(Iconv REQUIRED)
ENDIF(WIN32 OR APPLE)
ENDIF(WIN32 OR APPLE OR CYGWIN)
ENDIF (WITH_INTERNAL_SPATIALITE)
ENDIF (WITH_SPATIALITE)

Expand Down
4 changes: 4 additions & 0 deletions cmake/FindGDAL.cmake
Expand Up @@ -67,6 +67,10 @@ ELSE(WIN32)
ENDIF ()
ENDIF (APPLE)

IF(CYGWIN)
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal PATHS /usr/lib /usr/local/lib)
ENDIF(CYGWIN)

IF (NOT GDAL_INCLUDE_DIR OR NOT GDAL_LIBRARY OR NOT GDAL_CONFIG)
# didn't find OS X framework, and was not set by user
SET(GDAL_CONFIG_PREFER_PATH "$ENV{GDAL_HOME}/bin" CACHE STRING "preferred path to GDAL (gdal-config)")
Expand Down
5 changes: 4 additions & 1 deletion cmake/FindGEOS.cmake
Expand Up @@ -39,7 +39,6 @@ IF(WIN32)
ELSE(WIN32)

IF(UNIX)

# try to use framework on mac
# want clean framework path, not unix compatibility path
IF (APPLE)
Expand Down Expand Up @@ -69,6 +68,10 @@ ELSE(WIN32)
ENDIF ()
ENDIF (APPLE)

IF(CYGWIN)
FIND_LIBRARY(GEOS_LIBRARY NAMES geos_c PATHS /usr/lib /usr/local/lib)
ENDIF(CYGWIN)

IF (NOT GEOS_INCLUDE_DIR OR NOT GEOS_LIBRARY OR NOT GEOS_CONFIG)
# didn't find OS X framework, and was not set by user
SET(GEOS_CONFIG_PREFER_PATH "$ENV{GEOS_HOME}/bin" CACHE STRING "preferred path to GEOS (geos-config)")
Expand Down
33 changes: 32 additions & 1 deletion cmake/FindPostgres.cmake
Expand Up @@ -64,7 +64,38 @@ ELSE(WIN32)
OUTPUT_VARIABLE PG_TMP)
IF (APPLE)
SET(POSTGRES_LIBRARY ${PG_TMP}/libpq.dylib CACHE STRING INTERNAL)
ELSE (APPLE)
ELSEIF (CYGWIN)
EXEC_PROGRAM(${POSTGRES_CONFIG}
ARGS --libs
OUTPUT_VARIABLE PG_TMP)

STRING(REGEX MATCHALL "[-][L]([^ ;])+" _LDIRS "${PG_TMP}")
STRING(REGEX MATCHALL "[-][l]([^ ;])+" _LLIBS "${PG_TMP}")

FIND_LIBRARY(POSTGRES_LIBRARY NAMES pq PATHS /usr/lib /usr/local/lib)

SET(_DIRS)
FOREACH(_DIR ${_LDIRS})
STRING(REPLACE "-L" "" _DIR ${_DIR})
SET(_DIRS ${_DIRS} ${_DIR})
ENDFOREACH(_DIR ${_LDIRS})

SET(_LIBS)
FOREACH(_LIB ${_LLIBS})
STRING(REPLACE "-l" "" _LIB ${_LIB})
SET(_LIBS ${_LIBS} ${_LIB})
ENDFOREACH(_LIB ${_LDIRS})

FOREACH(_LIBNAME ${_LIBS})
UNSET(PG_LIB CACHE)
FIND_LIBRARY(PG_LIB NAMES ${_LIBNAME} PATHS ${_DIRS} /usr/lib /usr/local/lib)
IF(NOT PG_LIB)
MESSAGE(FATAL "PostgreSQL dependency library ${_LIBNAME} not found")
ENDIF(NOT PG_LIB)
SET(POSTGRES_LIBRARY ${POSTGRES_LIBRARY} ${PG_LIB})
ENDFOREACH(_LIBNAME ${_LIBS})

ELSE (CYGWIN)
SET(POSTGRES_LIBRARY ${PG_TMP}/libpq.so CACHE STRING INTERNAL)
ENDIF (APPLE)
ENDIF(POSTGRES_CONFIG)
Expand Down
30 changes: 30 additions & 0 deletions ms-windows/cygwin/package.sh
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

[ -d build ] || mkdir build
cd build

cmake -D BUILDNAME="cygwin" \
-D SITE="qgis.org" \
-D PEDANTIC=TRUE \
-D WITH_INTERNAL_SPATIALITE=TRUE \
-D WITH_GRASS=FALSE \
-D WITH_SPATIALITE=TRUE \
-D WITH_QSPATIALITE=TRUE \
-D WITH_MAPSERVER=TRUE \
-D WITH_ASTYLE=TRUE \
-D WITH_GLOBE=TRUE \
-D WITH_TOUCH=TRUE \
-D WITH_ORACLE=FALSE \
-D CMAKE_LEGACY_CYGWIN_WIN32=0 \
-D PYUIC4_PROGRAM=/usr/lib/python2.7/site-packages/PyQt4/pyuic4 \
-D PYRCC4_PROGRAM=/usr/lib/python2.7/site-packages/PyQt4/pyrcc4.exe \
-D WITH_GLOBE=NO \
-D ENABLE_TESTS=YES \
-D CMAKE_INSTALL_PREFIX=/usr \
../../..

make -j8
make test
make install
2 changes: 1 addition & 1 deletion src/app/qgspluginmanager.cpp
Expand Up @@ -257,7 +257,7 @@ void QgsPluginManager::getPythonPluginDescriptions()
void QgsPluginManager::getPluginDescriptions()
{
QString sharedLibExtension;
#ifdef WIN32
#if defined(WIN32) || defined(__CYGWIN__)
sharedLibExtension = "*.dll";
#else
sharedLibExtension = "*.so*";
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgspluginregistry.cpp
Expand Up @@ -385,7 +385,7 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
{
QSettings mySettings;

#ifdef WIN32
#if defined(WIN32) || defined(__CYGWIN__)
QString pluginExt = "*.dll";
#elif ANDROID
QString pluginExt = "*plugin.so";
Expand Down
8 changes: 4 additions & 4 deletions src/core/CMakeLists.txt
Expand Up @@ -263,9 +263,9 @@ IF (QT_MOBILITY_LOCATION_FOUND)
ENDIF (QT_MOBILITY_LOCATION_FOUND)

IF (WITH_INTERNAL_SPATIALITE)
IF (WIN32 OR APPLE OR ANDROID)
IF (WIN32 OR APPLE OR ANDROID OR CYGWIN)
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
ENDIF (WIN32 OR APPLE OR ANDROID)
ENDIF (WIN32 OR APPLE OR ANDROID OR CYGWIN)
IF (WIN32)
ADD_DEFINITIONS(-DDLL_EXPORT)
ENDIF (WIN32)
Expand Down Expand Up @@ -643,9 +643,9 @@ TARGET_LINK_LIBRARIES(qgis_core
)

IF (WITH_INTERNAL_SPATIALITE)
IF (WIN32 OR APPLE)
IF (WIN32 OR APPLE OR CYGWIN)
TARGET_LINK_LIBRARIES(qgis_core ${ICONV_LIBRARY})
ENDIF (WIN32 OR APPLE)
ENDIF (WIN32 OR APPLE OR CYGWIN)
IF (ANDROID)
TARGET_LINK_LIBRARIES(qgis_core ${ICONV_LIBRARY} ${CHARSET_LIBRARY})
ENDIF (ANDROID)
Expand Down
7 changes: 7 additions & 0 deletions src/core/gps/qextserialport/posix_qextserialport.cpp
Expand Up @@ -6,6 +6,11 @@
#include <QMutexLocker>
#include <QDebug>

#ifdef __CYGWIN__
#undef FIONREAD
#define FIONREAD TIOCINQ
#endif

void QextSerialPort::platformSpecificInit()
{
fd = 0;
Expand Down Expand Up @@ -911,12 +916,14 @@ unsigned long QextSerialPort::lineStatus()
if (Temp&TIOCM_RTS) {
Status|=LS_RTS;
}
#ifndef __CYGWIN__
if (Temp&TIOCM_ST) {
Status|=LS_ST;
}
if (Temp&TIOCM_SR) {
Status|=LS_SR;
}
#endif
}
return Status;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproviderregistry.cpp
Expand Up @@ -75,7 +75,7 @@ QgsProviderRegistry::QgsProviderRegistry( QString pluginPath )
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );

#ifdef WIN32
#if defined(WIN32) || defined(__CYGWIN__)
mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
#elif ANDROID
mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlfeatureiterator.cpp
Expand Up @@ -38,7 +38,7 @@ QgsMssqlFeatureIterator::QgsMssqlFeatureIterator( QgsMssqlProvider* provider, co
QgsDebugMsg( "Creating a separate database connection" );
QString id;
// QString::sprintf adds 0x prefix
id.sprintf( "%08p", this );
id.sprintf( "%p", this );
mDatabase = mProvider->mDatabase.cloneDatabase( mProvider->mDatabase, id );
if ( !mDatabase.open() )
{
Expand Down

0 comments on commit 82a36f9

Please sign in to comment.