From 49569e3579c150ae10ae4d0af0d3377cb67effdb Mon Sep 17 00:00:00 2001 From: Mohammad Nejati Date: Fri, 14 Feb 2025 12:30:05 +0000 Subject: [PATCH 1/3] burl: remove unnecessary call to CertFreeCertificateContext --- example/client/burl/options.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/example/client/burl/options.cpp b/example/client/burl/options.cpp index 2a1e33b..a8f86c9 100644 --- a/example/client/burl/options.cpp +++ b/example/client/burl/options.cpp @@ -230,7 +230,6 @@ load_windows_root_certs(asio::ssl::context& ctx) } } - CertFreeCertificateContext(p_context); CertCloseStore(h_store, 0); SSL_CTX_set_cert_store(ctx.native_handle(), x_store); From 3e6f7e64f0195857e8cc2a21fd2b4277423972b4 Mon Sep 17 00:00:00 2001 From: Mohammad Nejati Date: Sun, 18 May 2025 17:38:59 +0000 Subject: [PATCH 2/3] burl: Update for Buffers --- example/client/burl/any_stream.hpp | 2 +- example/client/burl/main.cpp | 8 ++++---- example/client/burl/multipart_form.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example/client/burl/any_stream.hpp b/example/client/burl/any_stream.hpp index 5724078..a2ebdf6 100644 --- a/example/client/burl/any_stream.hpp +++ b/example/client/burl/any_stream.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include diff --git a/example/client/burl/main.cpp b/example/client/burl/main.cpp index 40d0e45..6d56f9b 100644 --- a/example/client/burl/main.cpp +++ b/example/client/burl/main.cpp @@ -127,7 +127,7 @@ can_reuse_connection( } bool -ignorebody( +should_ignore_body( const operation_config& oc, http_proto::response_view response) noexcept { @@ -604,7 +604,7 @@ perform_request( "HTTP server doesn't seem to support byte ranges. Cannot resume."); } - if(!ignorebody(oc, parser.get())) + if(!should_ignore_body(oc, parser.get())) { auto pm = progress_meter{ body_size(parser.get()) }; parser.set_body(&pm, &output, oc.terminal_binary_ok); @@ -801,7 +801,7 @@ co_main(int argc, char* argv[]) executor, retry(oc, std::move(request_task)), co_await task_group.async_adapt( - [&](auto ep) + [&](std::exception_ptr ep) { if(ep && oc.failearly) { @@ -850,7 +850,7 @@ main(int argc, char* argv[]) asio::experimental::wait_for_one{}, asio::bind_executor( ioc, - [](auto, auto, auto, auto ep) + [](auto, auto, auto, std::exception_ptr ep) { if(ep) std::rethrow_exception(ep); diff --git a/example/client/burl/multipart_form.cpp b/example/client/burl/multipart_form.cpp index 795aea6..4a8f28b 100644 --- a/example/client/burl/multipart_form.cpp +++ b/example/client/burl/multipart_form.cpp @@ -9,8 +9,8 @@ #include "multipart_form.hpp" -#include -#include +#include +#include #include #include @@ -153,7 +153,7 @@ multipart_form::source::on_read(buffers::mutable_buffer mb) auto copy = [&](core::string_view sv) { - auto copied = buffers::buffer_copy( + auto copied = buffers::copy( mb, buffers::sans_prefix( buffers::const_buffer{ sv.data(), sv.size() }, From 07424767bc0cbf8a1c564e04f6032f541503543a Mon Sep 17 00:00:00 2001 From: Mohammad Nejati Date: Sun, 18 May 2025 18:16:24 +0000 Subject: [PATCH 3/3] chore: Fix CI and build scripts --- .drone.star | 28 +- .github/workflows/ci.yml | 432 ++++++++++++++++++----------- CMakeLists.txt | 224 +++++++++------ doc/mrdocs.yml | 2 +- example/client/burl/CMakeLists.txt | 9 +- example/server/CMakeLists.txt | 12 +- test/CMakeLists.txt | 31 +-- test/Jamfile | 33 +-- test/unit/CMakeLists.txt | 33 +++ test/unit/Jamfile | 45 +++ test/unit/beast.cpp | 3 + test/{ => unit}/buffer.cpp | 0 test/{ => unit}/read.cpp | 0 test/{ => unit}/sandbox.cpp | 0 test/{ => unit}/write.cpp | 0 15 files changed, 532 insertions(+), 320 deletions(-) create mode 100644 test/unit/CMakeLists.txt create mode 100644 test/unit/Jamfile create mode 100644 test/unit/beast.cpp rename test/{ => unit}/buffer.cpp (100%) rename test/{ => unit}/read.cpp (100%) rename test/{ => unit}/sandbox.cpp (100%) rename test/{ => unit}/write.cpp (100%) diff --git a/.drone.star b/.drone.star index a1c9e9a..77e832a 100644 --- a/.drone.star +++ b/.drone.star @@ -13,21 +13,21 @@ def main(ctx): return generate( # Compilers - ['gcc >=5.0', - 'clang >=3.8', - 'msvc >=14.1', - 'arm64-gcc latest', - 's390x-gcc latest', - 'apple-clang *', - 'arm64-clang latest', - 's390x-clang latest', - # 'x86-msvc latest' - ], + [ + 'gcc >=5.0', + 'clang >=3.8', + 'msvc >=14.1', + 'arm64-gcc latest', + 's390x-gcc latest', + # 'freebsd-gcc latest', + 'apple-clang *', + 'arm64-clang latest', + 's390x-clang latest', + # 'x86-msvc latest' + ], # Standards '>=11', packages=['zlib1g', 'zlib1g-dev']) - -# from https://github.com/boostorg/boost-ci -load("@boost_ci//ci/drone/:functions.star", "linux_cxx", "windows_cxx", "osx_cxx", "freebsd_cxx") -load("@url//:.drone.star", "generate") +# from https://github.com/cppalliance/ci-automation +load("@ci_automation//ci/drone/:functions.star", "linux_cxx", "windows_cxx", "osx_cxx", "freebsd_cxx", "generate") diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a19602a..68e1342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Official repository: https://github.com/CPPAlliance/http_io/ +# Official repository: https://github.com/cppalliance/http_io/ # name: CI @@ -72,6 +72,19 @@ jobs: build-type: "Release" build-cmake: true + - compiler: "msvc" + version: "14.34" + cxxstd: "17,20" + latest-cxxstd: "20" + runs-on: "windows-2022" + b2-toolset: "msvc-14.3" + generator: "Visual Studio 17 2022" + is-latest: true + name: "MSVC 14.34: C++17-20 (no zlib)" + build-type: "Release" + build-cmake: true + skip-zlib: true + - compiler: "msvc" version: "14.34" cxxstd: "17,20" @@ -155,11 +168,10 @@ jobs: version: "*" cxx: "clang++" cc: "clang" - runs-on: "macos-14" + runs-on: "macos-15" b2-toolset: "clang" is-latest: true - is-earliest: true - name: "Apple-Clang (macOS 14)" + name: "Apple-Clang (macOS 15)" build-type: "Release" build-cmake: true @@ -167,10 +179,10 @@ jobs: version: "*" cxx: "clang++" cc: "clang" - runs-on: "macos-14" + runs-on: "macos-15" b2-toolset: "clang" is-latest: true - name: "Apple-Clang (macOS 14, ubsan)" + name: "Apple-Clang (macOS 15, ubsan)" build-type: "RelWithDebInfo" ubsan: true @@ -178,119 +190,174 @@ jobs: version: "*" cxx: "clang++" cc: "clang" - runs-on: "macos-14" + runs-on: "macos-15" b2-toolset: "clang" is-latest: true - name: "Apple-Clang (macOS 14, asan)" + name: "Apple-Clang (macOS 15, asan)" build-type: "RelWithDebInfo" asan: true + - compiler: "apple-clang" + version: "*" + cxx: "clang++" + cc: "clang" + runs-on: "macos-14" + b2-toolset: "clang" + name: "Apple-Clang (macOS 14)" + build-type: "Release" + build-cmake: true + + - compiler: "apple-clang" + version: "*" + cxx: "clang++" + cc: "clang" + runs-on: "macos-13" + b2-toolset: "clang" + name: "Apple-Clang (macOS 13)" + build-type: "Release" + build-cmake: true + # Linux compilers # - compiler: "gcc" - version: "13" + version: "14" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "g++-13" - cc: "gcc-13" - runs-on: "ubuntu-24.04" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20" + name: "GCC 14: C++17-20" build-type: "Release" - install: "cmake zlib1g-dev" + install: "zlib1g-dev" build-cmake: true - compiler: "gcc" - version: "13" + version: "14" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "g++-13" - cc: "gcc-13" - runs-on: "ubuntu-24.04" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20 (x86)" - x86: true + name: "GCC 14: C++17-20 (no zlib)" build-type: "Release" - install: "cmake gcc-13-multilib g++-13-multilib zlib1g-dev zlib1g-dev:i386 libssl-dev:i386" + build-cmake: true - compiler: "gcc" - version: "13" + version: "14" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "g++-13" - cc: "gcc-13" - runs-on: "ubuntu-24.04" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20 (coverage)" - coverage: true - build-type: "Debug" - cxxflags: "--coverage -fprofile-arcs -ftest-coverage" - ccflags: "--coverage -fprofile-arcs -ftest-coverage" - install: "cmake lcov zlib1g-dev wget unzip" + name: "GCC 14: C++17-20 (x86)" + x86: true + build-type: "Release" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" - compiler: "gcc" - version: "13" + version: "14" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "g++-13" - cc: "gcc-13" - runs-on: "ubuntu-24.04" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20 (shared)" + name: "GCC 14: C++17-20 (shared)" shared: true build-type: "Release" - install: "cmake zlib1g-dev" + install: "zlib1g-dev" build-cmake: true - compiler: "gcc" - version: "13" + version: "14" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "g++-13" - cc: "gcc-13" - runs-on: "ubuntu-24.04" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20 (shared, x86)" + name: "GCC 14: C++17-20 (shared, x86)" shared: true x86: true build-type: "Release" - install: "cmake gcc-13-multilib g++-13-multilib zlib1g-dev zlib1g-dev:i386 libssl-dev:i386" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" build-cmake: true - compiler: "gcc" - version: "13" + version: "14" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "g++-13" - cc: "gcc-13" - runs-on: "ubuntu-24.04" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20 (asan)" + name: "GCC 14: C++17-20 (asan)" asan: true build-type: "RelWithDebInfo" - install: "cmake zlib1g-dev" + install: "zlib1g-dev" - compiler: "gcc" - version: "13" + version: "14" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "g++-13" - cc: "gcc-13" - runs-on: "ubuntu-24.04" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20 (asan, x86)" + name: "GCC 14: C++17-20 (asan, x86)" asan: true x86: true build-type: "RelWithDebInfo" - install: "cmake gcc-13-multilib g++-13-multilib zlib1g-dev zlib1g-dev:i386 libssl-dev:i386" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" + + - compiler: "gcc" + version: "14" + cxxstd: "17,20" + latest-cxxstd: "20" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" + b2-toolset: "gcc" + is-latest: true + name: "GCC 14: C++17-20 (ubsan)" + ubsan: true + build-type: "RelWithDebInfo" + install: "zlib1g-dev" + + - compiler: "gcc" + version: "14" + cxxstd: "17,20" + latest-cxxstd: "20" + cxx: "g++-14" + cc: "gcc-14" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" + b2-toolset: "gcc" + is-latest: true + name: "GCC 14: C++17-20 (ubsan, x86)" + ubsan: true + x86: true + build-type: "RelWithDebInfo" + install: "gcc-14-multilib g++-14-multilib zlib1g-dev zlib1g-dev:i386" - compiler: "gcc" version: "13" @@ -300,11 +367,9 @@ jobs: cc: "gcc-13" runs-on: "ubuntu-24.04" b2-toolset: "gcc" - is-latest: true - name: "GCC 13: C++17-20 (ubsan)" - ubsan: true - build-type: "RelWithDebInfo" - install: "cmake zlib1g-dev" + name: "GCC 13: C++17-20" + build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "13" @@ -315,11 +380,12 @@ jobs: runs-on: "ubuntu-24.04" b2-toolset: "gcc" is-latest: true - name: "GCC 13: C++17-20 (ubsan, x86)" - ubsan: true - x86: true - build-type: "RelWithDebInfo" - install: "cmake gcc-13-multilib g++-13-multilib zlib1g-dev zlib1g-dev:i386 libssl-dev:i386" + name: "GCC 13: C++17-20 (coverage)" + coverage: true + build-type: "Debug" + cxxflags: "--coverage -fprofile-arcs -ftest-coverage" + ccflags: "--coverage -fprofile-arcs -ftest-coverage" + install: "lcov zlib1g-dev wget unzip" - compiler: "gcc" version: "12" @@ -332,6 +398,7 @@ jobs: b2-toolset: "gcc" name: "GCC 12: C++17-20" build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "11" @@ -344,6 +411,7 @@ jobs: b2-toolset: "gcc" name: "GCC 11: C++17-20" build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "10" @@ -356,6 +424,7 @@ jobs: b2-toolset: "gcc" name: "GCC 10: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "9" @@ -368,6 +437,7 @@ jobs: b2-toolset: "gcc" name: "GCC 9: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "8" @@ -380,6 +450,7 @@ jobs: b2-toolset: "gcc" name: "GCC 8: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "7" @@ -392,6 +463,7 @@ jobs: b2-toolset: "gcc" name: "GCC 7: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "6" @@ -404,6 +476,7 @@ jobs: b2-toolset: "gcc" name: "GCC 6: C++11-14" build-type: "Release" + install: "zlib1g-dev" - compiler: "gcc" version: "5" @@ -417,108 +490,128 @@ jobs: is-earliest: true name: "GCC 5: C++11" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" - version: "17" + version: "18" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "clang++-17" - cc: "clang-17" - runs-on: "ubuntu-24.04" + cxx: "clang++-18" + cc: "clang-18" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "clang" is-latest: true - name: "Clang 17: C++17-20" + name: "Clang 18: C++17-20" build-type: "Release" - install: "zlib1g-dev cmake" + install: "zlib1g-dev" build-cmake: true - compiler: "clang" - version: "17" + version: "18" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "clang++-17" - cc: "clang-17" - runs-on: "ubuntu-24.04" + cxx: "clang++-18" + cc: "clang-18" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "clang" is-latest: true - name: "Clang 17: C++17-20 (x86)" + name: "Clang 18: C++17-20 (x86)" x86: true build-type: "Release" - install: "cmake gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386 libssl-dev:i386" + install: "gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386" - compiler: "clang" - version: "17" + version: "18" cxxstd: "20" latest-cxxstd: "20" - cxx: "clang++-17" - cc: "clang-17" - runs-on: "ubuntu-24.04" + cxx: "clang++-18" + cc: "clang-18" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "clang" is-latest: true - name: "Clang 17: C++20 (time-trace)" + name: "Clang 18: C++20 (time-trace)" time-trace: true build-type: "Release" cxxflags: "-ftime-trace" ccflags: "-ftime-trace" - install: "cmake zlib1g-dev wget unzip" + install: "zlib1g-dev wget unzip" - compiler: "clang" - version: "17" + version: "18" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "clang++-17" - cc: "clang-17" - runs-on: "ubuntu-24.04" + cxx: "clang++-18" + cc: "clang-18" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "clang" is-latest: true - name: "Clang 17: C++17-20 (asan)" + name: "Clang 18: C++17-20 (asan)" asan: true build-type: "RelWithDebInfo" - install: "cmake zlib1g-dev" + install: "zlib1g-dev" - compiler: "clang" - version: "17" + version: "18" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "clang++-17" - cc: "clang-17" - runs-on: "ubuntu-24.04" + cxx: "clang++-18" + cc: "clang-18" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "clang" is-latest: true - name: "Clang 17: C++17-20 (asan, x86)" + name: "Clang 18: C++17-20 (asan, x86)" asan: true x86: true build-type: "RelWithDebInfo" - install: "cmake gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386 libssl-dev:i386 libclang-rt-17-dev:i386" + install: "gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386" - compiler: "clang" - version: "17" + version: "18" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "clang++-17" - cc: "clang-17" - runs-on: "ubuntu-24.04" + cxx: "clang++-18" + cc: "clang-18" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "clang" is-latest: true - name: "Clang 17: C++17-20 (ubsan)" + name: "Clang 18: C++17-20 (ubsan)" ubsan: true build-type: "RelWithDebInfo" - install: "cmake zlib1g-dev" + install: "zlib1g-dev" - compiler: "clang" - version: "17" + version: "18" cxxstd: "17,20" latest-cxxstd: "20" - cxx: "clang++-17" - cc: "clang-17" - runs-on: "ubuntu-24.04" + cxx: "clang++-18" + cc: "clang-18" + runs-on: "ubuntu-latest" + container: "ubuntu:24.04" b2-toolset: "clang" is-latest: true - name: "Clang 17: C++17-20 (ubsan, x86)" + name: "Clang 18: C++17-20 (ubsan, x86)" ubsan: true x86: true build-type: "RelWithDebInfo" - install: "cmake gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386 libssl-dev:i386 libclang-rt-17-dev:i386" + install: "gcc-multilib g++-multilib zlib1g-dev zlib1g-dev:i386" + + - compiler: "clang" + version: "17" + cxxstd: "17,20" + latest-cxxstd: "20" + cxx: "clang++-17" + cc: "clang-17" + runs-on: "ubuntu-24.04" + b2-toolset: "clang" + name: "Clang 17: C++17-20" + build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "16" @@ -527,10 +620,10 @@ jobs: cxx: "clang++-16" cc: "clang-16" runs-on: "ubuntu-24.04" - install: "cmake" b2-toolset: "clang" name: "Clang 16: C++17-20" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "15" @@ -543,6 +636,7 @@ jobs: b2-toolset: "clang" name: "Clang 15: C++17-20" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "14" @@ -555,6 +649,7 @@ jobs: b2-toolset: "clang" name: "Clang 14: C++17-20" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "13" @@ -567,6 +662,7 @@ jobs: b2-toolset: "clang" name: "Clang 13: C++17-20" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "12" @@ -579,6 +675,7 @@ jobs: b2-toolset: "clang" name: "Clang 12: C++17-20" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "11" @@ -591,6 +688,7 @@ jobs: b2-toolset: "clang" name: "Clang 11: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "10" @@ -603,6 +701,7 @@ jobs: b2-toolset: "clang" name: "Clang 10: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "9" @@ -615,6 +714,7 @@ jobs: b2-toolset: "clang" name: "Clang 9: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "8" @@ -627,6 +727,7 @@ jobs: b2-toolset: "clang" name: "Clang 8: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "7" @@ -639,6 +740,7 @@ jobs: b2-toolset: "clang" name: "Clang 7: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "6" @@ -651,6 +753,7 @@ jobs: b2-toolset: "clang" name: "Clang 6: C++14-17" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "5" @@ -663,6 +766,7 @@ jobs: b2-toolset: "clang" name: "Clang 5: C++11-14" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" version: "4" @@ -675,24 +779,26 @@ jobs: b2-toolset: "clang" name: "Clang 4: C++11-14" build-type: "Release" + install: "zlib1g-dev" - compiler: "clang" - version: "^3.8" + version: "3.9" cxxstd: "11" latest-cxxstd: "11" - cxx: "clang++-3.8" - cc: "clang-3.8" + cxx: "clang++-3.9" + cc: "clang-3.9" runs-on: "ubuntu-latest" - container: "ubuntu:16.04" + container: "ubuntu:18.04" b2-toolset: "clang" is-earliest: true - name: "Clang ^3.8: C++11" + name: "Clang 3.9: C++11" build-type: "Release" + install: "zlib1g-dev" name: ${{ matrix.name }} runs-on: ${{ fromJSON(needs.runner-selection.outputs.labelmatrix)[matrix.runs-on] }} container: - image: ${{matrix.container}} + image: ${{ matrix.container }} options: --privileged volumes: - /node20217:/node20217:rw,rshared @@ -709,14 +815,10 @@ jobs: tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217 ldd /__e/node20/bin/node - - name: ASLR Fix - if: ${{ startsWith(matrix.runs-on, 'ubuntu' )}} - run: sysctl vm.mmap_rnd_bits=28 - - name: Clone Boost.Http.Io uses: actions/checkout@v3 with: - path: http-io-root + path: http-io-root - name: Clone Boost.Http.Proto uses: actions/checkout@v3 @@ -733,7 +835,7 @@ jobs: ref: develop - name: Setup C++ - uses: alandefreitas/cpp-actions/setup-cpp@v1.8.7 + uses: alandefreitas/cpp-actions/setup-cpp@v1.8.8 id: setup-cpp with: compiler: ${{ matrix.compiler }} @@ -742,7 +844,7 @@ jobs: trace-commands: true - name: Install packages - uses: alandefreitas/cpp-actions/package-install@v1.8.7 + uses: alandefreitas/cpp-actions/package-install@v1.8.8 id: package-install with: apt-get-add-architecture: 'i386' @@ -752,16 +854,24 @@ jobs: build-essential - name: Clone Boost - uses: alandefreitas/cpp-actions/boost-clone@v1.8.7 + uses: alandefreitas/cpp-actions/boost-clone@v1.8.8 id: boost-clone with: branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }} boost-dir: boost-source - scan-modules-dir: http-io-root - scan-modules-ignore: http_io + cache: false + modules-exclude-paths: '' + scan-modules-dir: | + http-io-root + http-proto-root + buffers-root + scan-modules-ignore: | + http_io + http_proto + buffers - name: Install packages (Windows) - uses: alandefreitas/cpp-actions/package-install@v1.8.7 + uses: alandefreitas/cpp-actions/package-install@v1.8.8 if: ${{ startsWith(matrix.runs-on, 'windows') }} id: package-install-windows with: @@ -780,17 +890,19 @@ jobs: triplet=${{ matrix.x86 && 'x86-windows' || 'x64-windows' }} addrmdl=${{ matrix.x86 && '32' || '64' }} - ls -lah "${home}/vcpkg-root/installed/${triplet}/include" - ls -lah "${home}/vcpkg-root/installed/${triplet}/lib" - - touch user-config.jam echo "using zlib : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" zlib : ${addrmdl} ;" | sed 's/\/d\//D:\//g' > user-config.jam echo "using openssl : : \"${home}/vcpkg-root/installed/${triplet}/include\" \"${home}/vcpkg-root/installed/${triplet}/lib\" libssl libcrypto : ${addrmdl} ;" | sed 's/\/d\//D:\//g' >> user-config.jam cat user-config.jam toolchain=$(echo "$GITHUB_WORKSPACE/vcpkg-root/scripts/buildsystems/vcpkg.cmake" | sed 's/\/d\//D:\//g' ) + cat ${toolchain} echo "toolchain=${toolchain}" >> $GITHUB_OUTPUT + - name: ASLR Fix + if: ${{ startsWith(matrix.runs-on, 'ubuntu' )}} + run: | + sysctl vm.mmap_rnd_bits=28 + - name: Patch Boost id: patch shell: bash @@ -821,17 +933,15 @@ jobs: echo -E "boost_root=$boost_root" >> $GITHUB_OUTPUT # Patch boost-root with workspace module - cp -r "$workspace_root"/buffers-root libs/buffers - cp -r "$workspace_root"/http-proto-root libs/http_proto cp -r "$workspace_root"/http-io-root "libs/$module" - - python3 tools/boostdep/depinst/depinst.py buffers - python3 tools/boostdep/depinst/depinst.py http_proto - python3 tools/boostdep/depinst/depinst.py "$module" + cp -r "$workspace_root"/http-proto-root libs/http_proto + cp -r "$workspace_root"/buffers-root libs/buffers - name: Boost B2 Workflow - uses: alandefreitas/cpp-actions/b2-workflow@v1.7.0 + uses: alandefreitas/cpp-actions/b2-workflow@v1.8.8 if: ${{ !matrix.coverage && !matrix.time-trace }} + env: + ASAN_OPTIONS: ${{ (startsWith(matrix.compiler, 'apple-clang') && 'detect_invalid_pointer_pairs=0') || 'detect_invalid_pointer_pairs=2' }} with: source-dir: boost-root modules: http_io @@ -849,7 +959,7 @@ jobs: stop-on-error: true - name: Boost CMake Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.7 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 if: ${{ matrix.coverage || matrix.time-trace || matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root @@ -886,7 +996,7 @@ jobs: echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/.local/lib:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - name: Find Package Integration Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.7 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 if: ${{ matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root/libs/${{ steps.patch.outputs.module }}/test/cmake_test @@ -901,7 +1011,7 @@ jobs: cxxflags: ${{ matrix.cxxflags }} shared: ${{ matrix.shared }} install: false - cmake-version: '>=3.15' + cmake-version: '>=3.20' extra-args: | -D BOOST_CI_INSTALL_TEST=ON -D CMAKE_PREFIX_PATH=${{ steps.patch.outputs.workspace_root }}/.local @@ -910,7 +1020,7 @@ jobs: toolchain: ${{ (startsWith(matrix.runs-on, 'windows') && steps.patch-user-config.outputs.toolchain) || '' }} - name: Subdirectory Integration Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.7 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 if: ${{ matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root/libs/${{ steps.patch.outputs.module }}/test/cmake_test @@ -925,21 +1035,22 @@ jobs: cxxflags: ${{ matrix.cxxflags }} shared: ${{ matrix.shared }} install: false - cmake-version: '>=3.15' + cmake-version: '>=3.20' extra-args: -D BOOST_CI_INSTALL_TEST=OFF ref-source-dir: boost-root/libs/http_io/test/cmake_test toolchain: ${{ (startsWith(matrix.runs-on, 'windows') && steps.patch-user-config.outputs.toolchain) || '' }} - name: Root Project CMake Workflow - uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.7 + uses: alandefreitas/cpp-actions/cmake-workflow@v1.8.8 if: ${{ matrix.build-cmake || matrix.is-earliest }} with: source-dir: boost-root/libs/${{ steps.patch.outputs.module }} build-dir: __build_root_test__ + build-target: tests + run-tests: true generator: ${{ matrix.generator }} generator-toolset: ${{ matrix.generator-toolset }} build-type: ${{ matrix.build-type }} - run-tests: false install: false cxxstd: ${{ matrix.latest-cxxstd }} cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }} @@ -947,15 +1058,14 @@ jobs: cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }} cxxflags: ${{ matrix.cxxflags }} shared: ${{ matrix.shared }} - extra-args: -D Boost_VERBOSE=ON -D BUILD_TESTING=ON -D BOOST_SRC_DIR="../boost-root" - cmake-version: '>=3.15' + cmake-version: '>=3.20' package: false package-artifact: false ref-source-dir: boost-root toolchain: ${{ (startsWith(matrix.runs-on, 'windows') && steps.patch-user-config.outputs.toolchain) || '' }} - name: FlameGraph - uses: alandefreitas/cpp-actions/flamegraph@v1.8.7 + uses: alandefreitas/cpp-actions/flamegraph@v1.8.8 if: matrix.time-trace with: source-dir: boost-root/libs/http_io @@ -997,18 +1107,18 @@ jobs: shell: bash name: Changelog Summary - runs-on: ubuntu-latest + runs-on: ${{ fromJSON(needs.runner-selection.outputs.labelmatrix)['ubuntu-22.04'] }} timeout-minutes: 120 steps: - - name: Clone Boost.Http.Io + - name: Clone Boost.WS.Io uses: actions/checkout@v3 with: # Avoid the common API rate limit exceeded error in boostorg by including 100 latest commits in any case fetch-depth: 100 - name: Changelog - uses: alandefreitas/cpp-actions/create-changelog@v1.8.7 + uses: alandefreitas/cpp-actions/create-changelog@v1.8.8 with: thank-non-regular: ${{ startsWith(github.ref, 'refs/tags/') }} github-token: ${{ secrets.GITHUB_TOKEN }} @@ -1020,7 +1130,7 @@ jobs: strategy: matrix: include: - # - { name: Windows, os: windows-latest } + - { name: Windows, os: windows-latest } - { name: Ubuntu, os: ubuntu-latest } - { name: MacOS, os: macos-latest } name: Antora Docs (${{ matrix.name }}) @@ -1054,13 +1164,21 @@ jobs: ref: develop - name: Clone Boost - uses: alandefreitas/cpp-actions/boost-clone@v1.8.2 + uses: alandefreitas/cpp-actions/boost-clone@v1.8.8 id: boost-clone with: branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }} boost-dir: boost-source - scan-modules-dir: http-io-root - scan-modules-ignore: http_io + cache: false + modules-exclude-paths: '' + scan-modules-dir: | + http-io-root + http-proto-root + buffers-root + scan-modules-ignore: | + http_io + http_proto + buffers - name: Patch Boost id: patch @@ -1093,12 +1211,8 @@ jobs: # Patch boost-root with workspace module cp -r "$workspace_root"/http-io-root "libs/$module" - cp -r "$workspace_root"/buffers-root libs/buffers cp -r "$workspace_root"/http-proto-root libs/http_proto - - python3 tools/boostdep/depinst/depinst.py buffers - python3 tools/boostdep/depinst/depinst.py http_proto - python3 tools/boostdep/depinst/depinst.py http_io + cp -r "$workspace_root"/buffers-root libs/buffers - uses: actions/setup-node@v4 with: @@ -1131,4 +1245,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: antora-docs-${{ matrix.name }} - path: doc/build/site + path: boost-root/libs/http_io/doc/build/site diff --git a/CMakeLists.txt b/CMakeLists.txt index a2367f4..928a2b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,108 +1,174 @@ # # Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) +# Copyright (c) 2021 Dmitry Arkhipov (grisumbras@gmail.com) +# Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com) +# Copyright (c) 2025 Mohammad Nejati # # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Official repository: https://github.com/vinniefalco/http_io +# Official repository: https://github.com/cppalliance/http_io # -cmake_minimum_required(VERSION 3.8...3.16) - +#------------------------------------------------- +# +# Project +# +#------------------------------------------------- +cmake_minimum_required(VERSION 3.8...3.20) set(BOOST_HTTP_IO_VERSION 1) -if(BOOST_SUPERPROJECT_VERSION) +if (BOOST_SUPERPROJECT_VERSION) set(BOOST_HTTP_IO_VERSION ${BOOST_SUPERPROJECT_VERSION}) -endif() - +endif () project(boost_http_io VERSION "${BOOST_HTTP_IO_VERSION}" LANGUAGES CXX) - -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) - -if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - include(CTest) - option(BOOST_HTTP_IO_BUILD_TESTS "Build boost::http_io tests" ${BUILD_TESTING}) +set(BOOST_HTTP_IO_IS_ROOT OFF) +if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(BOOST_HTTP_IO_IS_ROOT ON) -else() - set(BOOST_HTTP_IO_BUILD_TESTS ${BUILD_TESTING}) - set(BOOST_HTTP_IO_IS_ROOT OFF) -endif() +endif () +set(__ignore__ ${CMAKE_C_COMPILER}) -include(GNUInstallDirs) -if(BOOST_HTTP_IO_IS_ROOT) - set(BOOST_INCLUDE_LIBRARIES http_io http_proto program_options scope url) - set(BOOST_EXCLUDE_LIBRARIES http_io) - set(CMAKE_FOLDER Dependencies) - add_subdirectory(../.. Dependencies/boost EXCLUDE_FROM_ALL) - unset(CMAKE_FOLDER) - set(BOOST_HTTP_IO_BUILD_EXAMPLES ON) -else() - set(BOOST_HTTP_IO_BUILD_EXAMPLES OFF) -endif() +#------------------------------------------------- +# +# Options +# +#------------------------------------------------- +if (BOOST_HTTP_IO_IS_ROOT) + include(CTest) +endif () +option(BOOST_HTTP_IO_BUILD_TESTS "Build boost::http_io tests" ${BUILD_TESTING}) +option(BOOST_HTTP_IO_BUILD_EXAMPLES "Build boost::http_io examples" ${BOOST_HTTP_IO_IS_ROOT}) -function(boost_http_io_setup_properties target) - target_compile_features(${target} PUBLIC cxx_constexpr) - target_compile_definitions(${target} PUBLIC BOOST_HTTP_IO_NO_LIB=1) - if(BOOST_SUPERPROJECT_VERSION) - target_include_directories(${target} PUBLIC "${PROJECT_SOURCE_DIR}/include") - else() - target_include_directories(${target} - PUBLIC - "$" - "$" - ) - endif() +# Check if environment variable BOOST_SRC_DIR is set +if (NOT DEFINED BOOST_SRC_DIR AND DEFINED ENV{BOOST_SRC_DIR}) + set(DEFAULT_BOOST_SRC_DIR "$ENV{BOOST_SRC_DIR}") +else () + set(DEFAULT_BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") +endif () +set(BOOST_SRC_DIR ${DEFAULT_BOOST_SRC_DIR} CACHE STRING "Boost source dir to use when running CMake from this directory") - target_link_libraries(${target} - PUBLIC - Boost::asio - Boost::assert - Boost::config - Boost::http_proto - Boost::system - Boost::url +#------------------------------------------------- +# +# Boost modules +# +#------------------------------------------------- +# The boost super-project requires one explicit dependency per-line. +set(BOOST_HTTP_IO_DEPENDENCIES + Boost::asio + Boost::assert + Boost::config + Boost::http_proto + Boost::system + Boost::throw_exception ) - if(MINGW) - target_link_libraries(${target} PUBLIC ws2_32 wsock32) - endif() -endfunction() +foreach (BOOST_HTTP_IO_DEPENDENCY ${BOOST_HTTP_IO_DEPENDENCIES}) + if (BOOST_HTTP_IO_DEPENDENCY MATCHES "^[ ]*Boost::([A-Za-z0-9_]+)[ ]*$") + list(APPEND BOOST_HTTP_IO_INCLUDE_LIBRARIES ${CMAKE_MATCH_1}) + endif () +endforeach () +# Conditional dependencies +if (BOOST_HTTP_IO_BUILD_TESTS) + set(BOOST_HTTP_IO_UNIT_TEST_LIBRARIES beast url) +endif () +if (BOOST_HTTP_IO_BUILD_EXAMPLES) + set(BOOST_HTTP_IO_EXAMPLE_LIBRARIES program_options scope url) +endif () +# Complete dependency list +set(BOOST_INCLUDE_LIBRARIES ${BOOST_HTTP_IO_INCLUDE_LIBRARIES} ${BOOST_HTTP_IO_UNIT_TEST_LIBRARIES} ${BOOST_HTTP_IO_EXAMPLE_LIBRARIES}) +set(BOOST_EXCLUDE_LIBRARIES http_io) + +#------------------------------------------------- +# +# Add Boost Subdirectory +# +#------------------------------------------------- +if (BOOST_HTTP_IO_IS_ROOT) + set(CMAKE_FOLDER Dependencies) + # Find absolute BOOST_SRC_DIR + if (NOT IS_ABSOLUTE ${BOOST_SRC_DIR}) + set(BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_SRC_DIR}") + endif () + + # Validate BOOST_SRC_DIR + set(BOOST_SRC_DIR_IS_VALID ON) + foreach (F "CMakeLists.txt" "Jamroot" "boost-build.jam" "bootstrap.sh" "libs") + if (NOT EXISTS "${BOOST_SRC_DIR}/${F}") + message(STATUS "${BOOST_SRC_DIR}/${F} does not exist. Fallback to find_package.") + set(BOOST_SRC_DIR_IS_VALID OFF) + break() + endif () + endforeach () + + # Create Boost interface targets + if (BOOST_SRC_DIR_IS_VALID) + # From BOOST_SRC_DIR + if (BUILD_SHARED_LIBS) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + endif () + set(BOOST_EXCLUDE_LIBRARIES ${PROJECT_NAME}) + set(PREV_BUILD_TESTING ${BUILD_TESTING}) + set(BUILD_TESTING OFF CACHE BOOL "Build the tests." FORCE) + add_subdirectory(${BOOST_SRC_DIR} Dependencies/boost EXCLUDE_FROM_ALL) + set(BUILD_TESTING ${PREV_BUILD_TESTING} CACHE BOOL "Build the tests." FORCE) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${BOOST_SRC_DIR}/tools/cmake/include") + else () + # From Boost Package + find_package(Boost REQUIRED COMPONENTS buffers http_proto program_options scope url) + foreach (BOOST_INCLUDE_LIBRARY ${BOOST_INCLUDE_LIBRARIES}) + if (NOT TARGET Boost::${BOOST_INCLUDE_LIBRARY}) + add_library(Boost::${BOOST_INCLUDE_LIBRARY} ALIAS Boost::headers) + endif () + endforeach () + endif () + unset(CMAKE_FOLDER) +endif () -file(GLOB_RECURSE BOOST_HTTP_IO_HEADERS $<$:CONFIGURE_DEPENDS> - include/boost/*.hpp - include/boost/*.ipp - include/boost/*.natvis -) +#------------------------------------------------- +# +# Library +# +#------------------------------------------------- +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +file(GLOB_RECURSE BOOST_HTTP_IO_HEADERS CONFIGURE_DEPENDS include/boost/*.hpp include/boost/*.natvis) file(GLOB_RECURSE BOOST_HTTP_IO_SOURCES CONFIGURE_DEPENDS src/*.cpp src/*.hpp) -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_HTTP_IO_HEADERS}) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src PREFIX "http_io" FILES ${BOOST_HTTP_IO_SOURCES}) -source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES Jamfile) -add_library(boost_http_io ${BOOST_HTTP_IO_HEADERS} ${BOOST_HTTP_IO_SOURCES} build/Jamfile) -target_link_libraries(boost_http_io PUBLIC Threads::Threads) +add_library(boost_http_io ${BOOST_HTTP_IO_HEADERS} ${BOOST_HTTP_IO_SOURCES}) add_library(Boost::http_io ALIAS boost_http_io) -boost_http_io_setup_properties(boost_http_io) - -target_compile_definitions(boost_http_io - PUBLIC - BOOST_HTTP_IO_NO_LIB -) - -if(BUILD_SHARED_LIBS) - target_compile_definitions(boost_http_io PUBLIC BOOST_HTTP_IO_DYN_LINK=1) -else() - target_compile_definitions(boost_http_io PUBLIC BOOST_HTTP_IO_STATIC_LINK=1) +target_compile_features(boost_http_io PUBLIC cxx_constexpr) +target_include_directories(boost_http_io PUBLIC "${PROJECT_SOURCE_DIR}/include") +target_link_libraries(boost_http_io PUBLIC ${BOOST_HTTP_IO_DEPENDENCIES}) +find_package(Threads REQUIRED) +target_link_libraries(boost_http_io PUBLIC Threads::Threads) +if (MINGW) + target_link_libraries(boost_http_io PUBLIC ws2_32 wsock32) endif() - -if(BOOST_HTTP_IO_BUILD_TESTS) +target_compile_definitions(boost_http_io PUBLIC BOOST_HTTP_IO_NO_LIB) +target_compile_definitions(boost_http_io PRIVATE BOOST_HTTP_IO_SOURCE) +if (BUILD_SHARED_LIBS) + target_compile_definitions(boost_http_io PUBLIC BOOST_HTTP_IO_DYN_LINK) +else () + target_compile_definitions(boost_http_io PUBLIC BOOST_HTTP_IO_STATIC_LINK) +endif () + +#------------------------------------------------- +# +# Tests +# +#------------------------------------------------- +if (BOOST_HTTP_IO_BUILD_TESTS) add_subdirectory(test) -endif() +endif () -if(BOOST_HTTP_IO_BUILD_EXAMPLES) - add_subdirectory (example) -endif() +#------------------------------------------------- +# +# Examples +# +#------------------------------------------------- +if (BOOST_HTTP_IO_BUILD_EXAMPLES) + add_subdirectory(example) +endif () diff --git a/doc/mrdocs.yml b/doc/mrdocs.yml index fcda586..ecfe83b 100644 --- a/doc/mrdocs.yml +++ b/doc/mrdocs.yml @@ -25,4 +25,4 @@ verbose: true multipage: true use-system-libc: true -cmake: '-D CMAKE_CXX_STANDARD=20 -D BUILD_TESTING=ON' +cmake: '-DCMAKE_CXX_STANDARD=20 -DBOOST_HTTP_IO_BUILD_TESTS=OFF -DBOOST_HTTP_IO_BUILD_EXAMPLES=OFF' diff --git a/example/client/burl/CMakeLists.txt b/example/client/burl/CMakeLists.txt index 6ea938e..2782a43 100644 --- a/example/client/burl/CMakeLists.txt +++ b/example/client/burl/CMakeLists.txt @@ -26,10 +26,9 @@ if (CMAKE_CXX_STANDARD EQUAL 20) find_package(ZLIB) target_link_libraries(http_io_example_client_burl - Boost::http_io - Boost::http_proto - Boost::program_options - Boost::scope + boost_http_io + boost_program_options + boost_scope OpenSSL::SSL OpenSSL::Crypto) @@ -40,6 +39,6 @@ if (CMAKE_CXX_STANDARD EQUAL 20) if (ZLIB_FOUND) target_link_libraries(http_io_example_client_burl - Boost::http_proto_zlib) + boost_http_proto_zlib) endif() endif() diff --git a/example/server/CMakeLists.txt b/example/server/CMakeLists.txt index cbb9e39..05f3705 100644 --- a/example/server/CMakeLists.txt +++ b/example/server/CMakeLists.txt @@ -11,15 +11,15 @@ file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS *.cpp *.hpp CMakeLists.txt Jamfile) -source_group( TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${PFILES} ) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${PFILES}) -add_executable( http_io_server_example ${PFILES} ) +add_executable(http_io_server_example ${PFILES}) -target_compile_definitions( http_io_server_example +target_compile_definitions(http_io_server_example PRIVATE BOOST_ASIO_NO_DEPRECATED) -set_property( TARGET http_io_server_example - PROPERTY FOLDER "examples" ) +set_property(TARGET http_io_server_example + PROPERTY FOLDER "examples") target_link_libraries(http_io_server_example - Boost::http_io) + boost_http_io) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d6613f2..eb724b2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,31 +4,12 @@ # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Official repository: https://github.com/vinniefalco/http_io +# Official repository: https://github.com/cppalliance/http_io # -set(EXTRAFILES - ../../url/extra/test_main.cpp - ../../url/extra/test_suite.hpp - ) +if(NOT TARGET tests) + add_custom_target(tests) + set_property(TARGET tests PROPERTY FOLDER Dependencies) +endif() -set(PFILES - CMakeLists.txt - Jamfile - buffer.cpp - read.cpp - sandbox.cpp - write.cpp - ) - -find_package(OpenSSL REQUIRED) -source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${PFILES}) -source_group("_extra" FILES ${EXTRAFILES}) -add_executable(boost_http_io_tests ${PFILES} ${EXTRAFILES}) -target_include_directories(boost_http_io_tests PRIVATE . ../../url/extra) -target_compile_definitions(boost_http_io_tests PRIVATE BOOST_ASIO_NO_DEPRECATED) -target_link_libraries(boost_http_io_tests PRIVATE - OpenSSL::SSL - Boost::http_io) - -add_test(NAME boost_http_io_tests COMMAND boost_http_io_tests) +add_subdirectory(unit) diff --git a/test/Jamfile b/test/Jamfile index a9096f0..e401aa2 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -4,36 +4,7 @@ # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # -# Official repository: https://github.com/CPPAlliance/http_io +# Official repository: https://github.com/cppalliance/http_io # -import testing ; -import ac ; - -using openssl ; -using zlib ; - -project - : requirements - $(c11-requires) - /boost/http_proto//boost_http_proto - [ ac.check-library /openssl//ssl : /openssl//ssl ] - [ ac.check-library /zlib//zlib : /zlib//zlib : ] - [ ac.check-library /boost/http_proto//boost_http_proto_zlib : /boost/http_proto//boost_http_proto_zlib : ] - ../../url/extra/test_main.cpp - . - ../../url/extra - windows:_WIN32_WINNT=0x0601 # VFALCO? - ; - -local SOURCES = - read.cpp - sandbox.cpp - write.cpp - ; - -for local f in $(SOURCES) -{ - run $(f) : : : ; -# run $(f) : target-name $(f:B)_ ; -} +build-project unit ; diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 0000000..002881d --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,33 @@ +# +# Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) +# +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +# +# Official repository: https://github.com/cppalliance/http_io +# + +set(EXTRAFILES + ../../../url/extra/test_main.cpp + ../../../url/extra/test_suite.hpp + ) + +file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS *.cpp *.hpp) +list(APPEND PFILES + CMakeLists.txt + Jamfile + ) + +find_package(OpenSSL REQUIRED) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${PFILES}) +source_group("_extra" FILES ${EXTRAFILES}) +add_executable(boost_http_io_tests ${PFILES} ${EXTRAFILES}) +target_include_directories(boost_http_io_tests PRIVATE . ../../../url/extra) +target_link_libraries(boost_http_io_tests PRIVATE + OpenSSL::SSL + boost_beast + boost_http_io + ) + +add_test(NAME boost_http_io_tests COMMAND boost_http_io_tests) +add_dependencies(tests boost_http_io_tests) diff --git a/test/unit/Jamfile b/test/unit/Jamfile new file mode 100644 index 0000000..1365d16 --- /dev/null +++ b/test/unit/Jamfile @@ -0,0 +1,45 @@ +# +# Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) +# +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +# +# Official repository: https://github.com/cppalliance/http_io +# + +import testing ; +import ac ; + +using openssl ; + +project + : requirements + $(c11-requires) + /boost/http_io//boost_http_io + /boost/beast//boost_beast/off + [ ac.check-library /openssl//ssl/off : /openssl//ssl/off : ] + [ ac.check-library /boost/http_proto//boost_http_proto_zlib/off : /boost/http_proto//boost_http_proto_zlib/off : ] + ../../../url/extra/test_main.cpp + . + ../../../url/extra + extra + on + darwin,norecover:static + windows:_WIN32_WINNT=0x0601 + msvc:_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING + msvc:_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING + msvc:_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING + ; + +local SOURCES = + buffer.cpp + read.cpp + sandbox.cpp + write.cpp + ; + +for local f in $(SOURCES) +{ + run $(f) : : : ; +# run $(f) : target-name $(f:B)_ ; +} diff --git a/test/unit/beast.cpp b/test/unit/beast.cpp new file mode 100644 index 0000000..5117443 --- /dev/null +++ b/test/unit/beast.cpp @@ -0,0 +1,3 @@ +// Temporary include to ensure depinst.py recognizes Boost.Beast as a dependency. +// This can be removed once proper tests are in place. +#include diff --git a/test/buffer.cpp b/test/unit/buffer.cpp similarity index 100% rename from test/buffer.cpp rename to test/unit/buffer.cpp diff --git a/test/read.cpp b/test/unit/read.cpp similarity index 100% rename from test/read.cpp rename to test/unit/read.cpp diff --git a/test/sandbox.cpp b/test/unit/sandbox.cpp similarity index 100% rename from test/sandbox.cpp rename to test/unit/sandbox.cpp diff --git a/test/write.cpp b/test/unit/write.cpp similarity index 100% rename from test/write.cpp rename to test/unit/write.cpp