[cpp-redis] Add missing headers, manipulate them to match build type (CUSTOM_TCP_CLIENT=true)

This commit is contained in:
Robert Schumacher 2017-08-01 14:55:47 -07:00
parent c22ab980bc
commit bd2665ced9
2 changed files with 26 additions and 33 deletions

View File

@ -1,3 +1,3 @@
Source: cpp-redis
Version: 3.5.1
Version: 3.5.1-1
Description: cpp-redis is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations and pipelining.

View File

@ -1,5 +1,9 @@
include(vcpkg_common_functions)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(STATUS "cpp-redis only supports static library linkage.")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Cylix/cpp_redis
@ -8,45 +12,34 @@ vcpkg_from_github(
HEAD_REF master
)
if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(MSVC_RUNTIME_LIBRARY_CONFIG "/MD")
else()
set(MSVC_RUNTIME_LIBRARY_CONFIG "/MT")
endif()
# cpp-redis forcibly removes "/RTC1" in its cmake file. Because this is an ABI-sensitive flag, we need to re-add it in a form that won't be detected.
list(APPEND VCPKG_CXX_FLAGS_DEBUG "-RTC1")
list(APPEND VCPKG_C_FLAGS_DEBUG "-RTC1")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DUSE_CUSTOM_TCP_CLIENT=TRUE
OPTIONS
-DUSE_CUSTOM_TCP_CLIENT=TRUE
-DMSVC_RUNTIME_LIBRARY_CONFIG=${MSVC_RUNTIME_LIBRARY_CONFIG}
)
vcpkg_build_cmake()
vcpkg_install_cmake()
file(GLOB DLLS
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.dll"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/*.dll"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/Release/*.dll"
)
file(GLOB LIBS
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.lib"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/lib/*.lib"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/lib/*.lib"
)
file(GLOB DEBUG_DLLS
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.dll"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/*.dll"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/Debug/*.dll"
)
file(GLOB DEBUG_LIBS
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.lib"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/lib/*.lib"
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/lib/*.lib"
)
file(GLOB HEADERS "${SOURCE_PATH}/includes/cpp_redis/*.hpp" "${SOURCE_PATH}/includes/cpp_redis/*.hpp")
if(DLLS)
file(INSTALL ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
endif()
file(INSTALL ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
if(DEBUG_DLLS)
file(INSTALL ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
file(INSTALL ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL ${HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include/cpp_redis)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/debug/include)
file(GLOB_RECURSE FILES "${CURRENT_PACKAGES_DIR}/include/*")
foreach(file ${FILES})
file(READ ${file} _contents)
string(REPLACE "ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT" "if 0" _contents "${_contents}")
file(WRITE ${file} "${_contents}")
endforeach()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cpp-redis RENAME copyright)