32 lines
1.2 KiB
C++
32 lines
1.2 KiB
C++
|
|
// 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;
|
||
|
|
|
||
|
|
// Loads M itself and through A, which passes on all of its args. With
|
||
|
|
// --split, the list P gives M leaves --wide out, as a filter meant for one
|
||
|
|
// sibling would, and the two paths load M with two different lists.
|
||
|
|
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
|
||
|
|
const bool split = std::ranges::contains(args, std::string_view("--split"));
|
||
|
|
std::vector<std::string> mArgs;
|
||
|
|
for (std::string_view arg : args) {
|
||
|
|
if (!split || arg != "--wide") mArgs.emplace_back(arg);
|
||
|
|
}
|
||
|
|
Configuration* m = LocalProject({ .projectFile = "../m/project.cpp", .args = mArgs });
|
||
|
|
Configuration* a = LocalProject({ .projectFile = "../a/project.cpp" });
|
||
|
|
|
||
|
|
Configuration cfg;
|
||
|
|
cfg.path = "./";
|
||
|
|
cfg.name = "P";
|
||
|
|
cfg.outputName = "P";
|
||
|
|
cfg.type = ConfigurationType::Executable;
|
||
|
|
ApplyStandardArgs(cfg, args);
|
||
|
|
cfg.dependencies = { m, a };
|
||
|
|
std::array<fs::path, 0> ifaces = {};
|
||
|
|
std::array<fs::path, 1> impls = { "main" };
|
||
|
|
cfg.GetInterfacesAndImplementations(ifaces, impls);
|
||
|
|
return cfg;
|
||
|
|
}
|