This commit is contained in:
parent
714e82daa9
commit
c4686ae1cc
5 changed files with 159 additions and 42 deletions
|
|
@ -124,18 +124,19 @@ namespace Crafter {
|
|||
fs::path exeDir = GetPath();
|
||||
fs::create_directories(exeDir/config.target);
|
||||
std::string stdPcm = std::format("{}\\{}\\std.pcm", exeDir.string(), config.target);
|
||||
std::string stdcppm = std::format("{}\\{}\\std.cppm", exeDir.string(), config.target);
|
||||
|
||||
|
||||
std::string vsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe";
|
||||
|
||||
std::string command = vsPath + " -latest -property installationPath";
|
||||
|
||||
std::string directoryPath = RunCommand("C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe -latest -property installationPath") + "\\VC\\Tools\\MSVC";
|
||||
std::string directoryPath = RunCommand("C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe -latest -property installationPath") + "\\VC\\Tools";
|
||||
|
||||
std::vector<std::string> folders;
|
||||
|
||||
// Iterate through the directory and collect all subdirectories
|
||||
for (const auto& entry : fs::directory_iterator(directoryPath)) {
|
||||
for (const auto& entry : fs::directory_iterator(directoryPath+"\\MSVC")) {
|
||||
if (entry.is_directory()) {
|
||||
folders.push_back(entry.path().filename().string());
|
||||
}
|
||||
|
|
@ -148,15 +149,18 @@ namespace Crafter {
|
|||
|
||||
std::string msvcVersion = folders.front();
|
||||
|
||||
clDir = std::format("{}\\{}\\bin\\Hostx64\\x64", directoryPath, msvcVersion);
|
||||
clangClDir = std::format("{}\\Llvm\\x64\\bin", directoryPath);
|
||||
|
||||
std::string sourceFilePath = directoryPath + "\\" + msvcVersion + "\\modules\\std.ixx";
|
||||
|
||||
fs::copy(sourceFilePath, stdPcm, fs::copy_options::overwrite_existing);
|
||||
|
||||
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(sourceFilePath)) {
|
||||
std::string result = RunCommand(std::format("clang++ -std=c++26 -target x86_64-pc-windows-msvc -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile {}\\{}\\std.cppm -o {}", exeDir.string(), config.target, stdPcm));
|
||||
fs::copy(sourceFilePath, stdcppm, fs::copy_options::overwrite_existing);
|
||||
std::string result = RunCommand(std::format("cd {}\\{} && {}\\clang-cl.exe /EHsc /MD /std:c++latest --target=x86_64-pc-windows-msvc -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile std.cppm -o std.pcm", exeDir.string(), config.target, clangClDir, stdPcm));
|
||||
if(result != "") {
|
||||
throw std::runtime_error(result);
|
||||
}
|
||||
result = RunCommand(std::format("cd {}\\{} && {}\\cl.exe /std:c++latest /EHsc /nologo /W4 /MD /c {}", exeDir.string(), config.target, clDir, sourceFilePath));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue