/* catcrafts.net Copyright (C) 2026 Catcrafts The source code of this website is made available for viewing purposes only. No permission is granted to copy, modify, distribute, or create derivative works. */ import std; import Crafter.Build; namespace fs = std::filesystem; using namespace Crafter; extern "C" Configuration CrafterBuildProject(std::span args) { std::vector depArgs(args.begin(), args.end()); depArgs.push_back("--target=wasm32-wasip1"); // --local resolves the Crafter.Graphics dep from a sibling working tree // instead of fetching it from forgejo. Mirrors Crafter.Graphics's own // project.cpp convention so edits across the two repos pick up without // commit-and-pull. bool useLocal = false; for (std::string_view a : args) { if (a == "--local") { useLocal = true; break; } } if (useLocal && std::find(depArgs.begin(), depArgs.end(), std::string("--local")) == depArgs.end()) { depArgs.push_back("--local"); } Configuration* graphics = useLocal ? LocalProject({ .projectFile = "../Crafter/Crafter.Graphics/project.cpp", .args = depArgs, }) : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Graphics.git" }, .args = depArgs, }); Configuration cfg; cfg.path = "./"; cfg.name = "Catcrafts.Net"; cfg.outputName = "catcrafts"; cfg.type = ConfigurationType::Executable; cfg.target = "wasm32-wasip1"; ApplyStandardArgs(cfg, args); cfg.dependencies = { graphics }; std::array ifaces = { "interfaces/Catcrafts", "interfaces/Catcrafts-Views", "interfaces/Catcrafts-Blog", "interfaces/Catcrafts-Root", }; std::array impls = { "implementations/main", "implementations/Catcrafts-Blog", "implementations/Catcrafts-Root", "implementations/Catcrafts-Views", }; cfg.GetInterfacesAndImplementations(ifaces, impls); cfg.files.emplace_back(fs::path("styles/styles.css")); cfg.files.emplace_back(fs::path("robots.txt")); cfg.files.emplace_back(fs::path("sitemap.xml")); cfg.files.emplace_back(fs::path("favicon.svg")); // Loaded as a