Compare commits

..

No commits in common. "60131b5cc7e4d273dced3625e7aa780bf916702a" and "2de30ae2c1ecc54560f6e7cce62f0b7803a3464e" have entirely different histories.

View file

@ -5,14 +5,28 @@ using namespace Crafter;
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) { extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
std::vector<std::string> depArgs(args.begin(), args.end()); std::vector<std::string> depArgs(args.begin(), args.end());
Configuration* math = GitProject({
.source = { "https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git" }, // Local-mode resolution for the Crafter.Math/Crafter.Asset deps that the
.args = depArgs, // self-host pass links in (so `cfg.assets` calls CompressAsset → Crafter.Asset
}); // in-process). `--local` points at sibling working trees instead of git;
Configuration* asset = GitProject({ // useful during cross-repo development so edits in ../Crafter.Asset are
.source = { "https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git" }, // picked up without commit-and-pull.
.args = depArgs, 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<Configuration>(); static auto crafterBuildLib = std::make_unique<Configuration>();
crafterBuildLib->path = "./"; crafterBuildLib->path = "./";
@ -25,7 +39,12 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
crafterBuildLib->type = (crafterBuildLib->target == "x86_64-w64-mingw32" || crafterBuildLib->target == "x86_64-pc-windows-msvc") crafterBuildLib->type = (crafterBuildLib->target == "x86_64-w64-mingw32" || crafterBuildLib->target == "x86_64-pc-windows-msvc")
? ConfigurationType::LibraryDynamic ? ConfigurationType::LibraryDynamic
: ConfigurationType::LibraryStatic; : 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->dependencies = { math, asset };
crafterBuildLib->defines.push_back({"CRAFTER_BUILD_HAS_ASSET", ""}); crafterBuildLib->defines.push_back({"CRAFTER_BUILD_HAS_ASSET", ""});
{ {