crafter-build V2

This commit is contained in:
Jorijn van der Graaf 2026-04-29 19:42:40 +02:00
commit b9b9ecb84c
3 changed files with 76 additions and 83 deletions

34
project.cpp Normal file
View file

@ -0,0 +1,34 @@
import std;
import Crafter.Build;
namespace fs = std::filesystem;
using namespace Crafter;
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
GitProjectSpec mathSpec{
.source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git" },
.args = std::vector<std::string>(args.begin(), args.end()),
};
Configuration* math = GitProject(mathSpec);
Configuration cfg;
cfg.path = "./";
cfg.name = "Crafter.Asset";
ApplyStandardArgs(cfg, args);
cfg.outputName = (cfg.type == ConfigurationType::Executable) ? "crafter-asset" : "Crafter.Asset";
cfg.dependencies = { math };
std::array<fs::path, 3> ifaces = {
"interfaces/Crafter.Asset",
"interfaces/Crafter.Asset-Texture",
"interfaces/Crafter.Asset-Mesh",
};
if (cfg.type == ConfigurationType::Executable) {
std::array<fs::path, 1> impls = { "implementations/main" };
cfg.GetInterfacesAndImplementations(ifaces, impls);
} else {
std::array<fs::path, 0> impls = {};
cfg.GetInterfacesAndImplementations(ifaces, impls);
}
return cfg;
}