rugged-redis 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,42 @@
1
+ #ifndef _WIN32_HELPER_INCLUDE
2
+ #define _WIN32_HELPER_INCLUDE
3
+ #ifdef _MSC_VER
4
+
5
+ #ifndef inline
6
+ #define inline __inline
7
+ #endif
8
+
9
+ #ifndef va_copy
10
+ #define va_copy(d,s) ((d) = (s))
11
+ #endif
12
+
13
+ #ifndef snprintf
14
+ #define snprintf c99_snprintf
15
+
16
+ __inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
17
+ {
18
+ int count = -1;
19
+
20
+ if (size != 0)
21
+ count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
22
+ if (count == -1)
23
+ count = _vscprintf(format, ap);
24
+
25
+ return count;
26
+ }
27
+
28
+ __inline int c99_snprintf(char* str, size_t size, const char* format, ...)
29
+ {
30
+ int count;
31
+ va_list ap;
32
+
33
+ va_start(ap, format);
34
+ count = c99_vsnprintf(str, size, format, ap);
35
+ va_end(ap);
36
+
37
+ return count;
38
+ }
39
+ #endif
40
+
41
+ #endif
42
+ #endif
@@ -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)
@@ -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)
@@ -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)
@@ -0,0 +1,37 @@
1
+ #
2
+ # $Id$
3
+ #
4
+ # - Find libmysql
5
+ # Find libmysql
6
+ #
7
+ # LIBMYSQL_INCLUDE_DIR - where to find mysql.h, etc.
8
+ # LIBMYSQL_LIBRARY - List of libraries when using libmysql.
9
+ # LIBMYSQL_FOUND - True if libmysql found.
10
+
11
+
12
+ IF (LIBMYSQL_INCLUDE_DIR)
13
+ # Already in cache, be silent
14
+ SET(LIBMYSQL_FIND_QUIETLY TRUE)
15
+ ENDIF ()
16
+
17
+ FIND_PATH(LIBMYSQL_INCLUDE_DIR mysql.h)
18
+
19
+ FIND_LIBRARY(LIBMYSQL_LIBRARY mysqlclient)
20
+
21
+ # handle the QUIETLY and REQUIRED arguments and set Libmysql_FOUND to TRUE if
22
+ # all listed variables are TRUE
23
+ INCLUDE(FindPackageHandleStandardArgs)
24
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBMYSQL DEFAULT_MSG LIBMYSQL_LIBRARY LIBMYSQL_INCLUDE_DIR)
25
+
26
+ SET(LIBMYSQL_VERSION 0)
27
+
28
+ IF(LIBMYSQL_FOUND)
29
+ if (EXISTS "${LIBMYSQL_INCLUDE_DIR}/mysql_version.h")
30
+ FILE(READ "${LIBMYSQL_INCLUDE_DIR}/mysql_version.h" _MYSQL_VERSION_CONENTS)
31
+ STRING(REGEX REPLACE ".*#define MYSQL_SERVER_VERSION\\s+\"([0-9.]+)\".*" "\\1" LIBMYSQL_VERSION "${_MYSQL_VERSION_CONENTS}")
32
+ endif()
33
+ ENDIF()
34
+
35
+ SET(LIBMYSQL_VERSION ${LIBMYSQL_VERSION} CACHE STRING "Version number of libmysql")
36
+
37
+ MARK_AS_ADVANCED(LIBMYSQL_LIBRARY LIBMYSQL_INCLUDE_DIR LIBMYSQL_VERSION)
@@ -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, <pgquiles@elpauer.org>
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)
@@ -0,0 +1,25 @@
1
+ PROJECT(libgit2-redis C)
2
+ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3
+
4
+ INCLUDE(../CMake/FindLibgit2.cmake)
5
+ INCLUDE(../CMake/FindHiredis.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_DIR} ${LIBHIREDIS_INCLUDE_DIR})
18
+
19
+ IF (BUILD_SHARED_LIBS)
20
+ ADD_LIBRARY(git2-redis SHARED hiredis.c)
21
+ ELSE ()
22
+ ADD_LIBRARY(git2-redis STATIC hiredis.c)
23
+ ENDIF ()
24
+
25
+ TARGET_LINK_LIBRARIES(git2-redis ${LIBGIT2_LIBRARIES} ${LIBHIREDIS_LIBRARIES})