port to crafter.build v2
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8d4f540bcc
commit
4e097d2b2d
8 changed files with 156 additions and 193 deletions
71
project.cpp
Normal file
71
project.cpp
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import std;
|
||||
import Crafter.Build;
|
||||
namespace fs = std::filesystem;
|
||||
using namespace Crafter;
|
||||
|
||||
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
|
||||
constexpr std::array<std::string_view, 6> networkInterfaces = {
|
||||
"interfaces/Crafter.Network",
|
||||
"interfaces/Crafter.Network-ClientTCP",
|
||||
"interfaces/Crafter.Network-ListenerTCP",
|
||||
"interfaces/Crafter.Network-ClientHTTP",
|
||||
"interfaces/Crafter.Network-ListenerHTTP",
|
||||
"interfaces/Crafter.Network-HTTP",
|
||||
};
|
||||
constexpr std::array<std::string_view, 4> networkImplementations = {
|
||||
"implementations/Crafter.Network-ClientTCP",
|
||||
"implementations/Crafter.Network-ListenerTCP",
|
||||
"implementations/Crafter.Network-ClientHTTP",
|
||||
"implementations/Crafter.Network-ListenerHTTP",
|
||||
};
|
||||
|
||||
std::vector<std::string> depArgs(args.begin(), args.end());
|
||||
Configuration* thread = GitProject({
|
||||
.source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Thread.git" },
|
||||
.args = depArgs,
|
||||
});
|
||||
|
||||
Configuration cfg;
|
||||
cfg.path = "./";
|
||||
cfg.name = "Crafter.Network";
|
||||
cfg.outputName = "Crafter.Network";
|
||||
cfg.type = ConfigurationType::LibraryStatic;
|
||||
ApplyStandardArgs(cfg, args);
|
||||
cfg.dependencies = { thread };
|
||||
{
|
||||
std::array<fs::path, 6> ifaces;
|
||||
std::ranges::copy(networkInterfaces, ifaces.begin());
|
||||
std::array<fs::path, 4> impls;
|
||||
std::ranges::copy(networkImplementations, impls.begin());
|
||||
cfg.GetInterfacesAndImplementations(ifaces, impls);
|
||||
}
|
||||
|
||||
auto addTest = [&](std::string name, fs::path implFile) {
|
||||
Test t;
|
||||
t.config.path = "./";
|
||||
t.config.name = std::move(name);
|
||||
t.config.outputName = t.config.name;
|
||||
t.config.target = cfg.target;
|
||||
t.config.debug = cfg.debug;
|
||||
t.config.march = cfg.march;
|
||||
t.config.mtune = cfg.mtune;
|
||||
t.config.type = ConfigurationType::Executable;
|
||||
t.config.dependencies = { thread };
|
||||
std::array<fs::path, 6> ifaces;
|
||||
std::ranges::copy(networkInterfaces, ifaces.begin());
|
||||
std::array<fs::path, 5> impls;
|
||||
std::ranges::copy(networkImplementations, impls.begin());
|
||||
impls[4] = std::move(implFile);
|
||||
t.config.GetInterfacesAndImplementations(ifaces, impls);
|
||||
cfg.tests.push_back(std::move(t));
|
||||
};
|
||||
|
||||
addTest("ShouldCompile", "tests/ShouldCompile");
|
||||
addTest("ShouldRecieveHTTP", "tests/ShouldRecieveHTTP");
|
||||
addTest("ShouldSendHTTP", "tests/ShouldSendHTTP");
|
||||
addTest("ShouldSendRecieveHTTP", "tests/ShouldSendRecieveHTTP");
|
||||
addTest("ShouldSendRecieveKeepaliveHTTP", "tests/ShouldSendRecieveKeepaliveHTTP");
|
||||
addTest("ShouldSendRecieveLargeHTTP", "tests/ShouldSendRecieveLargeHTTP");
|
||||
|
||||
return cfg;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue