fixed mingw
Some checks failed
demo.yaml / fixed mingw (push) Failing after 0s

This commit is contained in:
Jorijn van der Graaf 2026-04-02 16:53:07 +02:00
commit 2d89528bdf
5 changed files with 51 additions and 35 deletions

View file

@ -39,35 +39,35 @@ namespace Crafter {
std::filesystem::path GetPath();
void BuildWasmStdPcm(const Project& project, const Configuration& config) {
fs::path exeDir = GetPath();
fs::create_directories(exeDir/config.target);
// fs::path exeDir = GetPath();
// fs::create_directories(exeDir/config.target);
const std::string stdPcm = std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.pcm", exeDir.string());
fs::path stdCc = fs::path(std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.cppm", exeDir.string()));
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(stdCc)) {
std::string result = RunCommand(std::format("clang++ -fno-exceptions --target=wasm32-wasi -nodefaultlibs --sysroot={}/wasi-sysroot-28.0 -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier -fno-c++-static-destructors --precompile {} -o {}", exeDir.string(), stdCc.string(), stdPcm));
if(result != "") {
throw std::runtime_error(result);
}
}
// const std::string stdPcm = std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.pcm", exeDir.string());
// fs::path stdCc = fs::path(std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.cppm", exeDir.string()));
// if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(stdCc)) {
// std::string result = RunCommand(std::format("clang++ -fno-exceptions --target=wasm32-wasi -nodefaultlibs --sysroot={}/wasi-sysroot-28.0 -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier -fno-c++-static-destructors --precompile {} -o {}", exeDir.string(), stdCc.string(), stdPcm));
// if(result != "") {
// throw std::runtime_error(result);
// }
// }
const fs::path indexPath = std::format("{}/index.html", exeDir.string());
const fs::path indexDstPath = project.binDir/"index.html";
if(!fs::exists(indexDstPath)) {
fs::copy(indexPath, indexDstPath);
} else if(fs::last_write_time(indexDstPath) < fs::last_write_time(indexPath)) {
fs::remove(indexDstPath);
fs::copy(indexPath, indexDstPath);
}
// const fs::path indexPath = std::format("{}/index.html", exeDir.string());
// const fs::path indexDstPath = project.binDir/"index.html";
// if(!fs::exists(indexDstPath)) {
// fs::copy(indexPath, indexDstPath);
// } else if(fs::last_write_time(indexDstPath) < fs::last_write_time(indexPath)) {
// fs::remove(indexDstPath);
// fs::copy(indexPath, indexDstPath);
// }
const fs::path runtimePath = std::format("{}/runtime.js", exeDir.string());
const fs::path runtimeDstPath = project.binDir/"runtime.js";
if(!fs::exists(runtimeDstPath)) {
fs::copy(runtimePath, runtimeDstPath);
} else if(fs::last_write_time(runtimeDstPath) < fs::last_write_time(runtimePath)) {
fs::remove(runtimeDstPath);
fs::copy(runtimePath, runtimeDstPath);
}
// const fs::path runtimePath = std::format("{}/runtime.js", exeDir.string());
// const fs::path runtimeDstPath = project.binDir/"runtime.js";
// if(!fs::exists(runtimeDstPath)) {
// fs::copy(runtimePath, runtimeDstPath);
// } else if(fs::last_write_time(runtimeDstPath) < fs::last_write_time(runtimePath)) {
// fs::remove(runtimeDstPath);
// fs::copy(runtimePath, runtimeDstPath);
// }
}
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
@ -182,7 +182,7 @@ namespace Crafter {
const std::string stdPcm = std::format("{}/{}{}/std.pcm", exeDir.string(), config.target, config.march);
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time("/usr/share/libc++/v1/std.cppm")) {
std::string result = RunCommand(std::format("clang++ --target={} -std=c++26 -stdlib=libc++ -march={} -mtune={} -O3 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile /usr/share/libc++/v1/std.cppm -o {}", config.target, config.march, config.march, stdPcm));
std::string result = RunCommand(std::format("clang++ --target={} -std=c++26 -stdlib=libc++ -march={} -mtune={} -O3 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile /usr/share/libc++/v1/std.cppm -o {}", config.target, config.march, config.mtune, stdPcm));
if(result != "") {
throw std::runtime_error(result);
}
@ -191,9 +191,9 @@ namespace Crafter {
void BuildMingwStdPcm(const Project& project, const Configuration& config) {
fs::path exeDir = GetPath();
fs::create_directories(exeDir/config.target);
fs::create_directories(exeDir/(config.target+config.march));
const std::string stdPcm = std::format("{}/{}/std.pcm", exeDir.string(), config.target);
const std::string stdPcm = std::format("{}/{}{}/std.pcm", exeDir.string(), config.target, config.march);
std::vector<std::string> folders;
// Iterate through the directory and collect all subdirectories
@ -213,7 +213,7 @@ namespace Crafter {
fs::path stdCc = fs::path(std::format("/usr/x86_64-w64-mingw32/include/c++/{}/bits/std.cc", mingWversion));
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(stdCc)) {
std::string result = RunCommand(std::format("cp {} {}/{}/std.cppm\nclang++ --target={} -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile {}/{}/std.cppm -o {}", stdCc.string(), exeDir.string(), config.target, config.target, exeDir.string(), config.target, stdPcm));
std::string result = RunCommand(std::format("cp {} {}/{}{}/std.cppm\nclang++ --target={} -march={} -mtune={} -O3 -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile {}/{}{}/std.cppm -o {}", stdCc.string(), exeDir.string(), config.target, config.march, config.target, config.march, config.mtune, exeDir.string(), config.target, config.march, stdPcm));
if(result != "") {
throw std::runtime_error(result);
}
@ -225,7 +225,7 @@ namespace Crafter {
// Check if the file is a regular file and ends with ".dll"
if (fs::is_regular_file(entry) && entry.path().extension() == ".dll") {
// Construct the destination file path
fs::path dest_file = project.binDir / entry.path().filename();
fs::path dest_file = project.binDir / config.name / entry.path().filename();
// Check if the destination file exists and if it is older than the source file
if (!fs::exists(dest_file) || fs::last_write_time(entry.path()) > fs::last_write_time(dest_file)) {