v2 nearly done

This commit is contained in:
Jorijn van der Graaf 2026-04-27 07:04:42 +02:00
commit f13671b2be
24 changed files with 1467 additions and 314 deletions

View file

@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
export module Crafter.Build:Clang;
import std;
import :Shader;
import :Interface;
import :Implementation;
import :External;
namespace fs = std::filesystem;
export namespace Crafter {
@ -27,14 +30,9 @@ export namespace Crafter {
std::string result;
bool repack;
std::unordered_set<std::string> libs;
}
};
struct Dependency {
fs::path path;
std::vector<std::pair<std::string, std::string>> arguments;
}
export struct Define {
struct Define {
std::string name;
std::string value;
};
@ -46,20 +44,34 @@ export namespace Crafter {
};
struct Configuration {
fs::path path;
std::string outputName;
std::string name;
std::string march = "native";
std::string mtune = "native";
std::string target;
bool debug = false;
ConfigurationType type = ConfigurationType::Executable;
std::vector<std::path> interfaces;
std::vector<std::path> implementations;
std::vector<std::path> cFiles;
std::vector<std::path> dependencies;
std::vector<std::path> files;
std::vector<std::unique_ptr<Module>> interfaces;
std::vector<Implementation> implementations;
std::vector<fs::path> cFiles;
std::vector<fs::path> cuda;
std::vector<Configuration*> dependencies;
std::vector<fs::path> files;
std::vector<Define> defines;
std::vector<Shader> shaders;
std::vector<Dependency> deps;
}
std::vector<ExternalDependency> externalDependencies;
std::vector<std::string> compileFlags;
std::vector<std::string> linkFlags;
void GetInterfacesAndImplementations(std::span<fs::path> interfaces, std::span<fs::path> implementations);
fs::path PcmDir() const {
return path
/ (type == ConfigurationType::Executable ? "build" : "bin")
/ std::format("{}-{}-{}", name, target, march);
}
};
BuildResult Build(fs::path config, std::unordered_set<std::string> depSet);
BuildResult Build(const Configuration& config, std::unordered_set<std::string> depSet);
BuildResult Build(Configuration& config, std::unordered_map<fs::path, std::shared_future<BuildResult>>& depResults, std::mutex& depMutex);
int Run(int argc, char** argv);
}