Skip to content

kalcohol/ccforge

Repository files navigation

CC Forge

English | 简体中文 | 日本語

CC Forge is a C++23 header-only library that provides C++26-oriented standard backports and a small set of forge:: runtime utilities for structured async systems.

The project has two layers:

  • backport/: standard-header backports such as <execution>, <simd>, <mdspan>, <linalg>, <memory>, and <utility>.
  • include/forge/: non-standard utilities in namespace forge, including schedulers, scopes, channels, IO/accel proofs, coroutine tasks, and type erasure helpers.

forge.cmake probes the consumer toolchain at configure time. Complete native support stands aside, partial native support stands aside with a warning, and missing native support injects Forge's backport headers.

Features

Area Header Status
std::execution senders/receivers <execution> practical P2300 subset
std::simd <simd> core C++26 surface
std::submdspan and padded layouts <mdspan> current C++26 draft surface
std::linalg <linalg> practical BLAS level 1/2/3 subset
std::unique_resource <memory> experimental TS v3 backport
std::constant_wrapper <utility> C++26 backport
forge:: runtime utilities <forge/execution.hpp> structured async support layer: pool, scope, channel, strand, timer
forge::io <forge/io.hpp> Linux epoll/eventfd and Windows IOCP proof backends
forge::accel <forge/accel.hpp> runtime vocabulary plus mock/reference command backend

For exact behavior and caveats, see the documentation index.

Quick Start

#include <execution>

auto result = std::execution::sync_wait(
    std::execution::just(42)
    | std::execution::then([](int value) { return value * 2; })
);
#include <forge/execution.hpp>

forge::static_thread_pool pool{4};
auto work = std::execution::starts_on(
    pool.get_scheduler(),
    std::execution::just(1)
    | std::execution::then([](int value) { return value + 1; })
);

auto result = std::execution::sync_wait(std::move(work));
pool.shutdown();
pool.wait();

More examples live in example/ and the cookbook.

CMake

Installed package:

find_package(CCForge CONFIG REQUIRED)
target_link_libraries(myapp PRIVATE forge::forge)

Use forge::std when a target only needs standard-header backports and native stand-aside behavior:

target_link_libraries(myapp PRIVATE forge::std)

Source tree:

include(/path/to/ccforge/forge.cmake)
target_link_libraries(myapp PRIVATE forge::forge)

or:

add_subdirectory(ccforge)
target_link_libraries(myapp PRIVATE forge::forge)

The installed package config reruns native-vs-backport probes in the consumer project, so one install prefix can adapt to different compilers, standard libraries, and CMAKE_CXX_STANDARD values.

Standard-shaped entries intentionally use extensionless headers such as <execution> and <simd>. Non-standard forge:: utilities keep .hpp headers such as <forge/io.hpp> to distinguish project extensions from standard-library headers and avoid directory/header name collisions.

Requirements

  • C++23 or newer
  • CMake 3.17 or newer
  • Optional: podman for the provided native-verification containers
  • Optional: a Windows/MSVC host for the Windows IOCP smoke gate

Verification

cmake -S . -B build/local -DCMAKE_CXX_STANDARD=23 -DFORGE_BUILD_TESTS=ON
cmake --build build/local
ctest --test-dir build/local --output-on-failure

Full container entrypoint:

scripts/verify-native.sh [gcc16|llvm|zig|local|gcc-exec|tsan|asan|all]

Package smoke:

scripts/verify-install-package.sh

See testing for test groups, sanitizer gates, Windows smoke, and install-package verification.

Documentation

References

Forge's backports are informed by standards papers and existing implementations, including NVIDIA/stdexec, VcDevel/std-simd, Kokkos stdBLAS, and ncnn.

License

MIT License. See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors