From f60268b17af99e3926647476dc6290be66ee5c8a Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sat, 31 Oct 2026 02:59:13 +0100 Subject: [PATCH] docs: sibling projects forward the parent's args by default The sibling-project example dropped its `.args = depArgs`, which no longer has to be written, and says what a sibling receives instead: the args the project file was loaded with, or whatever `.args` is set to, with `{}` for nothing. It also says that releases up to 2.2.0 forward nothing without `.args`, which matters for a project.cpp that has to load on both. The pragma section says that a project file's own dependency is built for the host and gets none of the project's args, the one place the default does not apply. Co-Authored-By: Claude Opus 5.5 --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7e0d46..2029038 100644 --- a/README.md +++ b/README.md @@ -69,12 +69,13 @@ Clones live at `~/.cache/crafter.build/external/-/`, keyed by `(url, ```cpp Configuration* math = GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git" }, // .branch or .commit to pin - .args = depArgs, // forwarded to its CrafterBuildProject }); -Configuration* sibling = LocalProject({ .projectFile = "../Crafter.Math/project.cpp", .args = depArgs }); +Configuration* sibling = LocalProject({ .projectFile = "../Crafter.Math/project.cpp" }); cfg.dependencies = { math }; ``` +The sibling's `CrafterBuildProject` gets the args this `project.cpp` was loaded with (`ProjectArgs()`), so `--target=`, `--march=`, `--debug` and the project's own flags reach every sibling down the chain. Set `.args` to send something else: `{}` for nothing, or a list built from the project's args, say one without a flag only this project reads (it would otherwise give the sibling a build directory of its own) or with an extra `--target=`. Releases up to 2.2.0 forward nothing when `.args` is left out. + Clones share the external cache and identical specs share one `Configuration`. An unpinned source is `git pull`ed on every invocation, set `.commit` for reproducible, offline-after-first-fetch builds. A project loaded this way runs its `CrafterBuildProject` as a dependency, and `IsTopLevelProject()` is `false` while it does (`true` in the project crafter-build was pointed at, and outside any project file). Wire test-only dependencies behind it: a library whose test links crafter-build itself would otherwise load crafter-build's `project.cpp` from inside crafter-build and recurse. @@ -94,6 +95,8 @@ import Crafter.LintRules; #pragma crafter dependency "" [branch "" | commit ""] [project ""] ``` +Such a dependency is built for the host, whatever the project targets, and its `project.cpp` gets none of the project's args. + ## Tests Tests live under `tests//`. The simplest case is a single C++ file: