mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-07-14 16:04:14 +00:00
Move hiredis wrapper into a separate .so
...but the new cmake file has some ugly hacks. Trying to work on the problems...
This commit is contained in:
parent
43e53c3740
commit
4e41ea1864
26 changed files with 106 additions and 38 deletions
|
@ -130,6 +130,7 @@ add_subdirectory(lib/pbl)
|
||||||
add_subdirectory(lib/glob2regex)
|
add_subdirectory(lib/glob2regex)
|
||||||
add_subdirectory(src/backends)
|
add_subdirectory(src/backends)
|
||||||
add_subdirectory(src/core)
|
add_subdirectory(src/core)
|
||||||
|
add_subdirectory(src/incredis)
|
||||||
|
|
||||||
#Actions
|
#Actions
|
||||||
add_subdirectory(src/main)
|
add_subdirectory(src/main)
|
||||||
|
|
|
@ -2,58 +2,30 @@ project(${bare_name}-backend-redis CXX)
|
||||||
|
|
||||||
set(DINDEXER_REDIS_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/${bare_name}/redis" CACHE STRING "Path where Lua scripts for Redis are stored")
|
set(DINDEXER_REDIS_SCRIPTS_PATH "${CMAKE_INSTALL_PREFIX}/${bare_name}/redis" CACHE STRING "Path where Lua scripts for Redis are stored")
|
||||||
|
|
||||||
find_package(hiredis 0.11.0 REQUIRED)
|
|
||||||
find_package(CryptoPP 5.6)
|
|
||||||
find_package(libev 4.0 REQUIRED)
|
|
||||||
find_package(Boost 1.53.0 REQUIRED COMPONENTS regex)
|
find_package(Boost 1.53.0 REQUIRED COMPONENTS regex)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} SHARED
|
add_library(${PROJECT_NAME} SHARED
|
||||||
backend_redis.cpp
|
backend_redis.cpp
|
||||||
command.cpp
|
|
||||||
scan_iterator.cpp
|
|
||||||
reply.cpp
|
|
||||||
batch.cpp
|
|
||||||
script.cpp
|
|
||||||
script_manager.cpp
|
|
||||||
async_connection.cpp
|
|
||||||
tag.cpp
|
tag.cpp
|
||||||
delete.cpp
|
delete.cpp
|
||||||
find.cpp
|
find.cpp
|
||||||
incredis.cpp
|
|
||||||
incredis_batch.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} SYSTEM
|
target_include_directories(${PROJECT_NAME} SYSTEM
|
||||||
PUBLIC ${Boost_INCLUDE_DIRS}
|
PUBLIC ${Boost_INCLUDE_DIRS}
|
||||||
PRIVATE ${HIREDIS_INCLUDE_DIRS}
|
|
||||||
PRIVATE ${CMAKE_SOURCE_DIR}/lib/better-enums
|
|
||||||
PRIVATE ${LIBEV_INCLUDE_DIRS}
|
|
||||||
PRIVATE ${Boost_INCLUDE_DIRS}
|
|
||||||
)
|
)
|
||||||
target_include_directories(${PROJECT_NAME}
|
target_include_directories(${PROJECT_NAME}
|
||||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
PUBLIC ${CMAKE_SOURCE_DIR}/src/incredis
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE ${bare_name}-inc
|
PRIVATE ${bare_name}-inc
|
||||||
PUBLIC ${bare_name}-core
|
PUBLIC ${bare_name}-core
|
||||||
PRIVATE ${HIREDIS_LIBRARIES}
|
|
||||||
PRIVATE ${LIBEV_LIBRARIES}
|
|
||||||
PRIVATE ${Boost_LIBRARIES}
|
PRIVATE ${Boost_LIBRARIES}
|
||||||
|
PRIVATE incredis
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME}
|
|
||||||
PRIVATE EV_COMPAT3=0
|
|
||||||
)
|
|
||||||
|
|
||||||
if (CryptoPP_FOUND)
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${CryptoPP_LIBRARIES})
|
|
||||||
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${CryptoPP_INCLUDE_DIRS})
|
|
||||||
set (has_cryptopp_lib ON)
|
|
||||||
else()
|
|
||||||
set (has_cryptopp_lib OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
redisConfig.h.in
|
redisConfig.h.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/redisConfig.h
|
${CMAKE_CURRENT_BINARY_DIR}/redisConfig.h
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "backends/backend_version.hpp"
|
#include "backends/backend_version.hpp"
|
||||||
#include "helpers/lexical_cast.hpp"
|
#include "helpers/lexical_cast.hpp"
|
||||||
#include "dindexerConfig.h"
|
#include "dindexerConfig.h"
|
||||||
|
#include "redisConfig.h"
|
||||||
#include "helpers/stringize.h"
|
#include "helpers/stringize.h"
|
||||||
#include "tag.hpp"
|
#include "tag.hpp"
|
||||||
#include "delete.hpp"
|
#include "delete.hpp"
|
||||||
|
|
|
@ -18,12 +18,6 @@
|
||||||
#ifndef idB3E2F339E3B64378B66342550C4D2089
|
#ifndef idB3E2F339E3B64378B66342550C4D2089
|
||||||
#define idB3E2F339E3B64378B66342550C4D2089
|
#define idB3E2F339E3B64378B66342550C4D2089
|
||||||
|
|
||||||
#include "helpers/cmake_on_off.h"
|
|
||||||
|
|
||||||
#if CMAKE_@has_cryptopp_lib@
|
|
||||||
# define WITH_CRYPTOPP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define REDIS_SCRIPTS_PATH "@DINDEXER_REDIS_SCRIPTS_PATH@"
|
#define REDIS_SCRIPTS_PATH "@DINDEXER_REDIS_SCRIPTS_PATH@"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
74
src/incredis/CMakeLists.txt
Normal file
74
src/incredis/CMakeLists.txt
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
project(incredis CXX)
|
||||||
|
|
||||||
|
find_package(hiredis 0.11.0 REQUIRED)
|
||||||
|
find_package(CryptoPP 5.6)
|
||||||
|
find_package(libev 4.0 REQUIRED)
|
||||||
|
find_package(Boost 1.53.0 REQUIRED)
|
||||||
|
|
||||||
|
add_library(${PROJECT_NAME} SHARED
|
||||||
|
command.cpp
|
||||||
|
scan_iterator.cpp
|
||||||
|
reply.cpp
|
||||||
|
batch.cpp
|
||||||
|
script.cpp
|
||||||
|
script_manager.cpp
|
||||||
|
async_connection.cpp
|
||||||
|
incredis.cpp
|
||||||
|
incredis_batch.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME} SYSTEM
|
||||||
|
PUBLIC ${Boost_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${HIREDIS_INCLUDE_DIRS}
|
||||||
|
PUBLIC ${CMAKE_SOURCE_DIR}/lib/better-enums
|
||||||
|
PRIVATE ${LIBEV_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${Boost_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
target_include_directories(${PROJECT_NAME}
|
||||||
|
PUBLIC ${CMAKE_SOURCE_DIR}/include
|
||||||
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
PUBLIC ${CMAKE_SOURCE_DIR}/lib/sprout
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
PRIVATE ${HIREDIS_LIBRARIES}
|
||||||
|
PRIVATE ${LIBEV_LIBRARIES}
|
||||||
|
PRIVATE ${Boost_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
incredisConfig.h.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/incredisConfig.h
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(${PROJECT_NAME}
|
||||||
|
PRIVATE EV_COMPAT3=0
|
||||||
|
)
|
||||||
|
|
||||||
|
if (CryptoPP_FOUND)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${CryptoPP_LIBRARIES})
|
||||||
|
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${CryptoPP_INCLUDE_DIRS})
|
||||||
|
set (has_cryptopp_lib ON)
|
||||||
|
else()
|
||||||
|
set (has_cryptopp_lib OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS ${PROJECT_NAME}
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
ARCHIVE DESTINATION lib/static
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_features(${PROJECT_NAME}
|
||||||
|
PUBLIC cxx_nullptr
|
||||||
|
PUBLIC cxx_range_for
|
||||||
|
PUBLIC cxx_lambdas
|
||||||
|
PUBLIC cxx_decltype_auto
|
||||||
|
PUBLIC cxx_defaulted_functions
|
||||||
|
PUBLIC cxx_deleted_functions
|
||||||
|
PUBLIC cxx_auto_type
|
||||||
|
PUBLIC cxx_decltype_incomplete_return_types
|
||||||
|
PUBLIC cxx_defaulted_move_initializers
|
||||||
|
PUBLIC cxx_noexcept
|
||||||
|
PUBLIC cxx_rvalue_references
|
||||||
|
)
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include "reply.hpp"
|
#include "reply.hpp"
|
||||||
#include "batch.hpp"
|
#include "batch.hpp"
|
||||||
#include "redisConfig.h"
|
|
||||||
#include "script.hpp"
|
#include "script.hpp"
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
27
src/incredis/incredisConfig.h.in
Normal file
27
src/incredis/incredisConfig.h.in
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/* Copyright 2015, 2016, Michele Santullo
|
||||||
|
* This file is part of "dindexer".
|
||||||
|
*
|
||||||
|
* "dindexer" is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* "dindexer" is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with "dindexer". If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef id2F97AF7626CE45F08742867A2A737482
|
||||||
|
#define id2F97AF7626CE45F08742867A2A737482
|
||||||
|
|
||||||
|
#include "helpers/cmake_on_off.h"
|
||||||
|
|
||||||
|
#if CMAKE_@has_cryptopp_lib@
|
||||||
|
# define WITH_CRYPTOPP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -18,7 +18,7 @@
|
||||||
#ifndef id8E124FF76DF449CDB8FBA806F8EF4E78
|
#ifndef id8E124FF76DF449CDB8FBA806F8EF4E78
|
||||||
#define id8E124FF76DF449CDB8FBA806F8EF4E78
|
#define id8E124FF76DF449CDB8FBA806F8EF4E78
|
||||||
|
|
||||||
#include "redisConfig.h"
|
#include "incredisConfig.h"
|
||||||
#if defined(WITH_CRYPTOPP)
|
#if defined(WITH_CRYPTOPP)
|
||||||
# define MAKE_SHA1_WITH_CRYPTOPP
|
# define MAKE_SHA1_WITH_CRYPTOPP
|
||||||
#endif
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue