This repository has been archived by the owner on Apr 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the network module of cpp-redis (#39)
* remove network module and now compile with tacopie * only async_read recursively if the client is still connected * disable shallow cloning for git submodules * ensure callbacks are cleared (finished to execute) before finishing to execute destructors * add header files to CMakelist (for VC++) * ensure notify_all is called in all appropriate contexts * do not call disconnection handler in receive handler: will be called by tacopie * update ref to tacopie submodule * remove CMake variable not used anymore * windows tests: WSAStartup & Cleanup * full integration of gtest+tacopie inside cpp_redis solution on windows * fix Cmake warnings under unix (cpp_redis integration) * install_deps update * fix cmakelist * fix cmakelist * clang-format * update ref to tacopie * update ref to tacopie * update CHANGELOG
- Loading branch information
Showing
34 changed files
with
270 additions
and
1,688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "tacopie"] | ||
path = tacopie | ||
url = https://github.com/Cylix/tacopie.git | ||
branch = master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2015-2017 Simon Ninon <[email protected]> | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
### | ||
# config | ||
### | ||
|
@@ -23,6 +45,13 @@ project(${PROJECT} CXX) | |
### | ||
IF (WIN32) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /O2") | ||
|
||
# was causing conflics with gtest build | ||
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) | ||
foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE) | ||
string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}") | ||
endforeach() | ||
|
||
add_definitions(-D_UNICODE) | ||
add_definitions(-DUNICODE) | ||
add_definitions(-DWIN32_LEAN_AND_MEAN) | ||
|
@@ -34,40 +63,34 @@ ENDIF (WIN32) | |
### | ||
# variables | ||
### | ||
set(DEPS_FOLDER ${PROJECT_SOURCE_DIR}/deps/build) | ||
set(GTEST_INCLUDES ${DEPS_FOLDER}/gtest/include) | ||
set(GTEST_LIBS ${DEPS_FOLDER}/gtest/lib) | ||
# gtest | ||
set(GTEST_INCLUDES ${PROJECT_SOURCE_DIR}/deps/src/googletest/googletest/include) | ||
# cpp_redis | ||
set(CPP_REDIS_INCLUDES ${PROJECT_SOURCE_DIR}/includes) | ||
# tacopie | ||
set(TACOPIE_FOLDER ${PROJECT_SOURCE_DIR}/tacopie) | ||
set(TACOPIE_INCLUDES ${TACOPIE_FOLDER}/includes) | ||
|
||
|
||
### | ||
# includes | ||
### | ||
include_directories(${CPP_REDIS_INCLUDES}) | ||
|
||
|
||
### | ||
# link | ||
### | ||
link_directories(${GTEST_LIBS}) | ||
include_directories(${CPP_REDIS_INCLUDES} | ||
${TACOPIE_INCLUDES}) | ||
|
||
|
||
### | ||
# sources | ||
### | ||
set(SRC_DIRS "sources" "sources/network" "sources/builders") | ||
|
||
IF (WIN32) | ||
set(SRC_DIRS ${SRC_DIRS} "sources/network/windows_impl") | ||
ELSE () | ||
set(SRC_DIRS ${SRC_DIRS} "sources/network/unix_impl") | ||
ENDIF (WIN32) | ||
|
||
set(SRC_DIRS "sources" "sources/network" "sources/builders" "includes/cpp_redis" "includes/cpp_redis/builders" "includes/cpp_redis/network") | ||
foreach(dir ${SRC_DIRS}) | ||
# get directory sources | ||
# get directory sources and headers | ||
file(GLOB s_${dir} "${dir}/*.cpp") | ||
file(GLOB h_${dir} "${dir}/*.hpp") | ||
file(GLOB i_${dir} "${dir}/*.ipp") | ||
|
||
# set sources | ||
set(SOURCES ${SOURCES} ${s_${dir}}) | ||
set(SOURCES ${SOURCES} ${s_${dir}} ${h_${dir}} ${i_${dir}}) | ||
endforeach() | ||
|
||
|
||
|
@@ -90,31 +113,21 @@ configure_file("cpp_redis.pc.in" "${CMAKE_PKGCONFIG_OUTPUT_DIRECTORY}/cpp_redis. | |
add_library(${PROJECT} STATIC ${SOURCES}) | ||
|
||
IF (WIN32) | ||
target_link_libraries(${PROJECT} ws2_32) | ||
target_link_libraries(${PROJECT} ws2_32 tacopie) | ||
ELSE () | ||
target_link_libraries(${PROJECT} pthread) | ||
target_link_libraries(${PROJECT} pthread tacopie) | ||
ENDIF (WIN32) | ||
|
||
# __CPP_REDIS_READ_SIZE | ||
IF (READ_SIZE) | ||
set_target_properties(${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_READ_SIZE=${READ_SIZE}") | ||
set_target_properties(${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_READ_SIZE=${READ_SIZE}") | ||
ENDIF (READ_SIZE) | ||
|
||
# __CPP_REDIS_LOGGING_ENABLED | ||
IF (LOGGING_ENABLED) | ||
set_target_properties(${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_LOGGING_ENABLED=${LOGGING_ENABLED}") | ||
set_target_properties(${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_LOGGING_ENABLED=${LOGGING_ENABLED}") | ||
ENDIF (LOGGING_ENABLED) | ||
|
||
# _CPP_REDIS_MAX_NB_FDS | ||
IF (MAX_NB_FDS) | ||
set_target_properties(${PROJECT} PROPERTIES COMPILE_DEFINITIONS "_CPP_REDIS_MAX_NB_FDS=${MAX_NB_FDS}") | ||
ENDIF (MAX_NB_FDS) | ||
|
||
# __CPP_REDIS_DEFAULT_NB_IO_SERVICE_WORKERS | ||
IF (DEFAULT_NB_IO_SERVICE_WORKERS) | ||
set_target_properties(${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_DEFAULT_NB_IO_SERVICE_WORKERS=${DEFAULT_NB_IO_SERVICE_WORKERS}") | ||
ENDIF (DEFAULT_NB_IO_SERVICE_WORKERS) | ||
|
||
|
||
### | ||
# install | ||
|
@@ -128,17 +141,25 @@ install (DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION bin USE_SOURCE_PERMISSIO | |
install (DIRECTORY ${CPP_REDIS_INCLUDES}/ DESTINATION include USE_SOURCE_PERMISSIONS) | ||
|
||
|
||
### | ||
# tacopie | ||
### | ||
add_subdirectory(tacopie) | ||
|
||
|
||
### | ||
# examples | ||
### | ||
IF (BUILD_EXAMPLES) | ||
add_subdirectory(examples) | ||
ENDIF(BUILD_EXAMPLES) | ||
|
||
|
||
### | ||
# tests | ||
### | ||
IF (BUILD_TESTS) | ||
add_subdirectory(tests) | ||
IF (EXISTS ${PROJECT_SOURCE_DIR}/deps/src/googletest) | ||
add_subdirectory(${PROJECT_SOURCE_DIR}/deps/src/googletest) | ||
ENDIF () | ||
ENDIF(BUILD_TESTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.