Skip to content

Commit 9d6b0b8

Browse files
committed
Initial commit
The SQLite binding is the only one that builds properly. TODO: Compile memcached, redis and mysql
0 parents  commit 9d6b0b8

File tree

11 files changed

+1494
-0
lines changed

11 files changed

+1494
-0
lines changed

CMake/FindHiredis.cmake

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# - Try to find the Lib library
2+
# Once done this will define
3+
#
4+
# LIBHIREDIS_FOUND - System has Hiredis
5+
# LIBHIREDIS_INCLUDE_DIR - The Hiredis include directory
6+
# LIBHIREDIS_LIBRARIES - The libraries needed to use Hiredis
7+
# LIBHIREDIS_DEFINITIONS - Compiler switches required for using Hiredis
8+
9+
10+
# use pkg-config to get the directories and then use these values
11+
# in the FIND_PATH() and FIND_LIBRARY() calls
12+
#FIND_PACKAGE(PkgConfig)
13+
#PKG_SEARCH_MODULE(PC_LIBHIREDIS libhiredis)
14+
15+
SET(LIBHIREDIS_DEFINITIONS ${PC_LIBHIREDIS_CFLAGS_OTHER})
16+
17+
FIND_PATH(LIBHIREDIS_INCLUDE_DIR hiredis/hiredis.h
18+
HINTS
19+
${PC_LIBHIREDIS_INCLUDEDIR}
20+
${PC_LIBHIREDIS_INCLUDE_DIRS}
21+
)
22+
23+
FIND_LIBRARY(LIBHIREDIS_LIBRARIES NAMES hiredis
24+
HINTS
25+
${PC_LIBHIREDIS_LIBDIR}
26+
${PC_LIBHIREDIS_LIBRARY_DIRS}
27+
)
28+
29+
INCLUDE(FindPackageHandleStandardArgs)
30+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibHiredis DEFAULT_MSG LIBHIREDIS_LIBRARIES LIBHIREDIS_INCLUDE_DIR)
31+
32+
#MARK_AS_ADVANCED(LIBHIREDIS_INCLUDE_DIR LIBHIREDIS_LIBRARIES)

CMake/FindLibgit2.cmake

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# - Try to find the libgit2 library
2+
# Once done this will define
3+
#
4+
# LIBGIT2_FOUND - System has libgit2
5+
# LIBGIT2_INCLUDE_DIR - The libgit2 include directory
6+
# LIBGIT2_LIBRARIES - The libraries needed to use libgit2
7+
# LIBGIT2_DEFINITIONS - Compiler switches required for using libgit2
8+
9+
10+
# use pkg-config to get the directories and then use these values
11+
# in the FIND_PATH() and FIND_LIBRARY() calls
12+
FIND_PACKAGE(PkgConfig)
13+
PKG_SEARCH_MODULE(PC_LIBGIT2 libgit2)
14+
15+
SET(LIBGIT2_DEFINITIONS ${PC_LIBGIT2_CFLAGS_OTHER})
16+
17+
FIND_PATH(LIBGIT2_INCLUDE_DIR NAMES git2.h
18+
HINTS
19+
${PC_LIBGIT2_INCLUDEDIR}
20+
${PC_LIBGIT2_INCLUDE_DIRS}
21+
)
22+
23+
FIND_LIBRARY(LIBGIT2_LIBRARIES NAMES git2
24+
HINTS
25+
${PC_LIBGIT2_LIBDIR}
26+
${PC_LIBGIT2_LIBRARY_DIRS}
27+
)
28+
29+
30+
INCLUDE(FindPackageHandleStandardArgs)
31+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libgit2 DEFAULT_MSG LIBGIT2_LIBRARIES LIBGIT2_INCLUDE_DIR)
32+
33+
MARK_AS_ADVANCED(LIBGIT2_INCLUDE_DIR LIBGIT2_LIBRARIES)

CMake/FindLibmemcached.cmake

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# $Id$
3+
#
4+
# - Find libmemcached
5+
# Find libmemcached
6+
#
7+
# LIBMEMCACHED_INCLUDE_DIR - where to find libmemcached/memcached.h, etc.
8+
# LIBMEMCACHED_LIBRARY - List of libraries when using libmemcached.
9+
# LIBMEMCACHED_FOUND - True if libmemcached found.
10+
11+
12+
IF (LIBMEMCACHED_INCLUDE_DIR)
13+
# Already in cache, be silent
14+
SET(LIBMEMCACHED_FIND_QUIETLY TRUE)
15+
ENDIF ()
16+
17+
FIND_PATH(LIBMEMCACHED_INCLUDE_DIR libmemcached/memcached.h)
18+
19+
FIND_LIBRARY(LIBMEMCACHED_LIBRARY memcached)
20+
21+
# handle the QUIETLY and REQUIRED arguments and set Libmemcached_FOUND to TRUE if
22+
# all listed variables are TRUE
23+
INCLUDE(FindPackageHandleStandardArgs)
24+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBMEMCACHED DEFAULT_MSG LIBMEMCACHED_LIBRARY LIBMEMCACHED_INCLUDE_DIR)
25+
26+
SET(LIBMEMCACHED_VERSION 0)
27+
28+
IF(LIBMEMCACHED_FOUND)
29+
if (EXISTS "${LIBMEMCACHED_INCLUDE_DIR}/libmemcached/configure.h")
30+
FILE(READ "${LIBMEMCACHED_INCLUDE_DIR}/libmemcached/configure.h" _MEMCACHE_VERSION_CONENTS)
31+
STRING(REGEX REPLACE ".*#define LIBMEMCACHED_VERSION_STRING \"([0-9.]+)\".*" "\\1" LIBMEMCACHED_VERSION "${_MEMCACHE_VERSION_CONENTS}")
32+
endif()
33+
ENDIF()
34+
35+
SET(LIBMEMCACHED_VERSION ${LIBMEMCACHED_VERSION} CACHE STRING "Version number of libmemcached")
36+
37+
MARK_AS_ADVANCED(LIBMEMCACHED_LIBRARY LIBMEMCACHED_INCLUDE_DIR LIBMEMCACHED_VERSION)

CMake/FindSQLite3.cmake

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# - find Sqlite 3
2+
# SQLITE3_INCLUDE_DIR - Where to find Sqlite 3 header files (directory)
3+
# SQLITE3_LIBRARIES - Sqlite 3 libraries
4+
# SQLITE3_LIBRARY_RELEASE - Where the release library is
5+
# SQLITE3_LIBRARY_DEBUG - Where the debug library is
6+
# SQLITE3_FOUND - Set to TRUE if we found everything (library, includes and executable)
7+
8+
# Copyright (c) 2010 Pau Garcia i Quiles, <[email protected]>
9+
#
10+
# Redistribution and use is allowed according to the terms of the BSD license.
11+
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12+
#
13+
# Generated by CModuler, a CMake Module Generator - http://gitorious.org/cmoduler
14+
15+
IF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
16+
SET(SQLITE3_FIND_QUIETLY TRUE)
17+
ENDIF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
18+
19+
FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h )
20+
21+
FIND_LIBRARY(SQLITE3_LIBRARY_RELEASE NAMES sqlite3 )
22+
23+
FIND_LIBRARY(SQLITE3_LIBRARY_DEBUG NAMES sqlite3 sqlite3d HINTS /usr/lib/debug/usr/lib/ )
24+
25+
IF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
26+
SET( SQLITE3_FOUND TRUE )
27+
ENDIF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
28+
29+
IF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
30+
# if the generator supports configuration types then set
31+
# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
32+
IF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
33+
SET( SQLITE3_LIBRARIES optimized ${SQLITE3_LIBRARY_RELEASE} debug ${SQLITE3_LIBRARY_DEBUG} )
34+
ELSE( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
35+
# if there are no configuration types and CMAKE_BUILD_TYPE has no value
36+
# then just use the release libraries
37+
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
38+
ENDIF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
39+
ELSEIF( SQLITE3_LIBRARY_RELEASE )
40+
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
41+
ELSE( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
42+
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_DEBUG} )
43+
ENDIF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
44+
45+
IF( SQLITE3_FOUND )
46+
IF( NOT SQLITE3_FIND_QUIETLY )
47+
MESSAGE( STATUS "Found Sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
48+
MESSAGE( STATUS "Found Sqlite3 libraries: ${SQLITE3_LIBRARIES}")
49+
ENDIF( NOT SQLITE3_FIND_QUIETLY )
50+
ELSE(SQLITE3_FOUND)
51+
IF( SQLITE3_FIND_REQUIRED)
52+
MESSAGE( FATAL_ERROR "Could not find Sqlite3" )
53+
ELSE( SQLITE3_FIND_REQUIRED)
54+
MESSAGE( STATUS "Optional package Sqlite3 was not found" )
55+
ENDIF( SQLITE3_FIND_REQUIRED)
56+
ENDIF(SQLITE3_FOUND)

memcached/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
PROJECT(LIBGIT2-memcached C)
2+
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3+
4+
INCLUDE(../CMake/FindLibgit2.cmake)
5+
INCLUDE(../CMake/FindLibmemcached.cmake)
6+
7+
# Build options
8+
OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
9+
OPTION (BUILD_TESTS "Build Tests" ON)
10+
11+
# Build Release by default
12+
IF (NOT CMAKE_BUILD_TYPE)
13+
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
14+
ENDIF ()
15+
16+
# Compile and link LIBGIT2
17+
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDE_DIRS} ${LIBMEMCACHED_INCLUDE_DIR})
18+
ADD_LIBRARY(git2-memcached memcached.c)
19+
TARGET_LINK_LIBRARIES(git2-memcached ${LIBGIT2_LIBRARIES} ${LIBMEMCACHED_LIBRARY})

0 commit comments

Comments
 (0)