Files
Library/cmake/Dependencies.cmake
T
faumarayandClaude Opus 4.8 c92dff6ff7 Add Void::Net — HTTP client + URL parser + SOCKS5/CONNECT proxies
New SHARED module built on Boost.Beast/Asio + OpenSSL (all generic, no
application coupling):
- Void::Net::Url — RFC 3986 parse into scheme/host/port/path/query/target
  (Boost.URL), with scheme-default ports and TLS detection.
- Void::Net::HttpClient — synchronous GET/POST/send with TLS (SNI),
  configurable User-Agent and TLS verification, request/response types.
- Proxy support: HTTP CONNECT tunnelling for TLS targets, plain-HTTP
  forwarding, and a full SOCKS5 handshake (auth, IPv4/IPv6/domain).
- Reuses Void::Encoding::Base64 for proxy auth.

Build wiring: Dependencies.cmake resolves Boost (headers + url) and OpenSSL
+ Threads via find_package (system Boost/OpenSSL). Tests cover URL parsing
and live localhost HTTP GET/POST round-trips (full suite 1136 pass).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 16:21:08 +03:00

70 lines
2.6 KiB
CMake

include(FetchContent)
function(void_fetch_dependency DEP_NAME)
if(DEP_NAME STREQUAL "Boost")
# Components Void uses across modules: stacktrace_backtrace (Stacktrace),
# url + system (Net; beast/asio are header-only and come via Boost::headers).
if(TARGET Boost::stacktrace_backtrace AND TARGET Boost::url)
return()
endif()
# On modern Boost (1.85+) system/asio/beast are header-only and folded
# into Boost::headers; only stacktrace_backtrace and url are components.
find_package(Boost QUIET COMPONENTS stacktrace_backtrace url)
if(TARGET Boost::stacktrace_backtrace AND TARGET Boost::url)
return()
endif()
message(STATUS "[Void] Boost (stacktrace/url) not found — falling back to FetchContent")
set(BOOST_INCLUDE_LIBRARIES "stacktrace;url;system;beast;asio" CACHE STRING "" FORCE)
set(BOOST_ENABLE_CMAKE ON CACHE BOOL "" FORCE)
FetchContent_Declare(Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
URL_HASH SHA256=2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(Boost)
if(NOT TARGET Boost::stacktrace_backtrace AND TARGET boost_stacktrace_backtrace)
add_library(Boost::stacktrace_backtrace ALIAS boost_stacktrace_backtrace)
endif()
return()
endif()
if(DEP_NAME STREQUAL "OpenSSL")
if(NOT TARGET OpenSSL::SSL)
find_package(OpenSSL REQUIRED)
endif()
return()
endif()
if(DEP_NAME STREQUAL "Threads")
if(NOT TARGET Threads::Threads)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
endif()
return()
endif()
# FIXME: Add if needed external
# if(DEP_NAME STREQUAL "glaze")
# if(NOT glaze_POPULATED)
# message(STATUS "[MyLib] Fetching Glaze on-demand...")
# FetchContent_Declare(glaze
# GIT_REPOSITORY https://github.com/stephenberry/glaze.git
# GIT_TAG v2.8.5
# )
# FetchContent_MakeAvailable(glaze)
# endif()
#
# elseif(DEP_NAME STREQUAL "fmt")
# if(NOT fmt_POPULATED)
# message(STATUS "[MyLib] Fetching fmt on-demand...")
# FetchContent_Declare(fmt
# GIT_REPOSITORY https://github.com/fmtlib/fmt.git
# GIT_TAG 10.2.1
# )
# FetchContent_MakeAvailable(fmt)
# endif()
# endif()
endfunction()