Skip to content

Commit

Permalink
[asio] 1.30.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed Jun 18, 2024
1 parent 3560bd8 commit df318e7
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 21 deletions.
28 changes: 28 additions & 0 deletions ports/asio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.8)
project(asio)

add_library(asio INTERFACE)

# Export target
install(TARGETS asio
EXPORT asio
INCLUDES DESTINATION include/
)

install(EXPORT asio
DESTINATION "share/asio"
FILE asio-targets.cmake
)

install(DIRECTORY
asio/include/asio
DESTINATION include/
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.ipp"
)

install(FILES
asio/include/asio.hpp
DESTINATION include/
)
3 changes: 0 additions & 3 deletions ports/asio/CONTROL

This file was deleted.

9 changes: 9 additions & 0 deletions ports/asio/asio-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include ("${CMAKE_CURRENT_LIST_DIR}/asio-targets.cmake")

if(NOT TARGET asio::asio)
add_library(asio::asio INTERFACE IMPORTED)
target_link_libraries(asio::asio INTERFACE asio)
endif()

get_target_property(_ASIO_INCLUDE_DIR asio INTERFACE_INCLUDE_DIRECTORIES)
set(ASIO_INCLUDE_DIR "${_ASIO_INCLUDE_DIR}")
40 changes: 22 additions & 18 deletions ports/asio/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#header-only library
vcpkg_download_distfile(
ARCHIVE_FILE
URLS "https://netix.dl.sourceforge.net/project/asio/asio/1.12.2%20%28Stable%29/asio-1.12.2.zip"
FILENAME "asio-1.12.2.zip"
SHA512 f0e945a7c7bc25c15b375b76f3aaff7c6c2c2ca981d1ee207990d14425b23aee2365d295ae78c216b67d6f70cc9d99a8558a879f5c2cd882dc91f56e7e643cc4
)

vcpkg_extract_source_archive(
${ARCHIVE_FILE}
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO chriskohlhoff/asio
REF asio-1-30-2
SHA512 cfba1998d4f666156e751c4cab1e504441b368efbf344e22de30f8b983670a88d045d3ca82f197b95522a2026262274f93bc3061210781ce30c35c71a386ce6e
HEAD_REF master
)

set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/asio-1.12.2)
# 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)")

# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
# CMake install
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)
vcpkg_cmake_install()

# Copy the asio header files
file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp" PATTERN "*.ipp")
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")

# Always use "ASIO_STANDALONE" to avoid boost dependency
file(READ "${CURRENT_PACKAGES_DIR}/include/asio/detail/config.hpp" _contents)
string(REPLACE "defined(ASIO_STANDALONE)" "!defined(VCPKG_DISABLE_ASIO_STANDALONE)" _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/include/asio/detail/config.hpp" "${_contents}")
# Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/asio/LICENSE_1_0.txt")
38 changes: 38 additions & 0 deletions ports/asio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "asio",
"version": "1.30.2",
"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/",
"license": "BSL-1.0",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"coroutine": {
"description": "Boost.Coroutine (optional) if you use spawn() to launch coroutines",
"dependencies": [
"boost-coroutine"
]
},
"openssl": {
"description": "OpenSSL (optional) if you use Asio's SSL support.",
"dependencies": [
"openssl"
]
},
"regex": {
"description": "Boost.Regex (optional) if you use any of the read_until() or async_read_until() overloads that take a boost::regex parameter.",
"dependencies": [
"boost-regex"
]
}
}
}

0 comments on commit df318e7

Please sign in to comment.