mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add redis database backend
This commit is contained in:
parent
db60ae0459
commit
674be38fc2
7 changed files with 322 additions and 1 deletions
|
@ -291,6 +291,25 @@ if(ENABLE_LEVELDB)
|
|||
endif(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
|
||||
endif(ENABLE_LEVELDB)
|
||||
|
||||
set(USE_REDIS 0)
|
||||
|
||||
OPTION(ENABLE_REDIS "Enable redis backend" 1)
|
||||
|
||||
if(ENABLE_REDIS)
|
||||
find_library(REDIS_LIBRARY hiredis)
|
||||
find_path(REDIS_INCLUDE_DIR hiredis.h PATH_SUFFIXES hiredis)
|
||||
message(STATUS "redis library: ${REDIS_LIBRARY}")
|
||||
message(STATUS "redis headers: ${REDIS_INCLUDE_DIR}")
|
||||
if(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
|
||||
set(USE_REDIS 1)
|
||||
message(STATUS "redis backend enabled")
|
||||
include_directories(${REDIS_INCLUDE_DIR})
|
||||
else(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
|
||||
set(USE_REDIS 0)
|
||||
message(STATUS "redis not found!")
|
||||
endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
|
||||
endif(ENABLE_REDIS)
|
||||
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
|
||||
"${PROJECT_BINARY_DIR}/cmake_config.h"
|
||||
|
@ -368,6 +387,7 @@ set(common_SRCS
|
|||
database-dummy.cpp
|
||||
database-leveldb.cpp
|
||||
database-sqlite3.cpp
|
||||
database-redis.cpp
|
||||
player.cpp
|
||||
test.cpp
|
||||
sha1.cpp
|
||||
|
@ -533,6 +553,9 @@ if(BUILD_CLIENT)
|
|||
if (USE_LEVELDB)
|
||||
target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY})
|
||||
endif(USE_LEVELDB)
|
||||
if (USE_REDIS)
|
||||
target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY})
|
||||
endif(USE_REDIS)
|
||||
endif(BUILD_CLIENT)
|
||||
|
||||
if(BUILD_SERVER)
|
||||
|
@ -550,6 +573,9 @@ if(BUILD_SERVER)
|
|||
if (USE_LEVELDB)
|
||||
target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY})
|
||||
endif(USE_LEVELDB)
|
||||
if (USE_REDIS)
|
||||
target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY})
|
||||
endif(USE_REDIS)
|
||||
if(USE_CURL)
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue