diff --git a/project.cpp b/project.cpp index fe78209..a057c5a 100644 --- a/project.cpp +++ b/project.cpp @@ -5,14 +5,28 @@ using namespace Crafter; extern "C" Configuration CrafterBuildProject(std::span args) { std::vector depArgs(args.begin(), args.end()); - Configuration* math = GitProject({ - .source = { "https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git" }, - .args = depArgs, - }); - Configuration* asset = GitProject({ - .source = { "https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git" }, - .args = depArgs, - }); + + // Local-mode resolution for the Crafter.Math/Crafter.Asset deps that the + // self-host pass links in (so `cfg.assets` calls CompressAsset → Crafter.Asset + // in-process). `--local` points at sibling working trees instead of git; + // useful during cross-repo development so edits in ../Crafter.Asset are + // picked up without commit-and-pull. + bool useLocal = false; + for (std::string_view a : args) { + if (a == "--local") { useLocal = true; break; } + } + auto resolveDep = [&](std::string_view name, std::string_view gitUrl) -> Configuration* { + if (useLocal) { + return LocalProject({ + .projectFile = fs::path("../") / name / "project.cpp", + .args = depArgs, + }); + } + return GitProject({ + .source = { .url = std::string(gitUrl) }, + .args = depArgs, + }); + }; static auto crafterBuildLib = std::make_unique(); crafterBuildLib->path = "./"; @@ -25,7 +39,12 @@ extern "C" Configuration CrafterBuildProject(std::span a crafterBuildLib->type = (crafterBuildLib->target == "x86_64-w64-mingw32" || crafterBuildLib->target == "x86_64-pc-windows-msvc") ? ConfigurationType::LibraryDynamic : ConfigurationType::LibraryStatic; - + // Self-host pass links Crafter.Asset (and its Crafter.Math dep) into the + // crafter-build binary so cfg.assets can call CompressAsset in-process. + // The bootstrap (build.sh) defines no such dep — its impl unit takes the + // stub branch and cfg.assets errors at runtime until a self-host rebuild. + Configuration* math = resolveDep("Crafter.Math", "https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git"); + Configuration* asset = resolveDep("Crafter.Asset", "https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git"); crafterBuildLib->dependencies = { math, asset }; crafterBuildLib->defines.push_back({"CRAFTER_BUILD_HAS_ASSET", ""}); {