From 4631c18c31acc754a101333c9be60babf7afed50 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Wed, 6 May 2026 01:06:09 +0200 Subject: [PATCH] port to crafter.build v2 Co-Authored-By: Claude Opus 4.7 (1M context) --- project.cpp | 24 +++++++++++++++++++ project.json | 33 --------------------------- tests/ShouldCompile/ShouldCompile.cpp | 6 ++--- tests/ShouldCompile/project.cpp | 20 ++++++++++++++++ 4 files changed, 46 insertions(+), 37 deletions(-) create mode 100644 project.cpp delete mode 100644 project.json create mode 100644 tests/ShouldCompile/project.cpp diff --git a/project.cpp b/project.cpp new file mode 100644 index 0000000..9fa6e6f --- /dev/null +++ b/project.cpp @@ -0,0 +1,24 @@ +import std; +import Crafter.Build; +namespace fs = std::filesystem; +using namespace Crafter; + +extern "C" Configuration CrafterBuildProject(std::span args) { + Configuration cfg; + cfg.path = "./"; + cfg.name = "Crafter.Thread"; + cfg.outputName = "Crafter.Thread"; + cfg.type = ConfigurationType::LibraryStatic; + ApplyStandardArgs(cfg, args); + + std::array ifaces = { + "interfaces/Crafter.Thread", + "interfaces/Crafter.Thread-ThreadPool", + }; + std::array impls = { + "implementations/Crafter.Thread-ThreadPool", + }; + cfg.GetInterfacesAndImplementations(ifaces, impls); + + return cfg; +} diff --git a/project.json b/project.json deleted file mode 100644 index 88bd9d3..0000000 --- a/project.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "crafter-thread", - "configurations": [ - { - "name": "lib", - "interfaces": ["interfaces/Crafter.Thread", "interfaces/Crafter.Thread-ThreadPool"], - "implementations": ["implementations/Crafter.Thread-ThreadPool"], - "type":"library" - }, - { - "name": "lib-shared", - "extends": ["lib"], - "type":"shared-library" - }, - { - "name": "lib-debug", - "extends": ["lib"], - "debug": true - } - ], - "tests":[ - { - "name": "should-compile", - "implementations": ["tests/ShouldCompile/ShouldCompile"], - "dependencies": [ - { - "path":"./project.json", - "configuration":"lib-shared" - } - ] - } - ] -} diff --git a/tests/ShouldCompile/ShouldCompile.cpp b/tests/ShouldCompile/ShouldCompile.cpp index b982502..ad07917 100644 --- a/tests/ShouldCompile/ShouldCompile.cpp +++ b/tests/ShouldCompile/ShouldCompile.cpp @@ -20,10 +20,8 @@ import Crafter.Thread; import std; using namespace Crafter; -extern "C" { - std::string* RunTest() { - return nullptr; - } +int main() { + return 0; } diff --git a/tests/ShouldCompile/project.cpp b/tests/ShouldCompile/project.cpp new file mode 100644 index 0000000..18aa80d --- /dev/null +++ b/tests/ShouldCompile/project.cpp @@ -0,0 +1,20 @@ +import std; +import Crafter.Build; +namespace fs = std::filesystem; +using namespace Crafter; + +extern "C" Configuration CrafterBuildProject(std::span args) { + Configuration cfg; + cfg.path = "tests/ShouldCompile/"; + cfg.name = "ShouldCompile"; + cfg.outputName = "ShouldCompile"; + cfg.type = ConfigurationType::Executable; + ApplyStandardArgs(cfg, args); + cfg.dependencies = { ParentLib("Crafter.Thread") }; + + std::array ifaces = {}; + std::array impls = { "ShouldCompile" }; + cfg.GetInterfacesAndImplementations(ifaces, impls); + + return cfg; +}