Some fixes and work

This commit is contained in:
Xaymar
2026-01-18 04:00:55 +01:00
parent 7a0a7260f5
commit 5aa3af4c67
5 changed files with 78 additions and 11 deletions
+47 -8
View File
@@ -11,11 +11,22 @@ include(cmake/externalcontent/ExternalContent.cmake)
#--------------------------------------------------------------------------------#
set(CACHE{ENABLE_SSL} TYPE BOOL HELP "Enable SSL support via wolfSSL?" VALUE ON)
set(CACHE{ENABLE_COMPRESSION} TYPE BOOL HELP "Enable support for compression?" VALUE ON)
#--------------------------------------------------------------------------------#
# Libraries
#--------------------------------------------------------------------------------#
if(TRUE) # Database support
## PostGreSQL
# Depends on massive mono-repo project that we don't have the time to investigate now.
find_package("libpqxx" OPTIONAL)
## MariaDB
# Depends on massive mono-repo project that we don't have the time to investigate now.
find_package("libmariadb" OPTIONAL)
endif()
if(TRUE) # ASIO (Standalone)
ExternalContent(
NAME "asio"
@@ -58,12 +69,27 @@ if(TRUE) # nlohmann's JSON
endif()
if(TRUE) # badaix's JSONRPC++
#!TODO: Replace with our own, this implementation isn't compliant with C++ standards at all.
function(jsonrpcpp_patch)
if(EXTERNALCONTENT_DOWNLOAD_DIRTY)
file(GLOB_RECURSE _PATCHES FOLLOW_SYMLINKS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/patches/badaix-jsonrpcpp/*")
execute_process(
COMMAND "git" "apply" "${_PATCHES}"
WORKING_DIRECTORY "${EXTERNALCONTENT_SOURCE_PATH}"
COMMAND_ECHO STDOUT
)
set(_EC_PATCH_DIRTY ON)
endif()
endfunction()
ExternalContent(
NAME "jsonrpcpp"
GIT_URL "https://github.com/badaix/jsonrpcpp.git"
GIT_REF "v1.4.0"
GIT_CLONE_OPTIONS --depth 1 --no-single-branch --recurse-submodules
GIT_CHECKOUT_OPTIONS --recurse-submodules
PATCH_FUNCTION jsonrpcpp_patch
CONFIGURE_ARGS -D BUILD_EXAMPLE:BOOL=OFF -D BUILD_TESTS:BOOL=OFF -D CATCH_INSTALL_DOCS:BOOL=OFF -D CATCH_INSTALL_EXTRAS:BOOL=ON
BUILD_ARGS --parallel --config Release --clean-first
)
@@ -71,13 +97,16 @@ if(TRUE) # badaix's JSONRPC++
# This doesn't have a proper CMake module yet.
if(NOT TARGET jsonrpcpp)
add_library("jsonrpcpp" INTERFACE)
file(GLOB_RECURSE _FILES FOLLOW_SYMLINKS CONFIGURE_DEPENDS "${badaix-jsonrpc_SOURCE_PATH}/include/*")
source_group(TREE "${badaix-jsonrpc_SOURCE_PATH}/include" PREFIX "" FILES ${_FILES})
file(GLOB_RECURSE _FILES FOLLOW_SYMLINKS CONFIGURE_DEPENDS "${jsonrpcpp_SOURCE_PATH}/include/*")
source_group(TREE "${jsonrpcpp_SOURCE_PATH}/include" PREFIX "" FILES ${_FILES})
target_sources("jsonrpcpp"
PRIVATE ${_FILES}
)
target_include_directories("jsonrpcpp"
INTERFACE "${jsonrpcpp}/include"
INTERFACE "${jsonrpcpp_INSTALL_PATH}/include"
)
target_link_libraries("jsonrpcpp"
INTERFACE "nlohmann_json::nlohmann_json"
)
endif()
if(NOT TARGET badaix::jsonrpcpp)
@@ -115,11 +144,20 @@ if(ENABLE_SSL) # wolfssl
)
endif()
if(TRUE) # Database support
# PostGreSQL
find_package("libpqxx" OPTIONAL)
# MariaDB
find_package("libmariadb" OPTIONAL)
if(ENABLE_COMPRESSION) # Compression support
# zlib-ng - zlib, but for modern systems
ExternalContent(
NAME "zlib-ng"
GIT_URL "https://github.com/zlib-ng/zlib-ng.git"
GIT_REF "2.3.2"
GIT_CLONE_OPTIONS --depth 1 --no-single-branch --recurse-submodules
GIT_CHECKOUT_OPTIONS --recurse-submodules
CONFIGURE_ARGS -D BUILD_SHARED_LIBS:BOOL=OFF -D CMAKE_C_STANDARD:STRING=17 -D BUILD_TESTING:BOOL=OFF -D WITH_GTEST:BOOL=OFF -D WITH_FUZZERS:BOOL=OFF -D WITH_BENCHMARKS:BOOL=OFF -D WITH_BENCHMARK_APPS:BOOL=OFF -D INSTALL_UTILS:BOOL=OFF
BUILD_ARGS --parallel --config Release --clean-first
)
find_package("zlib-ng" REQUIRED CONFIG
PATHS "${zlib-ng_INSTALL_PATH}"
)
endif()
#--------------------------------------------------------------------------------#
@@ -155,6 +193,7 @@ target_link_libraries("room-server"
nlohmann_json::nlohmann_json
badaix::jsonrpcpp
websocketpp::websocketpp
zlib-ng::zlib
)
set_target_properties("room-server" PROPERTIES
@@ -0,0 +1,27 @@
From 344c9b970ecf8e66c3e89f5c4a4d2b9106b5486e Mon Sep 17 00:00:00 2001
From: Xaymar <info@xaymar.com>
Date: Sun, 18 Jan 2026 03:53:06 +0100
Subject: [PATCH] Use actual nlohmann/json.hpp include
---
include/json.hpp | 24765 ----------------------------------------
include/jsonrpcpp.hpp | 2 +-
1 files changed, 1 insertion(+), 1 deletions(-)
delete mode 100644 include/json.hpp
diff --git a/include/jsonrpcpp.hpp b/include/jsonrpcpp.hpp
index 1cea0ac..236850c 100644
--- a/include/jsonrpcpp.hpp
+++ b/include/jsonrpcpp.hpp
@@ -23,7 +23,7 @@
#define JSON_RPC_HPP
// nlohmann-json
-#include <json.hpp>
+#include <nlohmann/json.hpp>
// standard headers
#include <cstring>
--
2.48.1.windows.1
+2 -2
View File
@@ -30,8 +30,8 @@ int32_t apsr::manager::run(int argc, char** argv)
{
// Spawn threads to handle all ASIO workload.
//!TODO: Make this a command line or environment option.
return 0;
}
+1 -1
View File
@@ -17,7 +17,7 @@
// JSON and JSON-RPC 2.0
#include <nlohmann/json.hpp>
#include <badaix/jsonrpcpp.hpp>
#include <jsonrpcpp/jsonrpcpp.hpp>
// WebSocket Client
#include <websocketpp/config/asio_no_tls_client.hpp>
+1
View File
@@ -10,3 +10,4 @@
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/
m