From e114f905adc0788447a6e4cc7184086beb54d9e3 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 27 Feb 2025 14:54:52 -0600 Subject: [PATCH] updated build system --- cmake/versions.cmake | 10 ++-- support/include/utils/config.hpp | 7 +++ support/include/utils/error.hpp | 18 +++--- support/src/utils/error.cpp | 78 -------------------------- support/src/utils/error_handler.cpp | 85 ++++++++++++++++++++++++++++- 5 files changed, 104 insertions(+), 94 deletions(-) diff --git a/cmake/versions.cmake b/cmake/versions.cmake index 61c7be1..d57d39e 100644 --- a/cmake/versions.cmake +++ b/cmake/versions.cmake @@ -1,15 +1,15 @@ set(BINUTILS_VERSION 2.43) -set(BOOST2_MAJOR_VERSION 1) -set(BOOST2_MINOR_VERSION 76) -set(BOOST2_PATCH_VERSION 0) set(BOOST_MAJOR_VERSION 1) set(BOOST_MINOR_VERSION 87) set(BOOST_PATCH_VERSION 0) +set(BOOST2_MAJOR_VERSION 1) +set(BOOST2_MINOR_VERSION 76) +set(BOOST2_PATCH_VERSION 0) set(CPP_HTTPLIB_VERSION 0.18.1) -set(CURL2_VERSION 8_11_0) set(CURL_VERSION 8.11.0) -set(EXPAT2_VERSION 2_6_4) +set(CURL2_VERSION 8_11_0) set(EXPAT_VERSION 2.6.4) +set(EXPAT2_VERSION 2_6_4) set(GCC_VERSION 14.2.0) set(GTEST_VERSION 1.15.2) set(ICU_VERSION 76-1) diff --git a/support/include/utils/config.hpp b/support/include/utils/config.hpp index ac59ec2..8aaf4ab 100644 --- a/support/include/utils/config.hpp +++ b/support/include/utils/config.hpp @@ -399,6 +399,13 @@ using vlc_string_t = std::unique_ptr; #include "spdlog/spdlog.h" #endif // defined(PROJECT_ENABLE_SPDLOG) +#if defined(PROJECT_ENABLE_FMT) +#include "fmt/chrono.h" +#include "fmt/core.h" +#include "fmt/format.h" +#include "fmt/ranges.h" +#endif // defined(PROJECT_ENABLE_FMT) + #if defined(PROJECT_ENABLE_STDUUID) #include "uuid.h" #endif // defined(PROJECT_ENABLE_STDUUID) diff --git a/support/include/utils/error.hpp b/support/include/utils/error.hpp index 642b4c3..9194912 100644 --- a/support/include/utils/error.hpp +++ b/support/include/utils/error.hpp @@ -131,15 +131,6 @@ inline const spdlog_exception_handler default_exception_handler{}; inline const iostream_exception_handler default_exception_handler{}; #endif // defined(PROJECT_ENABLE_SPDLOG) && defined(PROJECT_ENABLE_V2_ERRORS) -#if defined(PROJECT_ENABLE_TESTING) -extern std::atomic exception_handler; - -[[nodiscard]] inline auto get_exception_handler() - -> const i_exception_handler * { - return exception_handler; -} -#endif // defined(PROJECT_ENABLE_TESTING) - #if defined(PROJECT_ENABLE_V2_ERRORS) void handle_debug(std::string_view function_name, std::string_view msg); #endif // defined(PROJECT_ENABLE_V2_ERRORS) @@ -159,6 +150,15 @@ void handle_warn(std::string_view function_name, std::string_view msg); #endif // defined(PROJECT_ENABLE_V2_ERRORS) void set_exception_handler(const i_exception_handler *handler); + +#if defined(PROJECT_ENABLE_TESTING) +extern std::atomic exception_handler; + +[[nodiscard]] inline auto get_exception_handler() + -> const i_exception_handler * { + return exception_handler; +} +#endif // defined(PROJECT_ENABLE_TESTING) } // namespace monitarr::utils::error #endif // MONITARR_INCLUDE_UTILS_ERROR_HPP_ diff --git a/support/src/utils/error.cpp b/support/src/utils/error.cpp index 8552a6d..e34a1fe 100644 --- a/support/src/utils/error.cpp +++ b/support/src/utils/error.cpp @@ -47,82 +47,4 @@ auto create_exception(std::string_view function_name, return std::runtime_error(create_error_message(function_name, items)); } -#if defined(PROJECT_ENABLE_V2_ERRORS) -void handle_debug(std::string_view function_name, std::string_view msg) { - const i_exception_handler *handler{exception_handler}; - if (handler != nullptr) { - handler->handle_debug(function_name, msg); - return; - } - - default_exception_handler.handle_debug(function_name, msg); -} -#endif // defined(PROJECT_ENABLE_V2_ERRORS) - -void handle_error(std::string_view function_name, std::string_view msg) { - const i_exception_handler *handler{exception_handler}; - if (handler != nullptr) { - handler->handle_error(function_name, msg); - return; - } - - default_exception_handler.handle_error(function_name, msg); -} - -void handle_exception(std::string_view function_name) { - const i_exception_handler *handler{exception_handler}; - if (handler != nullptr) { - handler->handle_exception(function_name); - return; - } - - default_exception_handler.handle_exception(function_name); -} - -void handle_exception(std::string_view function_name, - const std::exception &ex) { - const i_exception_handler *handler{exception_handler}; - if (handler != nullptr) { - handler->handle_exception(function_name, ex); - return; - } - - default_exception_handler.handle_exception(function_name, ex); -} - -#if defined(PROJECT_ENABLE_V2_ERRORS) -void handle_info(std::string_view function_name, std::string_view msg) { - const i_exception_handler *handler{exception_handler}; - if (handler != nullptr) { - handler->handle_info(function_name, msg); - return; - } - - default_exception_handler.handle_info(function_name, msg); -} - -void handle_trace(std::string_view function_name, std::string_view msg) { - const i_exception_handler *handler{exception_handler}; - if (handler != nullptr) { - handler->handle_trace(function_name, msg); - return; - } - - default_exception_handler.handle_trace(function_name, msg); -} - -void handle_warn(std::string_view function_name, std::string_view msg) { - const i_exception_handler *handler{exception_handler}; - if (handler != nullptr) { - handler->handle_warn(function_name, msg); - return; - } - - default_exception_handler.handle_warn(function_name, msg); -} -#endif // defined(PROJECT_ENABLE_V2_ERRORS) - -void set_exception_handler(const i_exception_handler *handler) { - exception_handler = handler; -} } // namespace monitarr::utils::error diff --git a/support/src/utils/error_handler.cpp b/support/src/utils/error_handler.cpp index 1f08cf7..b87538c 100644 --- a/support/src/utils/error_handler.cpp +++ b/support/src/utils/error_handler.cpp @@ -19,12 +19,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "utils/config.hpp" #include "utils/error.hpp" +#include "utils/config.hpp" + namespace monitarr::utils::error { std::atomic exception_handler{ - &default_exception_handler}; + &default_exception_handler, +}; #if defined(PROJECT_ENABLE_V2_ERRORS) void iostream_exception_handler::handle_debug(std::string_view function_name, @@ -238,4 +240,83 @@ void spdlog_exception_handler::handle_warn(std::string_view function_name, file->warn(utils::error::create_error_message(function_name, {msg})); } #endif // defined(PROJECT_ENABLE_SPDLOG) && defined(PROJECT_ENABLE_V2_ERRORS) + +#if defined(PROJECT_ENABLE_V2_ERRORS) +void handle_debug(std::string_view function_name, std::string_view msg) { + const i_exception_handler *handler{exception_handler}; + if (handler != nullptr) { + handler->handle_debug(function_name, msg); + return; + } + + default_exception_handler.handle_debug(function_name, msg); +} +#endif // defined(PROJECT_ENABLE_V2_ERRORS) + +void handle_error(std::string_view function_name, std::string_view msg) { + const i_exception_handler *handler{exception_handler}; + if (handler != nullptr) { + handler->handle_error(function_name, msg); + return; + } + + default_exception_handler.handle_error(function_name, msg); +} + +void handle_exception(std::string_view function_name) { + const i_exception_handler *handler{exception_handler}; + if (handler != nullptr) { + handler->handle_exception(function_name); + return; + } + + default_exception_handler.handle_exception(function_name); +} + +void handle_exception(std::string_view function_name, + const std::exception &ex) { + const i_exception_handler *handler{exception_handler}; + if (handler != nullptr) { + handler->handle_exception(function_name, ex); + return; + } + + default_exception_handler.handle_exception(function_name, ex); +} + +#if defined(PROJECT_ENABLE_V2_ERRORS) +void handle_info(std::string_view function_name, std::string_view msg) { + const i_exception_handler *handler{exception_handler}; + if (handler != nullptr) { + handler->handle_info(function_name, msg); + return; + } + + default_exception_handler.handle_info(function_name, msg); +} + +void handle_trace(std::string_view function_name, std::string_view msg) { + const i_exception_handler *handler{exception_handler}; + if (handler != nullptr) { + handler->handle_trace(function_name, msg); + return; + } + + default_exception_handler.handle_trace(function_name, msg); +} + +void handle_warn(std::string_view function_name, std::string_view msg) { + const i_exception_handler *handler{exception_handler}; + if (handler != nullptr) { + handler->handle_warn(function_name, msg); + return; + } + + default_exception_handler.handle_warn(function_name, msg); +} +#endif // defined(PROJECT_ENABLE_V2_ERRORS) + +void set_exception_handler(const i_exception_handler *handler) { + exception_handler = handler; +} } // namespace monitarr::utils::error