Skip to content
Permalink
Browse files

bring back internal spatialite for Debian squeeze and Ubuntu lucid, m…

…averick, natty and oneiric
  • Loading branch information
jef-n committed Apr 24, 2012
1 parent 0b915ba commit 5e8d129346fb00ba2cc24fbedd64739b974149a4
@@ -56,9 +56,17 @@ ENDIF (WITH_POSTGRESQL)
SET (WITH_INTERNAL_QWTPOLAR TRUE CACHE BOOL "Use internal build of QwtPolar")

SET (WITH_SPATIALITE TRUE CACHE BOOL "Determines whether SPATIALITE support should be built")
IF(WITH_SPATIALITE)
IF (WITH_SPATIALITE)
SET (WITH_INTERNAL_SPATIALITE FALSE CACHE BOOL "Determines whether SPATIALITE support should be built internally")
SET (WITH_PYSPATIALITE FALSE CACHE BOOL "Determines whether PYSPATIALITE should be built")
ENDIF(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)
FIND_PACKAGE(Iconv REQUIRED)
ENDIF(WIN32 OR APPLE)
ENDIF (WITH_INTERNAL_SPATIALITE)
ENDIF (WITH_SPATIALITE)

# try to configure and build python bindings by default
SET (WITH_BINDINGS TRUE CACHE BOOL "Determines whether python bindings should be built")
@@ -166,19 +174,21 @@ IF (NOT WITH_INTERNAL_QWTPOLAR)
FIND_PACKAGE(QwtPolar REQUIRED)
ENDIF(NOT WITH_INTERNAL_QWTPOLAR)

FIND_PACKAGE(Sqlite3)
IF (NOT SQLITE3_FOUND)
MESSAGE (SEND_ERROR "sqlite3 dependency was not found (try compiling with internal spatialite)!")
ENDIF (NOT SQLITE3_FOUND)
IF (NOT WITH_INTERNAL_SPATIALITE)
FIND_PACKAGE(Sqlite3)
IF (NOT SQLITE3_FOUND)
MESSAGE (SEND_ERROR "sqlite3 dependency was not found (try compiling with internal spatialite)!")
ENDIF (NOT SQLITE3_FOUND)
ENDIF (NOT WITH_INTERNAL_SPATIALITE)

# optional
IF (WITH_POSTGRESQL)
FIND_PACKAGE(Postgres) # PostgreSQL provider, SPIT plugin
ENDIF (WITH_POSTGRESQL)

IF (WITH_SPATIALITE)
IF (WITH_SPATIALITE AND NOT WITH_INTERNAL_SPATIALITE)
FIND_PACKAGE(SPATIALITE)
ENDIF (WITH_SPATIALITE)
ENDIF (WITH_SPATIALITE AND NOT WITH_INTERNAL_SPATIALITE)

IF (NOT PROJ_FOUND OR NOT GEOS_FOUND OR NOT GDAL_FOUND)
MESSAGE (SEND_ERROR "Some dependencies were not found!")

This file was deleted.

@@ -43,10 +43,14 @@ CMAKE_OPTS := \
-D QGIS_CGIBIN_SUBDIR=/usr/lib/cgi-bin \
-D WITH_APIDOC=TRUE

ifeq (,$(findstring $(DISTRIBUTION),"sid"))
ifneq (,$(findstring $(DISTRIBUTION),"squeeze wheezy lucid maverick natty oneiric precise"))
CMAKE_OPTS += -D WITH_PYSPATIALITE=TRUE
endif

ifneq (,$(findstring $(DISTRIBUTION),"squeeze lucid maverick natty oneiric"))
CMAKE_OPTS += -D WITH_INTERNAL_SPATIALITE=TRUE
endif

ifneq (,$(findstring $(DISTRIBUTION),"squeeze lucid maverick natty oneiric"))
CMAKE_OPTS += -D WITH_GLOBE=FALSE
else
@@ -7,6 +7,13 @@ IF (WITH_PYSPATIALITE)
ADD_SUBDIRECTORY(pyspatialite)
ENDIF (WITH_PYSPATIALITE)

IF (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(
../src/core/spatialite/headers
../src/core/spatialite/headers/spatialite
)
ENDIF (WITH_INTERNAL_SPATIALITE)

SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_PYTHON_OUTPUT_DIRECTORY})
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_PYTHON_OUTPUT_DIRECTORY})

@@ -1,6 +1,13 @@
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/pyspatialite)
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/pyspatialite)

IF(WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(
../../src/core/spatialite/headers
../../src/core/spatialite/headers/spatialite
)
ENDIF(WITH_INTERNAL_SPATIALITE)

INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_PATH}
${GEOS_INCLUDE_DIR}
@@ -37,7 +44,11 @@ IF (NOT APPLE)
TARGET_LINK_LIBRARIES(pyspatialite ${PYTHON_LIBRARY})
ENDIF (NOT APPLE)

TARGET_LINK_LIBRARIES(pyspatialite qgis_core ${SPATIALITE_LIBRARY})
TARGET_LINK_LIBRARIES(pyspatialite qgis_core)

IF(NOT WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(pyspatialite ${SPATIALITE_LIBRARY})
ENDIF(NOT WITH_INTERNAL_SPATIALITE)

IF (APPLE)
SET_TARGET_PROPERTIES(pyspatialite PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
@@ -407,9 +407,14 @@ IF (ANDROID)
ENDIF (ANDROID)

IF (HAVE_SPATIALITE)
INCLUDE_DIRECTORIES(${SPATIALITE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIR})
ADD_DEFINITIONS(-DEXTERNAL_SPATIALITE)
IF (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(../core/spatialite/headers)
INCLUDE_DIRECTORIES(../core/spatialite/headers/spatialite)
ELSE (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(${SPATIALITE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIR})
ADD_DEFINITIONS(-DEXTERNAL_SPATIALITE)
ENDIF (WITH_INTERNAL_SPATIALITE)
ENDIF (HAVE_SPATIALITE)

INCLUDE_DIRECTORIES(
@@ -425,7 +430,7 @@ ENDIF (POSTGRES_FOUND)

#############
IF (ANDROID)
ADD_LIBRARY(${QGIS_APP_NAME} SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${INDEX_SRC} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS})
ADD_LIBRARY(${QGIS_APP_NAME} SHARED ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${QGIS_APP_HDRS} ${QGIS_APP_MOC_HDRS} ${IMAGE_RCC_SRCS})
ELSE (ANDROID)
ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS})
ENDIF (ANDROID)
@@ -450,9 +455,11 @@ ENDIF (ANDROID)

IF(WIN32)
ADD_DEFINITIONS(-DQWT_DLL)
ENDIF( WIN32 )
ENDIF(WIN32)

TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${SQLITE_LIBRARY})
IF(NOT WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${SQLITE_LIBRARY})
ENDIF(NOT WITH_INTERNAL_SPATIALITE)

IF (APPLE)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${APP_SERVICES_LIBRARY} )
@@ -62,13 +62,21 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/../ui
${CMAKE_CURRENT_BINARY_DIR}
${GDAL_INCLUDE_DIR} # remove once raster layer is cleaned up
${SQLITE3_INCLUDE_DIR}
)

IF (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(../core/spatialite/headers/spatialite)
ELSE (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIR})
ENDIF (WITH_INTERNAL_SPATIALITE)

TARGET_LINK_LIBRARIES(qbrowser qgis_core qgis_gui)

IF (NOT WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(qbrowser ${SQLITE3_LIBRARY})
ENDIF (NOT WITH_INTERNAL_SPATIALITE)

TARGET_LINK_LIBRARIES(qbrowser
qgis_core
qgis_gui
${SQLITE3_LIBRARY}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
@@ -215,6 +215,39 @@ IF (QT_MOBILITY_LOCATION_FOUND)
)
ENDIF (QT_MOBILITY_LOCATION_FOUND)

IF (WITH_INTERNAL_SPATIALITE)
IF (WIN32 OR APPLE OR ANDROID)
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
ENDIF (WIN32 OR APPLE OR ANDROID)
IF (WIN32)
ADD_DEFINITIONS(-DDLL_EXPORT)
ENDIF (WIN32)

#
# sqlite3 requires some extraflags to be defined
# in order to support:
# - huge database > 2 GB
# - RTree Spatial Index
#
ADD_DEFINITIONS(-D_LARGE_FILE=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1)
ADD_DEFINITIONS(-DSQLITE_ENABLE_RTREE=1)

SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
spatialite/sqlite3.c
spatialite/spatialite.c
)

IF(MSVC)
# dirty code
SET_SOURCE_FILES_PROPERTIES(spatialite/sqlite3.c spatialite/spatialite.c PROPERTIES COMPILE_FLAGS /W0)
ELSE(MSVC)
SET_SOURCE_FILES_PROPERTIES(spatialite/sqlite3.c spatialite/spatialite.c PROPERTIES COMPILE_FLAGS -w)
ENDIF(MSVC)

INCLUDE_DIRECTORIES(BEFORE spatialite/headers/spatialite)
ENDIF (WITH_INTERNAL_SPATIALITE)

ADD_FLEX_FILES(QGIS_CORE_SRCS qgssearchstringlexer.ll qgsexpressionlexer.ll)

ADD_BISON_FILES(QGIS_CORE_SRCS qgssearchstringparser.yy qgsexpressionparser.yy)
@@ -420,9 +453,12 @@ INCLUDE_DIRECTORIES(
${PROJ_INCLUDE_DIR}
${GEOS_INCLUDE_DIR}
${GDAL_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR}
)

IF (NOT WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIR})
ENDIF (NOT WITH_INTERNAL_SPATIALITE)

IF (WIN32)
IF (MSVC)
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllexport)")
@@ -441,7 +477,7 @@ ENDIF (WIN32)
#############################################################
# qgis_core library

ADD_LIBRARY(qgis_core SHARED ${QGIS_CORE_SRCS} ${QGIS_CORE_MOC_SRCS} ${INDEX_SRC} ${QGIS_CORE_HDRS} ${QGIS_CORE_MOC_HDRS})
ADD_LIBRARY(qgis_core SHARED ${QGIS_CORE_SRCS} ${QGIS_CORE_MOC_SRCS} ${QGIS_CORE_HDRS} ${QGIS_CORE_MOC_HDRS})

SET_TARGET_PROPERTIES(qgis_core PROPERTIES
PUBLIC_HEADER "${QGIS_CORE_HDRS};${QGIS_CORE_MOC_HDRS}"
@@ -488,10 +524,23 @@ TARGET_LINK_LIBRARIES(qgis_core
${PROJ_LIBRARY}
${GEOS_LIBRARY}
${GDAL_LIBRARY}
${SQLITE3_LIBRARY}
${SPATIALINDEX_LIBRARY}
)

IF (WITH_INTERNAL_SPATIALITE)
IF (WIN32 OR APPLE)
TARGET_LINK_LIBRARIES(qgis_core ${ICONV_LIBRARY})
ENDIF (WIN32 OR APPLE)
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 AND NOT ANDROID)
ELSE (WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(qgis_core ${SQLITE3_LIBRARY})
ENDIF (WITH_INTERNAL_SPATIALITE)

IF (HAVE_ZLIB)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(qgis_core ${ZLIB_LIBRARY})
@@ -0,0 +1,82 @@
/*
spatialite.h -- Gaia spatial support for SQLite
version 2.4, 2009 September 17
Author: Sandro Furieri a.furieri@lqt.it
------------------------------------------------------------------------------
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the SpatiaLite library
The Initial Developer of the Original Code is Alessandro Furieri
Portions created by the Initial Developer are Copyright (C) 2008
the Initial Developer. All Rights Reserved.
Contributor(s):
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
*/

#ifdef DLL_EXPORT
#define SPATIALITE_DECLARE __declspec(dllexport)
#else
#define SPATIALITE_DECLARE extern
#endif

#ifndef _SPATIALITE_H
#define _SPATIALITE_H

#ifdef __cplusplus
extern "C"
{
#endif

SPATIALITE_DECLARE const char *spatialite_version (void);
SPATIALITE_DECLARE void spatialite_init (int verbose);
SPATIALITE_DECLARE int dump_shapefile (sqlite3 * sqlite, char *table,
char *column, char *charset,
char *shp_path, char *geom_type,
int verbose, int *rows);
SPATIALITE_DECLARE int load_shapefile (sqlite3 * sqlite, char *shp_path,
char *table, char *charset, int srid,
char *column, int coerce2d,
int compressed, int verbose,
int *rows);
SPATIALITE_DECLARE int load_dbf (sqlite3 * sqlite, char *shp_path,
char *table, char *charset, int verbose,
int *rows);
SPATIALITE_DECLARE double math_round (double value);
SPATIALITE_DECLARE sqlite3_int64 math_llabs (sqlite3_int64 value);
SPATIALITE_DECLARE void spatial_ref_sys_init (sqlite3 * sqlite,
int verbose);

#ifdef __cplusplus
}
#endif

#endif /* _SPATIALITE_H */

0 comments on commit 5e8d129

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