Skip to content

Cookbook

Small, complete, runnable recipes — one per page, each a standalone consumer project under examples/cookbook/ and asserted by a CTest in CI. Where the guide explains each feature in isolation, a recipe shows the whole dish: the annotated C++, the CMake that builds it, and a check script that loads the module and proves what bound.

Building the recipes

The cookbook is a standalone super-project: it obtains welder with FetchContent — exactly the way a consumer would — and FetchContent-pins the backends (pybind11, nanobind, sol2). No Conan, nothing preinstalled beyond gcc-16, CMake + Ninja, a Python, and (for the Lua half of recipe 07) a Lua install:

cmake -S examples/cookbook -B build/cookbook -G Ninja \
  -DCMAKE_CXX_COMPILER=g++-16 \
  -DWELDER_LUA_DIR="$(brew --prefix lua@5.4)"   # optional: enables the Lua recipe
cmake --build build/cookbook
ctest --test-dir build/cookbook --output-on-failure

By default welder itself is fetched from GitHub. welder's CI instead points the fetch at the current checkout (-DFETCHCONTENT_SOURCE_DIR_WELDER=$PWD), so every recipe — and the FetchContent consumption path itself — is exercised on every commit.

Copying a recipe

Each recipe directory is deliberately self-contained (one CMakeLists.txt, one or a few .cpp, a check script). To start your own project from one, copy the recipe directory plus the dependency block of the top-level CMakeLists.txt — that block is the "consume welder without Conan" reference.