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 |
| Net | src/Net |
Network communication, providing Socket, Address, hostname resolution, and advanced socket options |
| DateTime | src/DateTime |
Date and time utilities, supporting construction, formatting, arithmetic, and timestamp conversion |
| CommandParser | src/Parser |
Command parser, providing basic command parameter parsing functionality for easy implementation of command-line tools |
| IniParser | src/Parser |
INI configuration file parser, supporting parsing, manipulating, and serializing INI files |
| 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 -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
Note
If XMake is not installed, execute the following command in the terminal to quickly install XMake:
Linux/MacOS/Unix-like:
curl -fsSL https://xmake.io/shget.text | bash wget https://xmake.io/shget.text -O - | bashWindows:
irm https://xmake.io/psget.text | iex-
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 XMake
cd Tiny.cpp xmake f --build_test=n -
Compile and install this project locally
xmake xmake package -o /path/to/install
P.S: Please replace
/path/to/installwith the actual installation path.
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).
Refer to the Import Guide to import the Tiny.cpp project.
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
)To use XMake to import the Tiny.cpp project, you need to first configure the XMake project, then add Tiny.cpp as a dependency in your project.
-
Download the manually compile the source code to your local machine.
-
Manually set up the local repository
xmake repo -g -a local_repo /path/to/packageP.S: Please replace /path/to/package with the actual absolute path of the installation package.
You can check if the local repository was added successfully with the following command:
xmake repo -l- Refer to the following example:
add_rules("mode.debug", "mode.release")
set_languages("c++20")
add_requires("tiny.cpp")
target("HelloWorld")
set_kind("binary")
add_files("**.cpp")
add_packages("tiny.cpp")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 more help, please refer to read the documents.
Tiny.cpp is licensed under the MIT License. You can view detailed information in the LICENSE file or any other header or source file.