From 951bf416f403bff550102b4f16dc17c4432d391c Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sat, 23 Aug 2025 13:02:08 +0200 Subject: [PATCH 1/2] build: fix build failure with cpp-httplib >= 0.23 --- BUILD.md | 2 +- Descent3/mission_download.cpp | 2 +- netcon/inetfile/httpclient.cpp | 4 ++-- netcon/inetfile/httpclient.h | 10 ++++++++-- vcpkg.json | 5 ++++- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/BUILD.md b/BUILD.md index 0ed8b7711..7782e0fea 100644 --- a/BUILD.md +++ b/BUILD.md @@ -4,7 +4,7 @@ ## Dependencies The build process uses [**CMake**](https://cmake.org/) and, by default, [**Ninja**](https://ninja-build.org/). You must install these; the project cannot locate them for you. The source code also depends on third-party libraries that are not provided as part of the repository: - [**SDL3**](https://wiki.libsdl.org/SDL3/FrontPage) which is used as the base to handle video, audio and input. -- [**cpp-httplib**](https://github.com/yhirose/cpp-httplib) as a HTTP client to download levels. +- [**cpp-httplib**](https://github.com/yhirose/cpp-httplib) >= 0.23 as a HTTP client to download levels. - [**glm**](https://github.com/g-truc/glm) providing useful additions to OpenGL. - [**plog**](https://github.com/SergiusTheBest/plog) for logging - [**zlib**](https://www.zlib.net/) as a compression utility diff --git a/Descent3/mission_download.cpp b/Descent3/mission_download.cpp index f494abe96..00263779a 100644 --- a/Descent3/mission_download.cpp +++ b/Descent3/mission_download.cpp @@ -399,7 +399,7 @@ bool msn_DownloadWithStatus(const char *url, const std::filesystem::path &filena } httplib::Result (D3::HttpClient::*hcg)(const std::string &, const httplib::ContentReceiver &, - const httplib::Progress &) = &D3::HttpClient::Get; + const D3::HttpClient::Progress &) = &D3::HttpClient::Get; std::fstream in(qualfile, std::ios::binary | std::ios::trunc | std::ios::out); auto async_task = std::async( std::launch::async, hcg, &http_client, download_uri, diff --git a/netcon/inetfile/httpclient.cpp b/netcon/inetfile/httpclient.cpp index d15bc9063..33c1e3140 100644 --- a/netcon/inetfile/httpclient.cpp +++ b/netcon/inetfile/httpclient.cpp @@ -30,7 +30,7 @@ httplib::Result HttpClient::Get(const std::string &URIPath) { return m_client->Get(URIPath); } -httplib::Result HttpClient::Get(const std::string &URIPath, const httplib::Progress &progress) { +httplib::Result HttpClient::Get(const std::string &URIPath, const D3::HttpClient::Progress &progress) { return m_client->Get(URIPath, progress); } @@ -39,7 +39,7 @@ httplib::Result HttpClient::Get(const std::string &URIPath, const httplib::Conte } httplib::Result HttpClient::Get(const std::string &URIPath, const httplib::ContentReceiver &content_receiver, - const httplib::Progress &progress) { + const D3::HttpClient::Progress &progress) { return m_client->Get(URIPath, content_receiver, progress); } diff --git a/netcon/inetfile/httpclient.h b/netcon/inetfile/httpclient.h index d3e2499ce..a373405eb 100644 --- a/netcon/inetfile/httpclient.h +++ b/netcon/inetfile/httpclient.h @@ -32,6 +32,12 @@ namespace D3 { class HttpClient { public: + using Progress = httplib::DownloadProgress; + // no way to test with macro; would have to do a cmake-level compile check + //#if httplib < 0.23 + //using Progress = httplib::Progress; + //#endif + /** * Constructor for HttpClient * @param URL request URL, should be in form of http://example.com. Don't add "/" on the end as it's part of URIPath. @@ -46,12 +52,12 @@ class HttpClient { * @param URIPath requested path (for example, "/some_dir/my_file.txt") * @return standard HTTP code. 200 means is OK. */ - httplib::Result Get(const std::string &URIPath, const httplib::Progress &progress); + httplib::Result Get(const std::string &URIPath, const Progress &progress); httplib::Result Get(const std::string &URIPath, const httplib::ContentReceiver &content_receiver); httplib::Result Get(const std::string &URIPath, const httplib::ContentReceiver &content_receiver, - const httplib::Progress &progress); + const Progress &progress); void SetProxy(const std::string &proxy_host, uint16_t port); diff --git a/vcpkg.json b/vcpkg.json index c383313e1..b5e7f64ce 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,10 @@ { "builtin-baseline": "8f90c294883ccf67d2f4953383718aeae981575f", "dependencies": [ - "cpp-httplib", + { + "name": "cpp-httplib", + "version>=": "0.23" + }, "glm", "gtest", "plog", From c4f0f1f8ee930c817131632e99e114f35a4d133a Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Thu, 23 Oct 2025 19:51:34 +0300 Subject: [PATCH 2/2] Update vcpkg baseline 2025.09.17 Required for updated cpp-httplib --- vcpkg.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index b5e7f64ce..0e24bd9ed 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,9 +1,9 @@ { - "builtin-baseline": "8f90c294883ccf67d2f4953383718aeae981575f", + "builtin-baseline": "4334d8b4c8916018600212ab4dd4bbdc343065d1", "dependencies": [ { "name": "cpp-httplib", - "version>=": "0.23" + "version>=": "0.23.0" }, "glm", "gtest",