From 5fee6145a2b402bf1bd37cd3280d19b9fea69b2e Mon Sep 17 00:00:00 2001 From: 5cript Date: Thu, 19 Sep 2024 01:45:36 +0200 Subject: [PATCH 1/2] Updated code for new asio. --- include/roar/client.hpp | 1 + include/roar/routing/proto_route.hpp | 6 +++--- src/roar/CMakeLists.txt | 7 ++++++- src/roar/websocket/websocket_client.cpp | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/roar/client.hpp b/include/roar/client.hpp index 0df3753e..0d50cff3 100644 --- a/include/roar/client.hpp +++ b/include/roar/client.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/include/roar/routing/proto_route.hpp b/include/roar/routing/proto_route.hpp index a8cf1c80..433ad50d 100644 --- a/include/roar/routing/proto_route.hpp +++ b/include/roar/routing/proto_route.hpp @@ -17,13 +17,13 @@ namespace Roar struct RouteOptions { /// If the server is an https server, setting this to true will allow unencrypted requests on this route. - bool allowUnsecure; + bool allowUnsecure = false; /// Set this to true if you expect a websocket upgrade request on this route. - bool expectUpgrade; + bool expectUpgrade = false; /// Set this to provide automatically generated cors headers and preflight requests. - std::optional cors; + std::optional cors = std::nullopt; }; namespace Detail diff --git a/src/roar/CMakeLists.txt b/src/roar/CMakeLists.txt index 116db63a..3ad37b78 100644 --- a/src/roar/CMakeLists.txt +++ b/src/roar/CMakeLists.txt @@ -51,7 +51,12 @@ set_target_warnings(roar) if(${ROAR_ENABLE_NLOHMANN_JSON}) target_link_libraries(roar PUBLIC nlohmann_json::nlohmann_json) - target_compile_definitions(roar PUBLIC ROAR_ENABLE_NLOHMANN_JSON=1 BOOST_ASIO_DISABLE_CONCEPTS) + target_compile_definitions(roar PUBLIC ROAR_ENABLE_NLOHMANN_JSON=1) +endif() + +if (${Boost_VERSION_MAJOR} GREATER_EQUAL 1 AND ${Boost_VERSION_MINOR} GREATER_EQUAL 84) +else() + target_compile_definitions(roar PUBLIC BOOST_ASIO_DISABLE_CONCEPTS=1) endif() if(WIN32) diff --git a/src/roar/websocket/websocket_client.cpp b/src/roar/websocket/websocket_client.cpp index 3a0567aa..f8153023 100644 --- a/src/roar/websocket/websocket_client.cpp +++ b/src/roar/websocket/websocket_client.cpp @@ -157,7 +157,7 @@ namespace Roar endpointIterator, [self = shared_from_this(), timeout = std::move(connectParameters.timeout), - host = connectParameters.host](auto ec, auto const& endpoint) { + host = connectParameters.host](auto ec, boost::asio::ip::tcp::resolver::results_type::endpoint_type const& endpoint) { self->impl_->onConnect(ec, endpoint, timeout, std::move(host), self); }); }, From e43cb65f631c94c61a155d573f45b73d49052d7c Mon Sep 17 00:00:00 2001 From: Tim Ebbeke Date: Thu, 19 Sep 2024 01:54:09 +0200 Subject: [PATCH 2/2] Fixed pipeline boost root env. --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 79f29c4c..c5b37dd0 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -43,7 +43,7 @@ jobs: - name: Configure CMake run: cmake -B ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DROAR_BUILD_TESTS=on -DCMAKE_CXX_EXTENSIONS=on -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=lld -DCMAKE_CXX_STANDARD=20 env: - BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + Boost_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} - name: Build run: cmake --build ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}} @@ -90,7 +90,7 @@ jobs: -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_STANDARD=20 env: - BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + Boost_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} - name: Build run: cmake --build ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}}