Crafter.Build update

This commit is contained in:
Jorijn van der Graaf 2025-11-02 06:47:04 +01:00
commit 3924c21af1
6 changed files with 59 additions and 52 deletions

View file

@ -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 <thread>
#include <functional>
#include <mutex>
#include <print>
#include <iostream>
module Crafter.Thread;
module Crafter.Thread:ThreadPool_impl;
import std;
import :ThreadPool;
using namespace Crafter::Thread;

View file

@ -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 <vector>
#include <functional>
#include <atomic>
#include <thread>
#include <condition_variable>
export module Crafter.Thread:ThreadPool;
import std;
namespace Crafter::Thread {
struct ThreadStorage {

View file

@ -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;

View file

@ -1,10 +0,0 @@
#include <print>
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();
}

View file

@ -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": "should-compile",
"implementations": ["tests/ShouldCompile/ShouldCompile"],
"dependencies": [
{
"name": "develop",
"source_files": ["main"],
"extends": ["lib-debug"],
"type":"executable"
"path":"./project.json",
"configuration":"lib-shared"
}
]
}
]
}

View file

@ -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;
}
}