error messages
This commit is contained in:
parent
a36beab2ac
commit
23fa8b98b0
9 changed files with 199 additions and 90 deletions
|
|
@ -25,28 +25,41 @@ module;
|
|||
#include <iostream>
|
||||
#include <regex>
|
||||
#include <print>
|
||||
#include <mutex>
|
||||
#include <execution>
|
||||
module Crafter.Build;
|
||||
using namespace Crafter::Build;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
void Source::GetSourceFiles(std::string clangDir, const Configuration& config, fs::path pcmDir, std::string target, const std::string& march, const std::string& flags, std::vector<std::thread>& threads, const std::vector<Module>& modules, std::string& files, const fs::path& buildDir) {
|
||||
std::vector<ClangError> Source::GetSourceFiles(std::string clangDir, const Configuration& config, fs::path pcmDir, std::string target, const std::string& march, const std::string& flags, const std::vector<Module>& modules, std::string& files, const fs::path& buildDir) {
|
||||
std::string defines;
|
||||
for(const Define& define : config.defines) {
|
||||
defines+=define.ToString();
|
||||
}
|
||||
std::vector<std::thread> threads;
|
||||
std::mutex errorMutex;
|
||||
std::vector<ClangError> errors;
|
||||
for(const fs::path& sourceFile : config.sourceFiles) {
|
||||
files+=std::format("{}_source.o ",(buildDir/sourceFile.filename()).generic_string());
|
||||
if(Source::Check(sourceFile, modules, config, buildDir)) {
|
||||
threads.emplace_back([&config, sourceFile, pcmDir, target, clangDir, flags, march, buildDir, defines](){
|
||||
threads.emplace_back([&config, sourceFile, pcmDir, target, clangDir, flags, march, buildDir, defines, &errors, &errorMutex]() {
|
||||
std::string command = std::format("{} {} -std={} {}.cpp -fprebuilt-module-path={} -c -O{} {} {} -o {}_source.o {}", clangDir, defines, config.standard, sourceFile.generic_string(), pcmDir.generic_string(), config.optimizationLevel, march, flags, (buildDir/sourceFile.filename()).generic_string(), target);
|
||||
if(config.verbose) {
|
||||
std::cout << command << std::endl;
|
||||
}
|
||||
BounceCommand(command.c_str());
|
||||
std::vector<ClangError> newErrors = RunClang(command);
|
||||
if(newErrors.size() > 0) {
|
||||
errorMutex.lock();
|
||||
errors.insert(errors.end(), newErrors.begin(), newErrors.end());
|
||||
errorMutex.unlock();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
for(std::thread& thread : threads){
|
||||
thread.join();
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
bool Source::Check(const fs::path& path, const std::vector<Module>& modules, const Configuration& config, const fs::path& buildDir) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue