From 3924c21af165d8b33b9c5df95b7edb1bb4ef7d9a Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sun, 2 Nov 2025 06:47:04 +0100 Subject: [PATCH] Crafter.Build update --- .../Crafter.Thread-ThreadPool.cpp | 16 +++----- .../Crafter.Thread-ThreadPool.cppm | 13 ++----- .../Crafter.Thread.cppm | 5 +-- main.cpp | 10 ----- project.json | 38 ++++++++++--------- tests/ShouldCompile/ShouldCompile.cpp | 29 ++++++++++++++ 6 files changed, 59 insertions(+), 52 deletions(-) rename Crafter.Thread-ThreadPool.cpp => implementations/Crafter.Thread-ThreadPool.cpp (92%) rename Crafter.Thread-ThreadPool.cppm => interfaces/Crafter.Thread-ThreadPool.cppm (88%) rename Crafter.Thread.cppm => interfaces/Crafter.Thread.cppm (91%) delete mode 100644 main.cpp create mode 100644 tests/ShouldCompile/ShouldCompile.cpp diff --git a/Crafter.Thread-ThreadPool.cpp b/implementations/Crafter.Thread-ThreadPool.cpp similarity index 92% rename from Crafter.Thread-ThreadPool.cpp rename to implementations/Crafter.Thread-ThreadPool.cpp index 1b410ec..1507dcf 100755 --- a/Crafter.Thread-ThreadPool.cpp +++ b/implementations/Crafter.Thread-ThreadPool.cpp @@ -1,6 +1,6 @@ /* -Crafter.Thread -Copyright (C) 2025 Catcrafts +Crafter®.Thread +Copyright (C) 2025 Catcrafts® Catcrafts.net This library is free software; you can redistribute it and/or @@ -18,15 +18,9 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -module; - -#include -#include -#include -#include -#include - -module Crafter.Thread; +module Crafter.Thread:ThreadPool_impl; +import std; +import :ThreadPool; using namespace Crafter::Thread; diff --git a/Crafter.Thread-ThreadPool.cppm b/interfaces/Crafter.Thread-ThreadPool.cppm similarity index 88% rename from Crafter.Thread-ThreadPool.cppm rename to interfaces/Crafter.Thread-ThreadPool.cppm index 17d5fb6..02532d1 100755 --- a/Crafter.Thread-ThreadPool.cppm +++ b/interfaces/Crafter.Thread-ThreadPool.cppm @@ -1,6 +1,6 @@ /* -Crafter.Thread -Copyright (C) 2025 Catcrafts +Crafter®.Thread +Copyright (C) 2025 Catcrafts® Catcrafts.net This library is free software; you can redistribute it and/or @@ -18,15 +18,8 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -module; - -#include -#include -#include -#include -#include - export module Crafter.Thread:ThreadPool; +import std; namespace Crafter::Thread { struct ThreadStorage { diff --git a/Crafter.Thread.cppm b/interfaces/Crafter.Thread.cppm similarity index 91% rename from Crafter.Thread.cppm rename to interfaces/Crafter.Thread.cppm index 7bf400a..d0bbf6b 100755 --- a/Crafter.Thread.cppm +++ b/interfaces/Crafter.Thread.cppm @@ -1,6 +1,6 @@ /* -Crafter.Thread -Copyright (C) 2025 Catcrafts +Crafter®.Thread +Copyright (C) 2025 Catcrafts® Catcrafts.net This library is free software; you can redistribute it and/or @@ -19,5 +19,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ export module Crafter.Thread; - export import :ThreadPool; \ No newline at end of file diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 6ff5cc5..0000000 --- a/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -import Crafter.Thread; -using namespace Crafter::Thread; - -int main() { - ThreadPool::Start(3); - ThreadPool::Enqueue({[](){std::println("1");}, [](){std::println("2");}, [](){std::println("3");}, [](){std::println("4");}, [](){std::println("5");},[](){std::println("6");}, [](){std::println("7");}, [](){std::println("8");}, [](){std::println("9");}, [](){std::println("10");}}); - ThreadPool::Stop(); -} \ No newline at end of file diff --git a/project.json b/project.json index 276e4e7..88bd9d3 100644 --- a/project.json +++ b/project.json @@ -2,30 +2,32 @@ "name": "crafter-thread", "configurations": [ { - "name": "base", - "standard": "c++26", - "source_files": ["Crafter.Thread-ThreadPool"], - "module_files": ["Crafter.Thread", "Crafter.Thread-ThreadPool"], - "additional_files": [], - "build_dir": "build", - "output_dir": "bin", + "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": ["base"], + "extends": ["lib"], "debug": true - }, + } + ], + "tests":[ { - "name": "lib-release", - "extends": ["base"], - "optimization_level": "3" - }, - { - "name": "develop", - "source_files": ["main"], - "extends": ["lib-debug"], - "type":"executable" + "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 new file mode 100644 index 0000000..b982502 --- /dev/null +++ b/tests/ShouldCompile/ShouldCompile.cpp @@ -0,0 +1,29 @@ +/* +Crafter® Build +Copyright (C) 2025 Catcrafts® +Catcrafts.net + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License version 3.0 as published by the Free Software Foundation; + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +import Crafter.Thread; +import std; +using namespace Crafter; + +extern "C" { + std::string* RunTest() { + return nullptr; + } +} + +