Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/moztanku/jaclib

My multiplatform utility library
https://github.com/moztanku/jaclib

cmake cpp20 gtest library linux multiplatform utility windows

Last synced: 7 days ago
JSON representation

My multiplatform utility library

Awesome Lists containing this project

README

        

# JacLib

![Linux tests](https://github.com/Moztanku/JacLib/actions/workflows/tests_linux.yaml/badge.svg?branch=main)
![Windows tests](https://github.com/Moztanku/JacLib/actions/workflows/tests_windows.yaml/badge.svg?branch=main)

![License](https://img.shields.io/github/license/Moztanku/JacLib)
![C++](https://img.shields.io/badge/C%2B%2B-20-blue)

***My utility library for C++20 made for personal use and learning purposes.***

## Features
- **Multiple-platform support**: Both Windows and Linux are supported
- **Static/Dynamic compilation**: The library can be compiled as a static or dynamic library
- **Documentation**: Every module is documented with Doxygen style comments

## Modules
- **print.hpp**: A print function with multiple overloads that supports various log levels, ("*{} {}*", {"*formatted*", "*strings*"}), colored [HEADERS] and source location @ README.md:16
- **types.hpp**: A set of type aliases
- **debug.hpp**: A constexpr constant that is enabled when the compiler is in debug mode

## How to include in your project
***You can see example usage in `tst\CMakeLists.txt`***

### Requirements
- **CMake**
- **C++20**

### Steps
1. **Clone the repository**
```bash
git clone https://github.com/Moztanku/JacLib.git path/to/JacLib
```
2. **Include the library in your CMake project**
```cmake
# Note: Change your_target to your actual target name
add_subdirectory(path/to/JacLib)
target_link_libraries(your_target PRIVATE JacLib)

# On Windows it may be necessary to move compiled dlls to the executable directory
if (MSVC AND BUILD_SHARED_LIBS)
add_custom_command(
TARGET your_target POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$"
"$")
endif()
```
3. **Include the library in your source files**
```cpp
#include "jac/print.hpp"

int main() {
jac::print("{} {}!", {"Hello", "World"});

return 0;
}
```

## How to build tests

### Requirements
- **CMake**
- **C++20**
- **Gtest**

### Steps
1. **Clone the repository**
```bash
git clone https://github.com/Moztanku/JacLib.git path/to/JacLib
```
2. **Build the project and tests**
```bash
# Enter the repository directory
cd path/to/JacLib
# Configure step
cmake -B build -S . -DJacLib_BUILD_TESTS=ON
# Build step
cmake --build build
```
3. **Run the tests**
```bash
# Linux
./build/tst/JacLib_tests

# Windows
./build/tst/{Debug|Release}/JacLib_tests.exe
```

## Build options
- **JacLib_BUILD_TESTS={ON|OFF}**: Build the tests (default: ***OFF***)
- **BUILD_SHARED_LIBS={ON|OFF}**: Build the library as a shared library (default: ***ON***)
- **CMAKE_BUILD_TYPE={Release|Debug}**: Build type on **Linux** (default: ***Release***)
- **--config {Release|Debug}**: Build type, set during build step on **Windows** (default: ***Release***)