Skip to content

Repository files navigation

Foundry

C++17 Coverage Version License MIT Platform Windows Platform Linux Platform macOS

Foundry is a cross-platform C++ utility library that collects small, self-contained tools commonly needed across projects, so they don't have to be rewritten each time. It focuses on a handful of dependency-light building blocks with clear, minimal APIs.

Built with C++17 as its baseline standard, Foundry targets Linux, macOS, and Windows, and each utility can be adopted on its own without pulling in the rest of the library.

Features

  • Scope Guard - Cleanup code guaranteed to run on scope exit, early return, or exception. scope_guard_example.cpp
  • Run Once / Run At Exit - One-shot execution per call site and lambda-based atexit registration with LIFO ordering. run_once_example.cpp
  • Flags - Type-safe bitmask container for enum class values with compile-time mixing prevention. flags_example.cpp
  • Result - Exceptionless, type-safe Result<T, E> monad for flexible error handling and chaining. result_example.cpp
  • Semantic Version - Lightweight parser and representation for Semantic Versioning. semver_example.cpp
  • Platform Paths - Runtime resolution of working directory, executable path, and temp directory as std::filesystem::path. paths_example.cpp

CMake integration

Foundry can be integrated into a CMake project using either FetchContent or add_subdirectory().

FetchContent

include(FetchContent)

FetchContent_Declare(
  foundry
  GIT_REPOSITORY https://github.com/DMsuDev/foundry.git
  GIT_TAG        # pin to a release tag or commit hash
  GIT_SHALLOW    TRUE
)

FetchContent_MakeAvailable(foundry)
target_link_libraries(my_app PRIVATE Foundry::Foundry)

Subdirectory

add_subdirectory(vendor/foundry)
target_link_libraries(my_app PRIVATE Foundry::Foundry)

License

Foundry is licensed under the MIT License.
See LICENSE for more information.

About

General-purpose developer utilities for C++

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages