crafter-build V2
This commit is contained in:
parent
e4bfc0ff19
commit
ec3edbb3d7
4 changed files with 61 additions and 78 deletions
|
|
@ -1,9 +0,0 @@
|
|||
#include <cassert>
|
||||
import Crafter.Math;
|
||||
import std;
|
||||
|
||||
using namespace Crafter;
|
||||
|
||||
int main() {
|
||||
|
||||
}
|
||||
52
project.cpp
Normal file
52
project.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
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, 8> mathInterfaces = {
|
||||
"interfaces/Crafter.Math-Basic",
|
||||
"interfaces/Crafter.Math",
|
||||
"interfaces/Crafter.Math-Common",
|
||||
"interfaces/Crafter.Math-Vector",
|
||||
"interfaces/Crafter.Math-Intersection",
|
||||
"interfaces/Crafter.Math-MatrixRowMajor",
|
||||
"interfaces/Crafter.Math-VectorF16",
|
||||
"interfaces/Crafter.Math-VectorF32",
|
||||
};
|
||||
|
||||
Configuration cfg;
|
||||
cfg.path = "./";
|
||||
cfg.name = "Crafter.Math";
|
||||
cfg.outputName = "Crafter.Math";
|
||||
ApplyStandardArgs(cfg, args);
|
||||
cfg.type = ConfigurationType::LibraryStatic;
|
||||
{
|
||||
std::array<fs::path, 8> ifaces;
|
||||
std::ranges::copy(mathInterfaces, ifaces.begin());
|
||||
std::array<fs::path, 0> impls = {};
|
||||
cfg.GetInterfacesAndImplementations(ifaces, impls);
|
||||
}
|
||||
|
||||
auto addVectorTest = [&](std::string march, std::string mtune) {
|
||||
Test t;
|
||||
t.config.path = "./";
|
||||
t.config.name = std::format("Vector-{}", march);
|
||||
t.config.outputName = t.config.name;
|
||||
t.config.target = cfg.target;
|
||||
t.config.type = ConfigurationType::Executable;
|
||||
t.config.march = march;
|
||||
t.config.mtune = mtune;
|
||||
t.config.debug = cfg.debug;
|
||||
std::array<fs::path, 8> ifaces;
|
||||
std::ranges::copy(mathInterfaces, ifaces.begin());
|
||||
std::array<fs::path, 1> impls = { "tests/Vector" };
|
||||
t.config.GetInterfacesAndImplementations(ifaces, impls);
|
||||
cfg.tests.push_back(std::move(t));
|
||||
};
|
||||
addVectorTest("sapphirerapids", "native");
|
||||
addVectorTest("x86-64-v4", "generic");
|
||||
addVectorTest("x86-64-v3", "generic");
|
||||
|
||||
return cfg;
|
||||
}
|
||||
58
project.json
58
project.json
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
"name": "crafter-math",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "base",
|
||||
"interfaces": [
|
||||
"interfaces/Crafter.Math-Basic",
|
||||
"interfaces/Crafter.Math",
|
||||
"interfaces/Crafter.Math-Common",
|
||||
"interfaces/Crafter.Math-Vector",
|
||||
"interfaces/Crafter.Math-Intersection",
|
||||
"interfaces/Crafter.Math-MatrixRowMajor",
|
||||
"interfaces/Crafter.Math-VectorF16",
|
||||
"interfaces/Crafter.Math-VectorF32"
|
||||
],
|
||||
"implementations": []
|
||||
},
|
||||
{
|
||||
"name": "lib",
|
||||
"extends": ["base"],
|
||||
"type":"library",
|
||||
"dependencies": []
|
||||
},
|
||||
{
|
||||
"name": "lib-shared",
|
||||
"extends": ["base"],
|
||||
"type":"shared-library",
|
||||
"dependencies": []
|
||||
},
|
||||
{
|
||||
"name": "lib-debug",
|
||||
"extends": ["lib"],
|
||||
"debug": true
|
||||
}
|
||||
],
|
||||
"tests":[
|
||||
{
|
||||
"name": "Vector-x86-64-sapphirerapids",
|
||||
"implementations": ["tests/Vector"],
|
||||
"march": "sapphirerapids",
|
||||
"extends": ["lib-shared"]
|
||||
},
|
||||
{
|
||||
"name": "Vector-x86-64-v4",
|
||||
"implementations": ["tests/Vector"],
|
||||
"march": "x86-64-v4",
|
||||
"mtune": "generic",
|
||||
"extends": ["lib-shared"]
|
||||
},
|
||||
{
|
||||
"name": "Vector-x86-64-v3",
|
||||
"implementations": ["tests/Vector"],
|
||||
"march": "x86-64-v3",
|
||||
"mtune": "generic",
|
||||
"extends": ["lib-shared"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -598,16 +598,14 @@ std::string* TestAllCombinations() {
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
std::string* RunTest() {
|
||||
std::string* err = TestAllCombinations<_Float16, VectorF16, VectorF16<1, 1>::MaxElement>();
|
||||
if (err) {
|
||||
return err;
|
||||
int main() {
|
||||
if (auto err = std::unique_ptr<std::string>(TestAllCombinations<_Float16, VectorF16, VectorF16<1, 1>::MaxElement>())) {
|
||||
std::println(std::cerr, "{}", *err);
|
||||
return 1;
|
||||
}
|
||||
err = TestAllCombinations<float, VectorF32, VectorF32<1, 1>::MaxElement>();
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
return nullptr;
|
||||
if (auto err = std::unique_ptr<std::string>(TestAllCombinations<float, VectorF32, VectorF32<1, 1>::MaxElement>())) {
|
||||
std::println(std::cerr, "{}", *err);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue