Terminality is built around C++23 named modules, which place strict requirements on both the compiler and the build system. The framework targets Windows and Linux, with each platform handled by a dedicated translation unit compiled under the appropriate preprocessor guard.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Rikitav/Terminality/llms.txt
Use this file to discover all available pages before exploring further.
Build system requirements
The rootCMakeLists.txt sets the minimum requirements for the entire project:
| Setting | Purpose |
|---|---|
cmake_minimum_required(VERSION 4.0) | CMake 4.0 is required for stable C++23 module scanning support. |
CMAKE_CXX_STANDARD 23 | Enables C++23 language features, including named modules. |
CMAKE_CXX_SCAN_FOR_MODULES ON | Tells CMake to scan source files for import/export module declarations and build the correct dependency graph. |
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON | Automatically generates __declspec(dllexport) entries when building Terminality as a shared library on Windows. Remove this flag if you are linking statically or targeting Linux only. |
CMAKE_EXPORT_COMPILE_COMMANDS ON | Writes compile_commands.json for tooling such as clangd. Has no effect on the build output. |
Supported compilers
Terminality is tested against the latest stable releases of:- MSVC (Visual Studio 2022 or later) — primary development compiler on Windows
- GCC (13 or later) — used on Linux
Clang module support exists but is not officially tested by this project. You may encounter build issues with older Clang versions.
Windows
On Windows,HostApplication::EnterTerminal uses the Win32 console API to set up the terminal before any rendering begins:
- Sets the console code page to UTF-8 (
CP_UTF8 = 65001) for both input and output. - Enables
ENABLE_VIRTUAL_TERMINAL_PROCESSINGon the output handle so ANSI/VT sequences are interpreted correctly. - Enables
ENABLE_WINDOW_INPUTon the input handle so resize events are delivered. - Hides the cursor with
SetConsoleCursorInfo.
ExitTerminal restores the alternate screen buffer and re-enables cursor visibility.
The MessageBox macro conflict
<Windows.h> defines a MessageBox macro that maps to either MessageBoxA or MessageBoxW depending on the character-set setting. This macro shadows terminality::MessageBox and causes a compilation error.
The fix is a single #undef immediately after the Windows header, before any Terminality imports:
terminality::MessageBox.
Windows-only API: AlertAsync
Theterminality:Windows module exports one Windows-specific helper:
AlertAsync calls MessageBoxW on a detached background thread, so it returns immediately without blocking the UI loop. Guard every call to it:
Linux
On Linux,EnterTerminal uses POSIX terminal APIs:
- Saves the current
termiosstate withtcgetattr. - Puts the terminal into raw mode: disables canonical processing, echo, signal generation (
ISIG), and output post-processing. - Writes ANSI escape sequences to switch to the alternate screen buffer and hide the cursor.
ExitTerminal restores the saved termios state and returns to the normal screen buffer.
Input is read using poll with the configured timeout, and escape sequences are decoded manually to produce InputEvent values for arrow keys and special characters.
A UTF-8 locale must be active for wide-character rendering to work correctly on Linux.
EnterTerminal calls setlocale(LC_ALL, "") and attempts to imbue std::wcout, but if no UTF-8 locale is installed on the system a warning is printed and rendering may be incorrect.Quick start
- Windows (MSVC)
- Linux (GCC)
Open the repository in Visual Studio 2022 and use the CMake project support, or run from the Developer Command Prompt: