// SPDX-License-Identifier: LGPL-3.0-only // SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® import std; import Crafter.Build; namespace fs = std::filesystem; using namespace Crafter; // A project that returns a configuration of another project beside one of // its own: the tool of ../sibling, picked by name, and a program made here. // The tool is built with the program, and its test and its script stay the // other project's. namespace { std::deque Owned; } extern "C" std::vector CrafterBuildConfigurations(std::span) { Configuration* tool = LocalProject({ .projectFile = "../sibling/project.cpp", .configuration = "tool" }); Configuration& app = Owned.emplace_back(); app.path = "./"; app.name = "umbrella"; app.outputName = "umbrella"; app.type = ConfigurationType::Executable; std::array interfaces = {}; std::array implementations = { "main" }; app.GetInterfacesAndImplementations(interfaces, implementations); app.scripts.push_back({"own", [](ScriptContext& ctx) { std::ofstream(ctx.projectDir / "own.ran") << ctx.project.name; return 0; }}); return { tool, &app }; }