[Drogon] Add new port (#12024)

* [Drogon] Add new port

* Update version

* Use cmake options instead of patching
This commit is contained in:
An Tao 2020-06-24 04:03:23 +08:00 committed by GitHub
parent d2b92bff55
commit 7a28379b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 0 deletions

5
ports/drogon/CONTROL Normal file
View File

@ -0,0 +1,5 @@
Source: drogon
Version: v1.0.0-beta18
Homepage: https://github.com/an-tao/drogon
Description:Drogon: A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows
Build-Depends: trantor, zlib, jsoncpp, libmariadb, libpq, sqlite3, brotli

View File

@ -0,0 +1,20 @@
diff --git a/drogon_ctl/CMakeLists.txt b/drogon_ctl/CMakeLists.txt
index bbc01fe..99500f0 100755
--- a/drogon_ctl/CMakeLists.txt
+++ b/drogon_ctl/CMakeLists.txt
@@ -40,13 +40,13 @@ if(WIN32)
target_link_libraries(drogon_ctl PRIVATE ws2_32 Rpcrt4)
endif(WIN32)
message(STATUS "bin:" ${INSTALL_BIN_DIR})
-install(TARGETS drogon_ctl RUNTIME DESTINATION ${INSTALL_BIN_DIR})
+install(TARGETS drogon_ctl RUNTIME DESTINATION tools/drogon)
if(WIN32)
set(CTL_FILE $<TARGET_FILE:drogon_ctl>)
add_custom_command(TARGET drogon_ctl POST_BUILD
COMMAND ${CMAKE_COMMAND}
-DCTL_FILE=${CTL_FILE}
- -DINSTALL_BIN_DIR=${INSTALL_BIN_DIR}
+ -DINSTALL_BIN_DIR=tools/drogon
-P
${CMAKE_CURRENT_SOURCE_DIR}/CopyDlls.cmake)
else(WIN32)

View File

@ -0,0 +1,33 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO an-tao/drogon
REF v1.0.0-beta18
SHA512 38d57e6b5cc43bd1ac07c980453dda1f4c23a8c78eca942dd531d20661d7f088fc0a3d0f4e7cedddf98bac5a32be0330911cbf839d4956e05ee0265a68c7faa6
HEAD_REF master
PATCHES
vcpkg.patch
drogon_ctl_install.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_EXAMPLES=OFF
)
vcpkg_install_cmake()
# Fix CMake files
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/drogon)
# # Remove includes in debug
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
# Copy pdb files
vcpkg_copy_pdbs()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/drogon)

16
ports/drogon/vcpkg.patch Normal file
View File

@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aab915d..4daeb87 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,9 +64,9 @@ if(WIN32)
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/mman-win32>)
endif(WIN32)
-add_subdirectory(trantor)
+find_package(Trantor CONFIG REQUIRED)
-target_link_libraries(${PROJECT_NAME} PUBLIC trantor)
+target_link_libraries(${PROJECT_NAME} PUBLIC Trantor::Trantor)
if(NOT WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE dl)