This commit is contained in:
parent
d32f2584f6
commit
c3accc7d9c
1 changed files with 10 additions and 10 deletions
|
|
@ -245,7 +245,7 @@ namespace Crafter {
|
|||
if(!config.target.empty()) {
|
||||
command += std::format(" --target={}", config.target);
|
||||
if(config.target == "wasm32-wasi") {
|
||||
command += std::format(" --sysroot={} -fno-exceptions -fno-c++-static-destructors", exeDir/"wasi-sysroot-28.0");
|
||||
command += std::format(" --sysroot={} -fno-exceptions -fno-c++-static-destructors", (exeDir/"wasi-sysroot-28.0").string());
|
||||
}
|
||||
}
|
||||
if(!config.march.empty()) {
|
||||
|
|
@ -289,13 +289,13 @@ namespace Crafter {
|
|||
|
||||
if(config.target != "wasm32-wasi") {
|
||||
#ifndef PLATFORM_WINDOWS
|
||||
const std::string stdPcm = std::format("{}/std.pcm", exeDir);
|
||||
const std::string stdPcm = std::format("{}/std.pcm", exeDir.string());
|
||||
std::string gccVersion = RunCommand("g++ -dumpversion");
|
||||
gccVersion.pop_back();
|
||||
fs::path stdCc = fs::path(std::format("/usr/include/c++/{}/bits/std.cc", gccVersion));
|
||||
|
||||
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(stdCc)) {
|
||||
std::string result = RunCommand(std::format("cp {} {}/std.cppm\nclang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile {}/std.cppm -o {}", stdCc.string(), exeDir, exeDir, stdPcm));
|
||||
std::string result = RunCommand(std::format("cp {} {}/std.cppm\nclang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile {}/std.cppm -o {}", stdCc.string(), exeDir.string(), exeDir.string(), stdPcm));
|
||||
if(result != "") {
|
||||
throw std::runtime_error(result);
|
||||
}
|
||||
|
|
@ -312,7 +312,7 @@ namespace Crafter {
|
|||
std::vector<std::string> folders;
|
||||
|
||||
// Iterate through the directory and collect all subdirectories
|
||||
for (const auto& entry : fs::directory_iterator(basePath)) {
|
||||
for (const auto& entry : fs::directory_iterator(directoryPath)) {
|
||||
if (entry.is_directory()) {
|
||||
folders.push_back(entry.path().filename().string());
|
||||
}
|
||||
|
|
@ -337,20 +337,20 @@ namespace Crafter {
|
|||
return 1;
|
||||
}
|
||||
#endif
|
||||
command += std::format(" -fprebuilt-module-path={} -fprebuilt-module-path={}", pcmDir.string(), exeDir);
|
||||
command += std::format(" -fprebuilt-module-path={} -fprebuilt-module-path={}", pcmDir.string(), exeDir.string());
|
||||
} else {
|
||||
const std::string stdPcm = std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.pcm", exeDir);
|
||||
fs::path stdCc = fs::path(std::format("{}/wasi-sysroot-28.0/share/libc++/v1/std.cppm", exeDir));
|
||||
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, stdCc.string(), stdPcm));
|
||||
if(result != "") {
|
||||
throw std::runtime_error(result);
|
||||
}
|
||||
}
|
||||
command += std::format(" -fprebuilt-module-path={} -fprebuilt-module-path={}/wasi-sysroot-28.0/share/libc++/v1", pcmDir.string(), exeDir);
|
||||
command += std::format(" -fprebuilt-module-path={} -fprebuilt-module-path={}/wasi-sysroot-28.0/share/libc++/v1", pcmDir.string(), exeDir.string());
|
||||
|
||||
|
||||
const fs::path indexPath = std::format("{}/index.html", exeDir);
|
||||
const fs::path indexPath = std::format("{}/index.html", exeDir.string());
|
||||
const fs::path indexDstPath = binDir/"index.html";
|
||||
if(!fs::exists(indexDstPath)) {
|
||||
fs::copy(indexPath, indexDstPath);
|
||||
|
|
@ -359,7 +359,7 @@ namespace Crafter {
|
|||
fs::copy(indexPath, indexDstPath);
|
||||
}
|
||||
|
||||
const fs::path runtimePath = std::format("{}/runtime.js", exeDir);
|
||||
const fs::path runtimePath = std::format("{}/runtime.js", exeDir.string());
|
||||
const fs::path runtimeDstPath = binDir/"runtime.js";
|
||||
if(!fs::exists(runtimeDstPath)) {
|
||||
fs::copy(runtimePath, runtimeDstPath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue