From 529160e6aa2281421c7e03614273efeb759dc450 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 29 Oct 2024 09:48:53 +0100 Subject: [PATCH] [asio,rest-rpc] Update asio, de-vendor msgpack from rest-rpc, test port (#41772) --- ports/asio/CMakeLists.txt | 13 ++++++++++- ports/asio/asio-config.cmake | 12 +++++----- ports/asio/portfile.cmake | 22 +++++++++---------- ports/asio/vcpkg.json | 6 ++--- ports/rest-rpc/portfile.cmake | 10 ++------- .../rest-rpc/unofficial-rest-rpc-config.cmake | 14 ++++++++++++ ports/rest-rpc/usage | 4 ---- ports/rest-rpc/vcpkg.json | 4 +++- scripts/ci.baseline.txt | 11 ---------- .../vcpkg-ci-rest-rpc/portfile.cmake | 4 ++++ .../vcpkg-ci-rest-rpc/project/CMakeLists.txt | 11 ++++++++++ .../vcpkg-ci-rest-rpc/project/main.cpp | 9 ++++++++ .../test_ports/vcpkg-ci-rest-rpc/vcpkg.json | 12 ++++++++++ versions/a-/asio.json | 5 +++++ versions/baseline.json | 4 ++-- versions/r-/rest-rpc.json | 5 +++++ 16 files changed, 98 insertions(+), 48 deletions(-) create mode 100644 ports/rest-rpc/unofficial-rest-rpc-config.cmake delete mode 100644 ports/rest-rpc/usage create mode 100644 scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake create mode 100644 scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt create mode 100644 scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp create mode 100644 scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json diff --git a/ports/asio/CMakeLists.txt b/ports/asio/CMakeLists.txt index 4241b1ffc7..ffbc3c7c7a 100644 --- a/ports/asio/CMakeLists.txt +++ b/ports/asio/CMakeLists.txt @@ -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) diff --git a/ports/asio/asio-config.cmake b/ports/asio/asio-config.cmake index 1280722753..b916a00931 100644 --- a/ports/asio/asio-config.cmake +++ b/ports/asio/asio-config.cmake @@ -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) diff --git a/ports/asio/portfile.cmake b/ports/asio/portfile.cmake index bec1204fec..68b7874ad5 100644 --- a/ports/asio/portfile.cmake +++ b/ports/asio/portfile.cmake @@ -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") diff --git a/ports/asio/vcpkg.json b/ports/asio/vcpkg.json index d7812dde0e..276b4ecd76 100644 --- a/ports/asio/vcpkg.json +++ b/ports/asio/vcpkg.json @@ -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": [ { diff --git a/ports/rest-rpc/portfile.cmake b/ports/rest-rpc/portfile.cmake index 3fc5a90337..bc96531d10 100644 --- a/ports/rest-rpc/portfile.cmake +++ b/ports/rest-rpc/portfile.cmake @@ -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") diff --git a/ports/rest-rpc/unofficial-rest-rpc-config.cmake b/ports/rest-rpc/unofficial-rest-rpc-config.cmake new file mode 100644 index 0000000000..76040948e1 --- /dev/null +++ b/ports/rest-rpc/unofficial-rest-rpc-config.cmake @@ -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) diff --git a/ports/rest-rpc/usage b/ports/rest-rpc/usage deleted file mode 100644 index bac307d8ee..0000000000 --- a/ports/rest-rpc/usage +++ /dev/null @@ -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}) diff --git a/ports/rest-rpc/vcpkg.json b/ports/rest-rpc/vcpkg.json index c335ac1ef3..9c79425269 100644 --- a/ports/rest-rpc/vcpkg.json +++ b/ports/rest-rpc/vcpkg.json @@ -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" ] } diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 59fbc141de..1f9db0b51f 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -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 diff --git a/scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake b/scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake new file mode 100644 index 0000000000..bc785962c8 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt new file mode 100644 index 0000000000..13a2678891 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt @@ -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) diff --git a/scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp b/scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp new file mode 100644 index 0000000000..4165c75512 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp @@ -0,0 +1,9 @@ +#include + +int main() +{ + rest_rpc::rpc_client client("127.0.0.1", 8080); + client.connect(); + client.run(); + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json b/scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json new file mode 100644 index 0000000000..814d21de30 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-rest-rpc", + "version-string": "ci", + "description": "Validates rest-rpc", + "dependencies": [ + "rest-rpc", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/a-/asio.json b/versions/a-/asio.json index 6b537b2bac..d30d9dd1ea 100644 --- a/versions/a-/asio.json +++ b/versions/a-/asio.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d1b402afe0e4c5b8efb08dcc8be6b0c90900a55e", + "version": "1.32.0", + "port-version": 0 + }, { "git-tree": "2c04598bad69b7562ec517525d8312036d428fd1", "version": "1.31.0", diff --git a/versions/baseline.json b/versions/baseline.json index 358746be81..c52e8fd67d 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -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", diff --git a/versions/r-/rest-rpc.json b/versions/r-/rest-rpc.json index 0fcee3c4f1..030c312f9a 100644 --- a/versions/r-/rest-rpc.json +++ b/versions/r-/rest-rpc.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e119fcd580545a243afd65efb7160242a2b02b73", + "version": "0.12", + "port-version": 1 + }, { "git-tree": "0ae642ae2a86dcfcf77e4c027ab0c4267987020e", "version": "0.12",