Permalink
Browse files

Added sqlite driver

  • Loading branch information...
1 parent 9e939d9 commit 1ba52ce4849974827059bc3d9bec1658e4906bd1 @drahosp drahosp committed Aug 24, 2012
Showing with 76 additions and 8 deletions.
  1. +3 −6 CMakeLists.txt
  2. +70 −0 cmake/FindSQLite3.cmake
  3. +3 −2 dist.info
View
@@ -9,9 +9,6 @@ cmake_minimum_required ( VERSION 2.8 )
include ( cmake/dist.cmake )
include ( lua )
-# No default driver to install
-
-# Install documentation
-install_data ( README )
-install_doc ( doc/ )
-install_test ( tests/ )
+find_package ( SQLite3 REQUIRED )
+include_directories ( ${SQLITE3_INCLUDE_DIRS} src )
+install_lua_module ( sqlite3 src/ls_sqlite3.c src/luasql.c LINK ${SQLITE3_LIBRARIES} )
View
@@ -0,0 +1,70 @@
+###############################################################################
+# CMake module to search for SQLite 3 library
+#
+# On success, the macro sets the following variables:
+# SQLITE3_FOUND = if the library found
+# SQLITE3_LIBRARY = full path to the library
+# SQLITE3_LIBRARIES = full path to the library
+# SSQLITE3_INCLUDE_DIR = where to find the library headers
+#
+# Copyright (c) 2009 Mateusz Loskot <mateusz@loskot.net>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+###############################################################################
+
+if(WIN32)
+ # TODO: Make use of OSGeo4W provider optional and available on explicit request
+ set(OSGEO4W_IMPORT_LIBRARY sqlite3_i)
+ if(DEFINED ENV{OSGEO4W_ROOT})
+ set(OSGEO4W_ROOT_DIR $ENV{OSGEO4W_ROOT})
+ message(STATUS
+ "Trying OSGeo4W using environment variable OSGEO4W_ROOT=$ENV{OSGEO4W_ROOT}")
+ else()
+ set(OSGEO4W_ROOT_DIR c:/OSGeo4W)
+ message(STATUS
+ "Trying OSGeo4W using default location OSGEO4W_ROOT=${OSGEO4W_ROOT_DIR}")
+ endif()
+endif()
+
+find_path(SQLITE3_INCLUDE_DIR
+ NAMES sqlite3.h
+ PATH_PREFIXES sqlite sqlite3
+ PATHS
+ /usr/include
+ /usr/local/include
+ $ENV{LIB_DIR}/include
+ $ENV{LIB_DIR}/include/sqlite
+ $ENV{LIB_DIR}/include/sqlite3
+ $ENV{ProgramFiles}/SQLite/*/include
+ $ENV{ProgramFiles}/SQLite3/*/include
+ $ENV{SystemDrive}/SQLite/*/include
+ $ENV{SystemDrive}/SQLite3/*/include
+ ${OSGEO4W_ROOT_DIR}/include)
+
+set(SQLITE3_NAMES ${OSGEO4W_IMPORT_LIBRARY} sqlite3)
+find_library(SQLITE3_LIBRARY
+ NAMES ${SQLITE3_NAMES}
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ $ENV{LIB_DIR}/lib
+ $ENV{ProgramFiles}/SQLite/*/lib
+ $ENV{ProgramFiles}/SQLite3/*/lib
+ $ENV{SystemDrive}/SQLite/*/lib
+ $ENV{SystemDrive}/SQLite3/*/lib
+ ${OSGEO4W_ROOT_DIR}/lib)
+
+set(SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
+
+#message(STATUS ${SQLITE3_LIBRARY})
+# Handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE
+# if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SQLITE3
+ DEFAULT_MSG
+ SQLITE3_LIBRARY
+ SQLITE3_INCLUDE_DIR)
+
+mark_as_advanced(SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
View
@@ -1,14 +1,15 @@
--- This file is part of LuaDist project
-name = "luasql"
+name = "luasql-sqlite"
version = "2.3.0"
-desc = "Database connectivity for Lua"
+desc = "Database connectivity for Lua - SQLite3 driver"
author = "Roberto Ierusalimschy, André Carregal, Tomás Guisasola"
license = "Kepler"
maintainer = "Peter Kapec"
url = "http://www.keplerproject.org/luasql/"
depends = {
"lua ~> 5.1",
+ "libsqlite3 >= 3.5",
}

0 comments on commit 1ba52ce

Please sign in to comment.