Skip to content

Commit 82a36f9

Browse files
committedApr 6, 2013
adjustments to build on cygwin
1 parent d62d88e commit 82a36f9

File tree

11 files changed

+87
-12
lines changed

11 files changed

+87
-12
lines changed
 

‎CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ IF (WITH_SPATIALITE)
6565
IF(WITH_INTERNAL_SPATIALITE)
6666
SET(SPATIALITE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/core/spatialite/headers)
6767
SET(HAVE_SPATIALITE TRUE)
68-
IF(WIN32 OR APPLE)
68+
IF(WIN32 OR APPLE OR CYGWIN)
6969
FIND_PACKAGE(Iconv REQUIRED)
70-
ENDIF(WIN32 OR APPLE)
70+
ENDIF(WIN32 OR APPLE OR CYGWIN)
7171
ENDIF (WITH_INTERNAL_SPATIALITE)
7272
ENDIF (WITH_SPATIALITE)
7373

‎cmake/FindGDAL.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ ELSE(WIN32)
6767
ENDIF ()
6868
ENDIF (APPLE)
6969

70+
IF(CYGWIN)
71+
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal PATHS /usr/lib /usr/local/lib)
72+
ENDIF(CYGWIN)
73+
7074
IF (NOT GDAL_INCLUDE_DIR OR NOT GDAL_LIBRARY OR NOT GDAL_CONFIG)
7175
# didn't find OS X framework, and was not set by user
7276
SET(GDAL_CONFIG_PREFER_PATH "$ENV{GDAL_HOME}/bin" CACHE STRING "preferred path to GDAL (gdal-config)")

‎cmake/FindGEOS.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ IF(WIN32)
3939
ELSE(WIN32)
4040

4141
IF(UNIX)
42-
4342
# try to use framework on mac
4443
# want clean framework path, not unix compatibility path
4544
IF (APPLE)
@@ -69,6 +68,10 @@ ELSE(WIN32)
6968
ENDIF ()
7069
ENDIF (APPLE)
7170

71+
IF(CYGWIN)
72+
FIND_LIBRARY(GEOS_LIBRARY NAMES geos_c PATHS /usr/lib /usr/local/lib)
73+
ENDIF(CYGWIN)
74+
7275
IF (NOT GEOS_INCLUDE_DIR OR NOT GEOS_LIBRARY OR NOT GEOS_CONFIG)
7376
# didn't find OS X framework, and was not set by user
7477
SET(GEOS_CONFIG_PREFER_PATH "$ENV{GEOS_HOME}/bin" CACHE STRING "preferred path to GEOS (geos-config)")

‎cmake/FindPostgres.cmake

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,38 @@ ELSE(WIN32)
6464
OUTPUT_VARIABLE PG_TMP)
6565
IF (APPLE)
6666
SET(POSTGRES_LIBRARY ${PG_TMP}/libpq.dylib CACHE STRING INTERNAL)
67-
ELSE (APPLE)
67+
ELSEIF (CYGWIN)
68+
EXEC_PROGRAM(${POSTGRES_CONFIG}
69+
ARGS --libs
70+
OUTPUT_VARIABLE PG_TMP)
71+
72+
STRING(REGEX MATCHALL "[-][L]([^ ;])+" _LDIRS "${PG_TMP}")
73+
STRING(REGEX MATCHALL "[-][l]([^ ;])+" _LLIBS "${PG_TMP}")
74+
75+
FIND_LIBRARY(POSTGRES_LIBRARY NAMES pq PATHS /usr/lib /usr/local/lib)
76+
77+
SET(_DIRS)
78+
FOREACH(_DIR ${_LDIRS})
79+
STRING(REPLACE "-L" "" _DIR ${_DIR})
80+
SET(_DIRS ${_DIRS} ${_DIR})
81+
ENDFOREACH(_DIR ${_LDIRS})
82+
83+
SET(_LIBS)
84+
FOREACH(_LIB ${_LLIBS})
85+
STRING(REPLACE "-l" "" _LIB ${_LIB})
86+
SET(_LIBS ${_LIBS} ${_LIB})
87+
ENDFOREACH(_LIB ${_LDIRS})
88+
89+
FOREACH(_LIBNAME ${_LIBS})
90+
UNSET(PG_LIB CACHE)
91+
FIND_LIBRARY(PG_LIB NAMES ${_LIBNAME} PATHS ${_DIRS} /usr/lib /usr/local/lib)
92+
IF(NOT PG_LIB)
93+
MESSAGE(FATAL "PostgreSQL dependency library ${_LIBNAME} not found")
94+
ENDIF(NOT PG_LIB)
95+
SET(POSTGRES_LIBRARY ${POSTGRES_LIBRARY} ${PG_LIB})
96+
ENDFOREACH(_LIBNAME ${_LIBS})
97+
98+
ELSE (CYGWIN)
6899
SET(POSTGRES_LIBRARY ${PG_TMP}/libpq.so CACHE STRING INTERNAL)
69100
ENDIF (APPLE)
70101
ENDIF(POSTGRES_CONFIG)

‎ms-windows/cygwin/package.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
[ -d build ] || mkdir build
6+
cd build
7+
8+
cmake -D BUILDNAME="cygwin" \
9+
-D SITE="qgis.org" \
10+
-D PEDANTIC=TRUE \
11+
-D WITH_INTERNAL_SPATIALITE=TRUE \
12+
-D WITH_GRASS=FALSE \
13+
-D WITH_SPATIALITE=TRUE \
14+
-D WITH_QSPATIALITE=TRUE \
15+
-D WITH_MAPSERVER=TRUE \
16+
-D WITH_ASTYLE=TRUE \
17+
-D WITH_GLOBE=TRUE \
18+
-D WITH_TOUCH=TRUE \
19+
-D WITH_ORACLE=FALSE \
20+
-D CMAKE_LEGACY_CYGWIN_WIN32=0 \
21+
-D PYUIC4_PROGRAM=/usr/lib/python2.7/site-packages/PyQt4/pyuic4 \
22+
-D PYRCC4_PROGRAM=/usr/lib/python2.7/site-packages/PyQt4/pyrcc4.exe \
23+
-D WITH_GLOBE=NO \
24+
-D ENABLE_TESTS=YES \
25+
-D CMAKE_INSTALL_PREFIX=/usr \
26+
../../..
27+
28+
make -j8
29+
make test
30+
make install

‎src/app/qgspluginmanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ void QgsPluginManager::getPythonPluginDescriptions()
257257
void QgsPluginManager::getPluginDescriptions()
258258
{
259259
QString sharedLibExtension;
260-
#ifdef WIN32
260+
#if defined(WIN32) || defined(__CYGWIN__)
261261
sharedLibExtension = "*.dll";
262262
#else
263263
sharedLibExtension = "*.so*";

‎src/app/qgspluginregistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
385385
{
386386
QSettings mySettings;
387387

388-
#ifdef WIN32
388+
#if defined(WIN32) || defined(__CYGWIN__)
389389
QString pluginExt = "*.dll";
390390
#elif ANDROID
391391
QString pluginExt = "*plugin.so";

‎src/core/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ IF (QT_MOBILITY_LOCATION_FOUND)
263263
ENDIF (QT_MOBILITY_LOCATION_FOUND)
264264

265265
IF (WITH_INTERNAL_SPATIALITE)
266-
IF (WIN32 OR APPLE OR ANDROID)
266+
IF (WIN32 OR APPLE OR ANDROID OR CYGWIN)
267267
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
268-
ENDIF (WIN32 OR APPLE OR ANDROID)
268+
ENDIF (WIN32 OR APPLE OR ANDROID OR CYGWIN)
269269
IF (WIN32)
270270
ADD_DEFINITIONS(-DDLL_EXPORT)
271271
ENDIF (WIN32)
@@ -643,9 +643,9 @@ TARGET_LINK_LIBRARIES(qgis_core
643643
)
644644

645645
IF (WITH_INTERNAL_SPATIALITE)
646-
IF (WIN32 OR APPLE)
646+
IF (WIN32 OR APPLE OR CYGWIN)
647647
TARGET_LINK_LIBRARIES(qgis_core ${ICONV_LIBRARY})
648-
ENDIF (WIN32 OR APPLE)
648+
ENDIF (WIN32 OR APPLE OR CYGWIN)
649649
IF (ANDROID)
650650
TARGET_LINK_LIBRARIES(qgis_core ${ICONV_LIBRARY} ${CHARSET_LIBRARY})
651651
ENDIF (ANDROID)

‎src/core/gps/qextserialport/posix_qextserialport.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include <QMutexLocker>
77
#include <QDebug>
88

9+
#ifdef __CYGWIN__
10+
#undef FIONREAD
11+
#define FIONREAD TIOCINQ
12+
#endif
13+
914
void QextSerialPort::platformSpecificInit()
1015
{
1116
fd = 0;
@@ -911,12 +916,14 @@ unsigned long QextSerialPort::lineStatus()
911916
if (Temp&TIOCM_RTS) {
912917
Status|=LS_RTS;
913918
}
919+
#ifndef __CYGWIN__
914920
if (Temp&TIOCM_ST) {
915921
Status|=LS_ST;
916922
}
917923
if (Temp&TIOCM_SR) {
918924
Status|=LS_SR;
919925
}
926+
#endif
920927
}
921928
return Status;
922929
}

‎src/core/qgsproviderregistry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ QgsProviderRegistry::QgsProviderRegistry( QString pluginPath )
7575
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
7676
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
7777

78-
#ifdef WIN32
78+
#if defined(WIN32) || defined(__CYGWIN__)
7979
mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
8080
#elif ANDROID
8181
mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );

‎src/providers/mssql/qgsmssqlfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ QgsMssqlFeatureIterator::QgsMssqlFeatureIterator( QgsMssqlProvider* provider, co
3838
QgsDebugMsg( "Creating a separate database connection" );
3939
QString id;
4040
// QString::sprintf adds 0x prefix
41-
id.sprintf( "%08p", this );
41+
id.sprintf( "%p", this );
4242
mDatabase = mProvider->mDatabase.cloneDatabase( mProvider->mDatabase, id );
4343
if ( !mDatabase.open() )
4444
{

0 commit comments

Comments
 (0)