Füge Unterstützung für Würfelspiele hinzu und verbessere Debugging-Optionen

- Implementiere neue Funktionen in der ChatRoom-Klasse für das Starten, Rollen und Beenden von Würfelspielen.
- Füge eine Option zur Aktivierung von Debug-Logging in CMake hinzu, um die Entwicklung zu erleichtern.
- Aktualisiere die ChatUser-Klasse, um die Interaktion mit dem Würfelspiel zu ermöglichen.
- Verbessere die Socket-Verwaltung im Server, um WebSocket-Verbindungen zu unterstützen und die Handhabung von Anfragen zu optimieren.
- Aktualisiere die Konfiguration, um die neue Funktionalität zu unterstützen und die Benutzererfahrung zu verbessern.
This commit is contained in:
Torsten Schulz (local)
2025-08-16 22:43:08 +02:00
parent 864d86aa09
commit 7338f1a740
15 changed files with 1556 additions and 135 deletions

View File

@@ -5,6 +5,11 @@ project(YourChat VERSION 0.1)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include_directories(${PROJECT_SOURCE_DIR}/src)
# Option to enable debug logging (guards [Debug] prints)
option(YC_DEBUG "Enable YourChat debug logging" OFF)
message(STATUS "YC_DEBUG option: ${YC_DEBUG}")
add_executable(yourchat
src/main.cpp
src/lib/base.cpp
@@ -18,3 +23,22 @@ include_directories(${PROJECT_SOURCE_DIR}/src)
src/object/room.cpp
)
target_link_libraries(yourchat jsoncpp pthread pqxx)
if(YC_DEBUG)
message(STATUS "YC_DEBUG enabled: defining YC_DEBUG=1, enabling Debug build and verbose makefiles")
# Ensure Debug build type for better symbols/optimizations settings
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE)
# Show full compile/link commands to verify -DYC_DEBUG in use
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Verbose Makefile" FORCE)
# Export compile_commands.json for tooling
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Export compile_commands.json" FORCE)
target_compile_definitions(yourchat PRIVATE YC_DEBUG=1)
endif()
# Link OpenSSL for WebSocket handshake helpers
find_package(OpenSSL REQUIRED)
target_link_libraries(yourchat OpenSSL::SSL OpenSSL::Crypto)
add_executable(ws_probe tools/ws_probe.cpp)
target_compile_features(ws_probe PRIVATE cxx_std_17)
target_link_libraries(ws_probe pthread)