From 275dbd0ff37dab16dda8ed76f2081db84ad1dc37 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sun, 1 Mar 2026 16:48:43 +0100 Subject: [PATCH] windows build fixes --- implementations/Crafter.Build-Command.cpp | 31 +++-------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/implementations/Crafter.Build-Command.cpp b/implementations/Crafter.Build-Command.cpp index b78dd69..effa06b 100644 --- a/implementations/Crafter.Build-Command.cpp +++ b/implementations/Crafter.Build-Command.cpp @@ -121,25 +121,17 @@ namespace Crafter { } void BuildMsvcStdPcm(const Project& project, const Configuration& config) { - std::cout << "bruh 1" << std::endl; fs::path exeDir = GetPath(); - std::cout << "bruh 2" << std::endl; fs::create_directories(exeDir/config.target); - std::cout << "bruh 3" << std::endl; std::string stdPcm = std::format("{}\\{}\\std.pcm", exeDir.string(), config.target); std::string stdcppm = std::format("{}\\{}\\std.cppm", exeDir.string(), config.target); - std::cout << stdPcm << std::endl; - std::cout << stdcppm << std::endl; - std::string directoryPath = RunCommand("\"C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe\" -latest -property installationPath"); directoryPath.pop_back(); directoryPath += "\\VC\\Tools"; - std::cout << directoryPath << std::endl; - std::vector folders; // Iterate through the directory and collect all subdirectories @@ -149,19 +141,13 @@ namespace Crafter { } } - std::cout << "bruh 4" << std::endl; - // Sort the folders by version in descending order std::sort(folders.begin(), folders.end(), [](const std::string& a, const std::string& b) { return std::lexicographical_compare(b.begin(), b.end(), a.begin(), a.end()); }); - std::cout << "bruh 5" << std::endl; - std::string msvcVersion = folders.front(); - std::cout << msvcVersion << std::endl; - clDir = std::format("{}\\MSVC\\{}\\bin\\Hostx64\\x64", directoryPath, msvcVersion); clangClDir = std::format("{}\\Llvm\\x64\\bin", directoryPath); @@ -171,11 +157,13 @@ namespace Crafter { if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(sourceFilePath)) { 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)); + 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 != "") { + std::cout << result << std::endl; 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)); + result = RunCommand(std::format("cd {}\\{} && \"{}\\cl.exe\" /std:c++latest /EHsc /nologo /W4 /MD /c {}", exeDir.string(), config.target, clDir, sourceFilePath)); + std::cout << result << std::endl; } } @@ -186,8 +174,6 @@ namespace Crafter { directoryPath += "\\VC\\Tools"; - std::cout << directoryPath << std::endl; - std::vector folders; // Iterate through the directory and collect all subdirectories @@ -197,19 +183,13 @@ namespace Crafter { } } - std::cout << "bruh 4" << std::endl; - // Sort the folders by version in descending order std::sort(folders.begin(), folders.end(), [](const std::string& a, const std::string& b) { return std::lexicographical_compare(b.begin(), b.end(), a.begin(), a.end()); }); - std::cout << "bruh 5" << std::endl; - std::string msvcVersion = folders.front(); - std::cout << msvcVersion << std::endl; - clDir = std::format("{}\\MSVC\\{}\\bin\\Hostx64\\x64", directoryPath, msvcVersion); clangClDir = std::format("{}\\Llvm\\x64\\bin", directoryPath); } @@ -335,9 +315,6 @@ namespace Crafter { // } void BuildStdPcm(const Project& project, const Configuration& config) { - std::cout << "bruh" << std::endl; - std::cout << config.target << std::endl; - std::cout << "bruh2" << std::endl; if(config.target == "x86_64-pc-linux-gnu") { BuildGnuStdPcm(project, config); } else if(config.target == "x86_64-w64-mingw32") {