vcpkg/ports/drogon/portfile.cmake
Mohsen Mirkarimi d765306b07
[drogon] fix: patch drogon redis link (#32694)
* fix: patch drogon redis link

drogon's source root CMakeLists.txt is now patched to link to
hiredis::hiredis provided by vcpkg hiredis port.

when using vcpkg manifest mode it used to link drogon.dll target to
hiredis.dll while on debug build, hiredisd.dll is only available.
this patch resolves this problem.
2023-07-23 17:51:13 -07:00

65 lines
1.9 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO an-tao/drogon
REF v1.8.4
SHA512 381b4b576d316e55690dc0531cfeaeee4c0e00ce540a502e1c1870eea9a463d00d7e4bc9a354c459e5fbc6da5f046757f07ff2077bb3a9603f97f448f2d17ea2
HEAD_REF master
PATCHES
vcpkg.patch
vcpkg_redis.patch
drogon_config.patch
fix_gcc13.patch #https://github.com/drogonframework/drogon/pull/1563
)
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
ctl BUILD_CTL
mysql BUILD_MYSQL
orm BUILD_ORM
postgres BUILD_POSTGRESQL
postgres LIBPQ_BATCH_MODE
redis BUILD_REDIS
sqlite3 BUILD_SQLITE
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_DROGON_SHARED)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_SHARED_LIBS=${BUILD_DROGON_SHARED}
-DBUILD_EXAMPLES=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Boost=ON
-DUSE_SUBMODULE=OFF
${FEATURE_OPTIONS}
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_Boost
)
vcpkg_cmake_install(ADD_BIN_TO_PATH)
# Fix CMake files
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Drogon)
vcpkg_fixup_pkgconfig()
# Copy drogon_ctl
if("ctl" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES drogon_ctl AUTO_CLEAN)
endif()
# Remove includes in debug
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
# Copy pdb files
vcpkg_copy_pdbs()