Skip to content

Moztanku/JacLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JacLib

Linux tests Windows tests

License C++

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
git clone https://github.com/Moztanku/JacLib.git path/to/JacLib
  1. Include the library in your CMake project
# 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
        "$<TARGET_FILE:JacLib>"
        "$<TARGET_FILE_DIR:your_target>")
endif()
  1. Include the library in your source files
#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
git clone https://github.com/Moztanku/JacLib.git path/to/JacLib
  1. Build the project and tests
# Enter the repository directory
cd path/to/JacLib
# Configure step
cmake -B build -S . -DJacLib_BUILD_TESTS=ON
# Build step
cmake --build build
  1. Run the tests
# 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)

About

My multiplatform utility library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors