An extremely small, lightweight, and easy-to-use foundational library.
- Modular architecture, allowing independent reuse of any module in the
srcdirectory without any configuration; - No dependencies on any third-party libraries, using only cross-platform architectural design;
- Simple and easy to use, adopting modern C++ standards (minimum support for C++11 standard)
| Module | Path | Functionality |
|---|---|---|
| TUI | src/TUI |
Terminal User Interface, providing basic terminal drawing functionality for easier terminal rendering |
| OS | src/OS |
Operating System, supporting basic file and path operations as well as viewing system information |
| CommandParser | src/Parser |
Command parser, providing basic command parameter parsing functionality for easy implementation of command-line tools |
| Events | src/Events |
Event system, providing basic components for easy implementation of timers, asynchronous functions, etc. |
You can download the latest precompiled release directly from Github Release.
-
Download the project source code via Github:
git clone https://github.com/CatIsNotFound/Tiny.cpp.git
To use the unstable version, execute the following command:
git clone https://github.com/CatIsNotFound/Tiny.cpp.git -b beta
-
Configure the project via CMake
cd Tiny.cpp mkdir build ; cd build cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/Tiny.cpp -DCMAKE_BUILD_TYPE=Release -DTINY_BUILD_TEST=OFF
P.S: Please replace
/path/to/Tiny.cppwith the actual installation path. -
Compile and install this project locally
cmake --build . --target install
Directly copy any directory's corresponding module from the src directory to your own project. Each module contains a header file (*.hpp) and a source file (*.cpp).
If using CMake as your primary project management tool, it is recommended to import the Tiny project directly via CMake.
P.S: Use Tiny as the project library name in CMake, not Tiny.cpp!
-
Download the precompiled binary library or manually compile the source code to your local machine.
-
Refer to the following example:
cmake_minimum_required(VERSION 3.24)
project(HelloWorld)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_PREFIX_PATH "/path/to/Tiny.cpp")
find_package(Tiny REQUIRED)
add_executable(${CMAKE_PROJECT_NAME}
main.cpp
# ....
)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
Tiny::Tiny
)Taking the TUI module as an example, assuming you want to use the Terminal module to simply output Hello, Tiny.cpp!, please execute the following code:
// If importing via CMake, use the following import method:
#include <Tiny/TUI/Terminal.hpp>
// If directly copying the TUI directory to your project, it might be imported like this:
#include "TUI/Terminal.hpp"
using ter = Tiny::TUI::Terminal;
int main() {
ter::printLine("Hello, Tiny.cpp!");
return 0;
}P.S: To view the API reference, please refer to API Reference.
Tiny.cpp is licensed under the MIT License. You can view detailed information in the LICENSE file or any other header or source file.