From 61bb8b7702b8f2d4f42f89a2837b8c355757628e Mon Sep 17 00:00:00 2001 From: Gregory Robertson Date: Sun, 11 Dec 2022 17:29:38 -0500 Subject: [PATCH 1/2] Fix websocketpp incompliance with C++20 --- extern/websocketpp/websocketpp/endpoint.hpp | 2 +- extern/websocketpp/websocketpp/logger/basic.hpp | 14 +++++++------- .../websocketpp/roles/server_endpoint.hpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/extern/websocketpp/websocketpp/endpoint.hpp b/extern/websocketpp/websocketpp/endpoint.hpp index c124b1d9ab..9ce8a62614 100644 --- a/extern/websocketpp/websocketpp/endpoint.hpp +++ b/extern/websocketpp/websocketpp/endpoint.hpp @@ -109,7 +109,7 @@ class endpoint : public config::transport_type, public config::endpoint_base { /// Destructor - ~endpoint() {} + ~endpoint() {} #ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_ // no copy constructor because endpoints are not copyable diff --git a/extern/websocketpp/websocketpp/logger/basic.hpp b/extern/websocketpp/websocketpp/logger/basic.hpp index 84514130e7..4c9d836493 100644 --- a/extern/websocketpp/websocketpp/logger/basic.hpp +++ b/extern/websocketpp/websocketpp/logger/basic.hpp @@ -58,33 +58,33 @@ namespace log { template class basic { public: - basic(channel_type_hint::value h = + basic(channel_type_hint::value h = channel_type_hint::access) : m_static_channels(0xffffffff) , m_dynamic_channels(0) , m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {} - basic(std::ostream * out) + basic(std::ostream * out) : m_static_channels(0xffffffff) , m_dynamic_channels(0) , m_out(out) {} - basic(level c, channel_type_hint::value h = + basic(level c, channel_type_hint::value h = channel_type_hint::access) : m_static_channels(c) , m_dynamic_channels(0) , m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {} - basic(level c, std::ostream * out) + basic(level c, std::ostream * out) : m_static_channels(c) , m_dynamic_channels(0) , m_out(out) {} /// Destructor - ~basic() {} + ~basic() {} /// Copy constructor - basic(basic const & other) + basic(basic const & other) : m_static_channels(other.m_static_channels) , m_dynamic_channels(other.m_dynamic_channels) , m_out(other.m_out) @@ -97,7 +97,7 @@ class basic { #ifdef _WEBSOCKETPP_MOVE_SEMANTICS_ /// Move constructor - basic(basic && other) + basic(basic && other) : m_static_channels(other.m_static_channels) , m_dynamic_channels(other.m_dynamic_channels) , m_out(other.m_out) diff --git a/extern/websocketpp/websocketpp/roles/server_endpoint.hpp b/extern/websocketpp/websocketpp/roles/server_endpoint.hpp index 9cc652f75c..64e8cd1034 100644 --- a/extern/websocketpp/websocketpp/roles/server_endpoint.hpp +++ b/extern/websocketpp/websocketpp/roles/server_endpoint.hpp @@ -72,11 +72,11 @@ class server : public endpoint,config> { } /// Destructor - ~server() {} + ~server() {} #ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_ // no copy constructor because endpoints are not copyable - server(server &) = delete; + server(server &) = delete; // no copy assignment operator because endpoints are not copyable server & operator=(server const &) = delete; From 4aa49764a47345afeff5a312e58837ea2b310353 Mon Sep 17 00:00:00 2001 From: Gregory Robertson Date: Tue, 13 Dec 2022 06:36:12 -0500 Subject: [PATCH 2/2] Update websocketpp to 0.8.2 with c++20 compliance fix --- extern/CMakeLists.txt | 3 + extern/websocketpp/CMakeLists.txt | 285 +++++++++++++++++- extern/websocketpp/Doxyfile | 2 +- extern/websocketpp/changelog.md | 12 + extern/websocketpp/cmake/CMakeHelpers.cmake | 2 +- extern/websocketpp/docs/faq.dox | 2 +- .../print_client_tls/print_client_tls.cpp | 6 +- extern/websocketpp/readme.md | 2 +- .../websocketpp/roles/server_endpoint.hpp | 2 +- .../websocketpp/transport/asio/connection.hpp | 10 +- .../websocketpp/transport/asio/endpoint.hpp | 10 +- .../transport/asio/security/none.hpp | 3 +- .../transport/asio/security/tls.hpp | 3 +- extern/websocketpp/websocketpp/version.hpp | 4 +- 14 files changed, 317 insertions(+), 29 deletions(-) diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 89ca138735..8d7651627c 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -28,6 +28,9 @@ add_subdirectory(SQLiteCpp) ## websocketpp add_subdirectory(asio-1.12.2) # Only required for websocketpp add_subdirectory(websocketpp) +add_library(websocketpp INTERFACE) +target_include_directories(websocketpp INTERFACE websocketpp) +target_link_libraries(websocketpp INTERFACE asio) ## discord-rpc set(CLANG_FORMAT_CMD OFF CACHE BOOL "" FORCE) # Disable discord clang-format diff --git a/extern/websocketpp/CMakeLists.txt b/extern/websocketpp/CMakeLists.txt index c10560cb0e..4f93e243a1 100644 --- a/extern/websocketpp/CMakeLists.txt +++ b/extern/websocketpp/CMakeLists.txt @@ -1,3 +1,282 @@ -add_library(websocketpp INTERFACE) -target_include_directories(websocketpp INTERFACE .) -target_link_libraries(websocketpp INTERFACE asio) \ No newline at end of file + +############ Setup project and cmake +# Minimum cmake requirement. We should require a quite recent +# cmake for the dependency find macros etc. to be up to date. +cmake_minimum_required (VERSION 2.8.8) + +############ Paths + +set (WEBSOCKETPP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) +set (WEBSOCKETPP_INCLUDE ${WEBSOCKETPP_ROOT}/websocketpp) +set (WEBSOCKETPP_BUILD_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set (WEBSOCKETPP_BIN ${WEBSOCKETPP_BUILD_ROOT}/bin) +set (WEBSOCKETPP_LIB ${WEBSOCKETPP_BUILD_ROOT}/lib) + +# CMake install step prefix. I assume linux users want the prefix to +# be the default /usr or /usr/local so this is only adjusted on Windows. +# This must be set prior to any call to project or it will not be read correctly. +# - Windows: Build the INSTALL project in your solution file. +# - Linux/OSX: make install. +if (WIN32) + set (CMAKE_INSTALL_PREFIX "${WEBSOCKETPP_ROOT}/install" CACHE PATH "") +endif () + +############ Project name and version +set (WEBSOCKETPP_MAJOR_VERSION 0) +set (WEBSOCKETPP_MINOR_VERSION 8) +set (WEBSOCKETPP_PATCH_VERSION 2) +set (WEBSOCKETPP_VERSION ${WEBSOCKETPP_MAJOR_VERSION}.${WEBSOCKETPP_MINOR_VERSION}.${WEBSOCKETPP_PATCH_VERSION}) + +if(POLICY CMP0048) + cmake_policy(GET CMP0048 _version_policy) +endif() + +if(_version_allowed STREQUAL NEW) + project (websocketpp VERSION ${WEBSOCKETPP_VERSION}) +else() + project (websocketpp) +endif() + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files") +if (WIN32 AND NOT CYGWIN) + set (DEF_INSTALL_CMAKE_DIR cmake) +else () + set (DEF_INSTALL_CMAKE_DIR lib/cmake/websocketpp) +endif () +set (INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") + +# Make relative paths absolute (needed later on) +foreach (p INCLUDE CMAKE) + set (var INSTALL_${p}_DIR) + if (NOT IS_ABSOLUTE "${${var}}") + set (${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") + endif () +endforeach () + +# Set CMake library search policy +if (COMMAND cmake_policy) + cmake_policy (SET CMP0003 NEW) + cmake_policy (SET CMP0005 NEW) +endif () + +# Disable unnecessary build types +set (CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo;Debug" CACHE STRING "Configurations" FORCE) + +# Include our cmake macros +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +include (CMakeHelpers) + + +############ Build customization + +# Override from command line "CMake -D