Crafter.Asset/project.cpp

34 lines
1.1 KiB
C++

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;
}