From e968a5a4156db943cac71aa04c0cc44e07e0c53b Mon Sep 17 00:00:00 2001 From: larioteo Date: Sun, 15 Oct 2023 21:38:07 +0200 Subject: [PATCH] Removed unaccessary workarounds to export preprocessor variables. --- Source/Library/Ultra/Core/Core.ixx | 2 -- Source/Library/Ultra/Core/Logger.h | 4 ---- Source/Library/Ultra/Core/Logger.ixx | 11 +++++++---- Source/Library/Ultra/Core/Types.ixx | 2 +- Source/Library/Ultra/Graphics/Context.cxx | 3 +-- .../Ultra/Platform/Graphics/Vulkan/VKInstance.cxx | 1 - Source/Library/Ultra/System/Event.cxx | 13 ++++++------- Source/Library/Ultra/System/Input.cxx | 11 +++++------ Source/Library/Ultra/UI/Dialog.cxx | 13 ++++++------- Source/Library/Ultra/UI/ImGui/GUIBuilder.cxx | 1 - Source/Library/Ultra/UI/ImGui/GUIBuilder.ixx | 2 -- Source/Library/Ultra/UI/Window.cxx | 1 - Source/Settings.h | 2 +- 13 files changed, 27 insertions(+), 39 deletions(-) delete mode 100644 Source/Library/Ultra/Core/Logger.h diff --git a/Source/Library/Ultra/Core/Core.ixx b/Source/Library/Ultra/Core/Core.ixx index 7ed092c3..779e8de8 100644 --- a/Source/Library/Ultra/Core/Core.ixx +++ b/Source/Library/Ultra/Core/Core.ixx @@ -1,8 +1,6 @@ export module Ultra.Core; // Custom Library -export import "Core.h"; -export import "Platform.h"; export import Ultra.Core.Helpers; export import Ultra.Core.Types; diff --git a/Source/Library/Ultra/Core/Logger.h b/Source/Library/Ultra/Core/Logger.h deleted file mode 100644 index 6e61c42e..00000000 --- a/Source/Library/Ultra/Core/Logger.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -// Workaround, add the debug break after the message. -#define AppAssert(x, ...) if (AppAssert(x, __VA_ARGS__)) APP_DEBUGBREAK() diff --git a/Source/Library/Ultra/Core/Logger.ixx b/Source/Library/Ultra/Core/Logger.ixx index 2b069e12..744e196b 100644 --- a/Source/Library/Ultra/Core/Logger.ixx +++ b/Source/Library/Ultra/Core/Logger.ixx @@ -1,4 +1,8 @@ -export module Ultra.Logger; +module; + +#include + +export module Ultra.Logger; // Library import Ultra.Core; @@ -541,6 +545,7 @@ template void LogDelimiter(const LogRecord &record, Args &&... template bool AppAssert(T *object, const LogRecord &record, Args &&...args) { if (!object) { logger(LogLevel::Fatal, record, args...); logger << "\n"; + //APP_DEBUGBREAK(); return true; } return false; @@ -548,6 +553,7 @@ template void LogDelimiter(const LogRecord &record, Args &&... template bool AppAssert(T object, const LogRecord &record, Args &&...args) { if (!object) { logger(LogLevel::Fatal, record, args...); logger << "\n"; + //APP_DEBUGBREAK(); return true; } return false; @@ -609,6 +615,3 @@ struct formatter { }; } - -// Preprocessor Macro Extensions -export import "Logger.h"; diff --git a/Source/Library/Ultra/Core/Types.ixx b/Source/Library/Ultra/Core/Types.ixx index 20f90b30..d71b8063 100644 --- a/Source/Library/Ultra/Core/Types.ixx +++ b/Source/Library/Ultra/Core/Types.ixx @@ -81,11 +81,11 @@ using std::format; using std::ofstream; using std::ostream; using std::ostringstream; -using std::wostringstream; using std::stringstream; using std::vformat; using std::wofstream; using std::wostream; +using std::wostringstream; // Types using std::int8_t; diff --git a/Source/Library/Ultra/Graphics/Context.cxx b/Source/Library/Ultra/Graphics/Context.cxx index c996cf3d..f098d4b1 100644 --- a/Source/Library/Ultra/Graphics/Context.cxx +++ b/Source/Library/Ultra/Graphics/Context.cxx @@ -1,6 +1,5 @@ module; -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" module Ultra.Graphics.Context; @@ -35,7 +34,7 @@ Reference Context::Create(void *window) { } } #else - AppAssert(false, "This platform is currently not supported!"); + AppAssert(false, "The selected platform is currently not supported!"); return nullptr; #endif } diff --git a/Source/Library/Ultra/Platform/Graphics/Vulkan/VKInstance.cxx b/Source/Library/Ultra/Platform/Graphics/Vulkan/VKInstance.cxx index 3c8e63d4..2bb202e1 100644 --- a/Source/Library/Ultra/Platform/Graphics/Vulkan/VKInstance.cxx +++ b/Source/Library/Ultra/Platform/Graphics/Vulkan/VKInstance.cxx @@ -1,6 +1,5 @@ module; -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" #if defined(APP_PLATFORM_WINDOWS) diff --git a/Source/Library/Ultra/System/Event.cxx b/Source/Library/Ultra/System/Event.cxx index 02b6fa02..db7ab87e 100644 --- a/Source/Library/Ultra/System/Event.cxx +++ b/Source/Library/Ultra/System/Event.cxx @@ -1,6 +1,5 @@ module; -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" module Ultra.System.Event; @@ -14,12 +13,12 @@ import Ultra.Logger; namespace Ultra { Scope EventListener::Create() { - #ifdef APP_PLATFORM_WINDOWS - return CreateScope(); - #else - AppAssert(nullptr, "The current platform isn't supported!"); - return nullptr; - #endif +#ifdef APP_PLATFORM_WINDOWS + return CreateScope(); +#else + AppAssert(nullptr, "The current platform isn't supported!"); + return nullptr; +#endif } } diff --git a/Source/Library/Ultra/System/Input.cxx b/Source/Library/Ultra/System/Input.cxx index 12713911..b04d5162 100644 --- a/Source/Library/Ultra/System/Input.cxx +++ b/Source/Library/Ultra/System/Input.cxx @@ -1,6 +1,5 @@ module; -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" module Ultra.System.Input; @@ -17,11 +16,11 @@ namespace Ultra { Scope Input::Instance = Input::Create(); Scope Input::Create() { - #if defined(APP_PLATFORM_WINDOWS) - return CreateScope(); - #else - return nullptr; - #endif +#if defined(APP_PLATFORM_WINDOWS) + return CreateScope(); +#else + return nullptr; +#endif } bool Input::GetKeyState(KeyCode code) { diff --git a/Source/Library/Ultra/UI/Dialog.cxx b/Source/Library/Ultra/UI/Dialog.cxx index 230a1e54..28a119f6 100644 --- a/Source/Library/Ultra/UI/Dialog.cxx +++ b/Source/Library/Ultra/UI/Dialog.cxx @@ -1,6 +1,5 @@ module; -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" module Ultra.UI.Dialog; @@ -14,12 +13,12 @@ import Ultra.Logger; namespace Ultra { Scope Dialog::Create() { - #ifdef APP_PLATFORM_WINDOWS - return CreateScope(); - #else - AppAssert(nullptr, "The current platform isn't supported!"); - return nullptr; - #endif +#ifdef APP_PLATFORM_WINDOWS + return CreateScope(); +#else + AppAssert(nullptr, "The current platform isn't supported!"); + return nullptr; +#endif } } diff --git a/Source/Library/Ultra/UI/ImGui/GUIBuilder.cxx b/Source/Library/Ultra/UI/ImGui/GUIBuilder.cxx index 0a6c7cd7..bb1d2f5b 100644 --- a/Source/Library/Ultra/UI/ImGui/GUIBuilder.cxx +++ b/Source/Library/Ultra/UI/ImGui/GUIBuilder.cxx @@ -1,6 +1,5 @@ module; -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" // Properties diff --git a/Source/Library/Ultra/UI/ImGui/GUIBuilder.ixx b/Source/Library/Ultra/UI/ImGui/GUIBuilder.ixx index f2b14378..86cde78d 100644 --- a/Source/Library/Ultra/UI/ImGui/GUIBuilder.ixx +++ b/Source/Library/Ultra/UI/ImGui/GUIBuilder.ixx @@ -1,6 +1,4 @@ module; - -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" /// diff --git a/Source/Library/Ultra/UI/Window.cxx b/Source/Library/Ultra/UI/Window.cxx index bc406aa9..2b737a44 100644 --- a/Source/Library/Ultra/UI/Window.cxx +++ b/Source/Library/Ultra/UI/Window.cxx @@ -1,6 +1,5 @@ module; -// Hack: The included header unit in the Core module doesn't work here. #include "Ultra/Core/Core.h" module Ultra.UI.Window; diff --git a/Source/Settings.h b/Source/Settings.h index 89c1d023..e56e3ffe 100644 --- a/Source/Settings.h +++ b/Source/Settings.h @@ -5,7 +5,7 @@ /// // Application Information (the solution name will be replaced by preprocessor!) -namespace SOLUTION_NAME { +export namespace SOLUTION_NAME { // Information constexpr auto AppCaption = "Ultra Spectra";