updated build system

This commit is contained in:
Scott E. Graves 2025-02-20 14:46:14 -06:00
parent 2e17674182
commit 797036612a
3 changed files with 54 additions and 20 deletions

View File

@ -358,6 +358,7 @@ echo " Company name: ${PROJECT_COMPANY_NAME}"
echo " Copyright: ${PROJECT_COPYRIGHT}" echo " Copyright: ${PROJECT_COPYRIGHT}"
echo " Description: ${PROJECT_DESC}" echo " Description: ${PROJECT_DESC}"
echo " Dist dir: ${PROJECT_DIST_DIR}" echo " Dist dir: ${PROJECT_DIST_DIR}"
echo " Enable v2 errors: ${PROJECT_ENABLE_V2_ERRORS}"
echo " External build root: ${PROJECT_EXTERNAL_BUILD_ROOT}" echo " External build root: ${PROJECT_EXTERNAL_BUILD_ROOT}"
echo " File part: ${PROJECT_FILE_PART}" echo " File part: ${PROJECT_FILE_PART}"
echo " Is ARM64: ${PROJECT_IS_ARM64}" echo " Is ARM64: ${PROJECT_IS_ARM64}"

View File

@ -119,6 +119,9 @@ struct spdlog_exception_handler final : public i_exception_handler {
void handle_warn(std::string_view function_name, void handle_warn(std::string_view function_name,
std::string_view msg) const override; std::string_view msg) const override;
private:
iostream_exception_handler fallback{};
}; };
#endif // defined(PROJECT_ENABLE_SPDLOG) && defined(PROJECT_ENABLE_V2_ERRORS) #endif // defined(PROJECT_ENABLE_SPDLOG) && defined(PROJECT_ENABLE_V2_ERRORS)

View File

@ -105,8 +105,12 @@ void iostream_exception_handler::handle_warn(std::string_view function_name,
#if defined(PROJECT_ENABLE_SPDLOG) && defined(PROJECT_ENABLE_V2_ERRORS) #if defined(PROJECT_ENABLE_SPDLOG) && defined(PROJECT_ENABLE_V2_ERRORS)
void spdlog_exception_handler::handle_debug(std::string_view function_name, void spdlog_exception_handler::handle_debug(std::string_view function_name,
std::string_view msg) const { std::string_view msg) const {
spdlog::get("console")->debug( auto console = spdlog::get("console");
utils::error::create_error_message(function_name, {msg})); if (console) {
console->debug(utils::error::create_error_message(function_name, {msg}));
} else {
fallback.handle_debug(function_name, msg);
}
auto file = spdlog::get("file"); auto file = spdlog::get("file");
if (not file) { if (not file) {
@ -118,8 +122,12 @@ void spdlog_exception_handler::handle_debug(std::string_view function_name,
void spdlog_exception_handler::handle_error(std::string_view function_name, void spdlog_exception_handler::handle_error(std::string_view function_name,
std::string_view msg) const { std::string_view msg) const {
spdlog::get("console")->error( auto console = spdlog::get("console");
utils::error::create_error_message(function_name, {msg})); if (console) {
console->error(utils::error::create_error_message(function_name, {msg}));
} else {
fallback.handle_error(function_name, msg);
}
auto file = spdlog::get("file"); auto file = spdlog::get("file");
if (not file) { if (not file) {
@ -131,11 +139,16 @@ void spdlog_exception_handler::handle_error(std::string_view function_name,
void spdlog_exception_handler::handle_exception( void spdlog_exception_handler::handle_exception(
std::string_view function_name) const { std::string_view function_name) const {
spdlog::get("console")->error( auto console = spdlog::get("console");
utils::error::create_error_message(function_name, { if (console) {
"exception", console->error(utils::error::create_error_message(function_name,
"unknown exception", {
})); "exception",
"unknown exception",
}));
} else {
fallback.handle_exception(function_name);
}
auto file = spdlog::get("file"); auto file = spdlog::get("file");
if (not file) { if (not file) {
@ -151,11 +164,16 @@ void spdlog_exception_handler::handle_exception(
void spdlog_exception_handler::handle_exception( void spdlog_exception_handler::handle_exception(
std::string_view function_name, const std::exception &ex) const { std::string_view function_name, const std::exception &ex) const {
spdlog::get("console")->error(utils::error::create_error_message( auto console = spdlog::get("console");
function_name, { if (console) {
"exception", console->error(utils::error::create_error_message(
(ex.what() == nullptr ? "unknown" : ex.what()), function_name, {
})); "exception",
(ex.what() == nullptr ? "unknown" : ex.what()),
}));
} else {
fallback.handle_exception(function_name, ex);
}
auto file = spdlog::get("file"); auto file = spdlog::get("file");
if (not file) { if (not file) {
@ -171,8 +189,12 @@ void spdlog_exception_handler::handle_exception(
void spdlog_exception_handler::handle_info(std::string_view function_name, void spdlog_exception_handler::handle_info(std::string_view function_name,
std::string_view msg) const { std::string_view msg) const {
spdlog::get("console")->info( auto console = spdlog::get("console");
utils::error::create_error_message(function_name, {msg})); if (console) {
console->info(utils::error::create_error_message(function_name, {msg}));
} else {
fallback.handle_info(function_name, msg);
}
auto file = spdlog::get("file"); auto file = spdlog::get("file");
if (not file) { if (not file) {
@ -184,8 +206,12 @@ void spdlog_exception_handler::handle_info(std::string_view function_name,
void spdlog_exception_handler::handle_trace(std::string_view function_name, void spdlog_exception_handler::handle_trace(std::string_view function_name,
std::string_view msg) const { std::string_view msg) const {
spdlog::get("console")->trace( auto console = spdlog::get("console");
utils::error::create_error_message(function_name, {msg})); if (console) {
console->trace(utils::error::create_error_message(function_name, {msg}));
} else {
fallback.handle_trace(function_name, msg);
}
auto file = spdlog::get("file"); auto file = spdlog::get("file");
if (not file) { if (not file) {
@ -197,8 +223,12 @@ void spdlog_exception_handler::handle_trace(std::string_view function_name,
void spdlog_exception_handler::handle_warn(std::string_view function_name, void spdlog_exception_handler::handle_warn(std::string_view function_name,
std::string_view msg) const { std::string_view msg) const {
spdlog::get("console")->warn( auto console = spdlog::get("console");
utils::error::create_error_message(function_name, {msg})); if (console) {
console->warn(utils::error::create_error_message(function_name, {msg}));
} else {
fallback.handle_warn(function_name, msg);
}
auto file = spdlog::get("file"); auto file = spdlog::get("file");
if (not file) { if (not file) {