[asio,rest-rpc] Update asio, de-vendor msgpack from rest-rpc, test port (#41772)

This commit is contained in:
Kai Pastor 2024-10-29 09:48:53 +01:00 committed by GitHub
parent 6559c7ed2b
commit 529160e6aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 98 additions and 48 deletions

View File

@ -1,8 +1,13 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.10)
project(asio)
add_library(asio INTERFACE)
find_package(Threads)
if(Threads_FOUND)
target_link_libraries(asio INTERFACE Threads::Threads)
endif()
# Export target
install(TARGETS asio
EXPORT asio
@ -12,6 +17,7 @@ install(TARGETS asio
install(EXPORT asio
DESTINATION "share/asio"
FILE asio-targets.cmake
NAMESPACE asio::
)
install(DIRECTORY
@ -26,3 +32,8 @@ install(FILES
asio/include/asio.hpp
DESTINATION include/
)
set(exec_prefix [[${prefix}]])
set(package_name [[asio]])
configure_file(asio/asio.pc.in "${PROJECT_BINARY_DIR}/asio.pc" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/asio.pc" DESTINATION share/pkgconfig)

View File

@ -1,9 +1,9 @@
include ("${CMAKE_CURRENT_LIST_DIR}/asio-targets.cmake")
find_package(Threads)
if(NOT TARGET asio::asio)
add_library(asio::asio INTERFACE IMPORTED)
target_link_libraries(asio::asio INTERFACE asio)
include("${CMAKE_CURRENT_LIST_DIR}/asio-targets.cmake")
if(NOT TARGET asio)
add_library(asio ALIAS asio::asio)
endif()
get_target_property(_ASIO_INCLUDE_DIR asio INTERFACE_INCLUDE_DIRECTORIES)
set(ASIO_INCLUDE_DIR "${_ASIO_INCLUDE_DIR}")
get_target_property(ASIO_INCLUDE_DIR asio::asio INTERFACE_INCLUDE_DIRECTORIES)

View File

@ -1,29 +1,27 @@
#header-only library
set(VCPKG_BUILD_TYPE release) # header-only
string(REPLACE "." "-" ref "asio-${VERSION}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO chriskohlhoff/asio
REF asio-1-31-0
SHA512 505c3f4e4043cd73be1a28ab611d7f61046d6b60f80c08aaceea892a76ce7f51056d39516d7b4e836611a9974c227de52c0434122af0ea8539ceb57363a82b62
REF "${ref}"
SHA512 9374ff97bd4af7b5b41754970b2bcb468f450fee46a80c9c3344f732c64091f2ac5a73ebf4ac1831c623793c08a3c109ae90b601273c40d062bfd4f026f1d94d
HEAD_REF master
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
# Always use "ASIO_STANDALONE" to avoid boost dependency
vcpkg_replace_string("${SOURCE_PATH}/asio/include/asio/detail/config.hpp" "defined(ASIO_STANDALONE)" "!defined(VCPKG_DISABLE_ASIO_STANDALONE)")
# CMake install
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DPACKAGE_VERSION=${VERSION}
)
vcpkg_cmake_install()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup()
file(INSTALL
"${CMAKE_CURRENT_LIST_DIR}/asio-config.cmake"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/asio-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
# Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/asio/LICENSE_1_0.txt")

View File

@ -1,9 +1,9 @@
{
"name": "asio",
"version": "1.31.0",
"version": "1.32.0",
"description": "Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach.",
"homepage": "https://github.com/chriskohlhoff/asio",
"documentation": "https://think-async.com/Asio/asio-1.28.0/doc/",
"homepage": "https://think-async.com/Asio/",
"documentation": "https://think-async.com/Asio/Documentation.html",
"license": "BSL-1.0",
"dependencies": [
{

View File

@ -1,7 +1,3 @@
if (EXISTS ${CURRENT_INSTALLED_DIR}/include/msgpack/pack.h)
message(FATAL_ERROR "Cannot install ${PORT} when msgpack is already installed, please remove msgpack using \"./vcpkg remove msgpack:${TARGET_TRIPLET}\"")
endif()
# header-only library
vcpkg_from_github(
@ -12,8 +8,7 @@ vcpkg_from_github(
HEAD_REF master
)
file(INSTALL ${SOURCE_PATH}/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL ${SOURCE_PATH}/thirdparty/msgpack-c/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(INSTALL "${SOURCE_PATH}/include/" DESTINATION "${CURRENT_PACKAGES_DIR}/include")
vcpkg_replace_string(
"${CURRENT_PACKAGES_DIR}/include/rest_rpc.hpp"
@ -21,7 +16,6 @@ vcpkg_replace_string(
"#define ASIO_STANDALONE\n#include \"rest_rpc/rpc_server.h\""
)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-rest-rpc-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-rest-rpc-config")
# # Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -0,0 +1,14 @@
include(CMakeFindDependencyMacro)
find_dependency(asio CONFIG)
find_dependency(msgpack-cxx CONFIG)
get_filename_component(vcpkg_rest_rpc_prefix_path "${CMAKE_CURRENT_LIST_DIR}" PATH)
get_filename_component(vcpkg_rest_rpc_prefix_path "${vcpkg_rest_rpc_prefix_path}" PATH)
if(NOT TARGET unofficial::rest-rpc::rest-rpc)
add_library(unofficial::rest-rpc::rest-rpc INTERFACE IMPORTED)
target_include_directories(unofficial::rest-rpc::rest-rpc INTERFACE "${vcpkg_rest_rpc_prefix_path}/include")
target_link_libraries(unofficial::rest-rpc::rest-rpc INTERFACE asio::asio msgpack-cxx)
endif()
unset(vcpkg_rest_rpc_prefix_path)

View File

@ -1,4 +0,0 @@
rest-rpc is header-only and can be used from CMake via:
find_path(REST_RPC_INCLUDE_DIRS "rest_rpc.hpp")
target_include_directories(main PRIVATE ${REST_RPC_INCLUDE_DIRS})

View File

@ -1,9 +1,11 @@
{
"name": "rest-rpc",
"version": "0.12",
"port-version": 1,
"description": "c++11, high performance, cross platform, easy to use rpc framework",
"homepage": "https://github.com/qicosmos/rest_rpc",
"dependencies": [
"asio"
"asio",
"msgpack"
]
}

View File

@ -985,17 +985,6 @@ restbed:arm-neon-android=fail
restbed:arm64-uwp=fail
restbed:arm64-android=fail
restbed:x64-uwp=fail
# file conflicts with msgpack
rest-rpc:x86-windows=skip
rest-rpc:x64-windows=skip
rest-rpc:x64-windows-static=skip
rest-rpc:x64-windows-static-md=skip
rest-rpc:x64-uwp=skip
rest-rpc:arm64-uwp=skip
rest-rpc:arm64-windows=skip
rest-rpc:x64-linux=skip
rest-rpc:x64-osx=skip
rest-rpc:arm64-osx=skip
rpclib:arm64-windows=fail
rpclib:arm64-uwp=fail
rpclib:x64-uwp=fail

View File

@ -0,0 +1,4 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project")
vcpkg_cmake_build()

View File

@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.7)
project(soci-test CXX)
if(APPLE)
set(CMAKE_CXX_STANDARD 11)
endif()
add_executable(main main.cpp)
find_package(unofficial-rest-rpc CONFIG REQUIRED)
target_link_libraries(main unofficial::rest-rpc::rest-rpc)

View File

@ -0,0 +1,9 @@
#include <rest_rpc.hpp>
int main()
{
rest_rpc::rpc_client client("127.0.0.1", 8080);
client.connect();
client.run();
return 0;
}

View File

@ -0,0 +1,12 @@
{
"name": "vcpkg-ci-rest-rpc",
"version-string": "ci",
"description": "Validates rest-rpc",
"dependencies": [
"rest-rpc",
{
"name": "vcpkg-cmake",
"host": true
}
]
}

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d1b402afe0e4c5b8efb08dcc8be6b0c90900a55e",
"version": "1.32.0",
"port-version": 0
},
{
"git-tree": "2c04598bad69b7562ec517525d8312036d428fd1",
"version": "1.31.0",

View File

@ -257,7 +257,7 @@
"port-version": 0
},
"asio": {
"baseline": "1.31.0",
"baseline": "1.32.0",
"port-version": 0
},
"asio-grpc": {
@ -7878,7 +7878,7 @@
},
"rest-rpc": {
"baseline": "0.12",
"port-version": 0
"port-version": 1
},
"restbed": {
"baseline": "4.8",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e119fcd580545a243afd65efb7160242a2b02b73",
"version": "0.12",
"port-version": 1
},
{
"git-tree": "0ae642ae2a86dcfcf77e4c027ab0c4267987020e",
"version": "0.12",