Skip to content

Commit

Permalink
[asio,rest-rpc] Update asio, de-vendor msgpack from rest-rpc, test po…
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Oct 29, 2024
1 parent 6559c7e commit 529160e
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 48 deletions.
13 changes: 12 additions & 1 deletion ports/asio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,6 +17,7 @@ install(TARGETS asio
install(EXPORT asio
DESTINATION "share/asio"
FILE asio-targets.cmake
NAMESPACE asio::
)

install(DIRECTORY
Expand All @@ -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)
12 changes: 6 additions & 6 deletions ports/asio/asio-config.cmake
Original file line number Diff line number Diff line change
@@ -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)
22 changes: 10 additions & 12 deletions ports/asio/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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")
6 changes: 3 additions & 3 deletions ports/asio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down
10 changes: 2 additions & 8 deletions ports/rest-rpc/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -12,16 +8,14 @@ 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"
"#include \"rest_rpc/rpc_server.h\""
"#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")
14 changes: 14 additions & 0 deletions ports/rest-rpc/unofficial-rest-rpc-config.cmake
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 0 additions & 4 deletions ports/rest-rpc/usage

This file was deleted.

4 changes: 3 additions & 1 deletion ports/rest-rpc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
11 changes: 0 additions & 11 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project")
vcpkg_cmake_build()
11 changes: 11 additions & 0 deletions scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
12 changes: 12 additions & 0 deletions scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "vcpkg-ci-rest-rpc",
"version-string": "ci",
"description": "Validates rest-rpc",
"dependencies": [
"rest-rpc",
{
"name": "vcpkg-cmake",
"host": true
}
]
}
5 changes: 5 additions & 0 deletions versions/a-/asio.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d1b402afe0e4c5b8efb08dcc8be6b0c90900a55e",
"version": "1.32.0",
"port-version": 0
},
{
"git-tree": "2c04598bad69b7562ec517525d8312036d428fd1",
"version": "1.31.0",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
"port-version": 0
},
"asio": {
"baseline": "1.31.0",
"baseline": "1.32.0",
"port-version": 0
},
"asio-grpc": {
Expand Down Expand Up @@ -7878,7 +7878,7 @@
},
"rest-rpc": {
"baseline": "0.12",
"port-version": 0
"port-version": 1
},
"restbed": {
"baseline": "4.8",
Expand Down
5 changes: 5 additions & 0 deletions versions/r-/rest-rpc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e119fcd580545a243afd65efb7160242a2b02b73",
"version": "0.12",
"port-version": 1
},
{
"git-tree": "0ae642ae2a86dcfcf77e4c027ab0c4267987020e",
"version": "0.12",
Expand Down

0 comments on commit 529160e

Please sign in to comment.