windows build fixes
Some checks failed
demo.yaml / windows build fixes (push) Failing after 0s

This commit is contained in:
Jorijn van der Graaf 2026-03-01 16:13:04 +01:00
commit 76c08dcbfd
3 changed files with 44 additions and 1 deletions

View file

@ -175,6 +175,48 @@ namespace Crafter {
} }
} }
void AutoDetect() {
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") + "\\VC\\Tools";
std::cout << directoryPath << std::endl;
std::vector<std::string> folders;
// Iterate through the directory and collect all subdirectories
for (const auto& entry : fs::directory_iterator(directoryPath+"\\MSVC")) {
if (entry.is_directory()) {
folders.push_back(entry.path().filename().string());
}
}
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);
}
#else #else
std::string RunCommand(const std::string_view cmd) { std::string RunCommand(const std::string_view cmd) {

View file

@ -72,7 +72,7 @@ namespace Crafter {
target = RunCommand("clang -print-target-triple"); target = RunCommand("clang -print-target-triple");
#endif #endif
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32) #if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
GetPath(); AutoDetect();
target = RunCommand(std::format("{}\\clang-cl.exe -print-target-triple", clangClDir)); target = RunCommand(std::format("{}\\clang-cl.exe -print-target-triple", clangClDir));
#endif #endif
target.pop_back(); target.pop_back();

View file

@ -41,6 +41,7 @@ namespace Crafter {
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32) #if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
export std::string clDir; export std::string clDir;
export std::string clangClDir; export std::string clangClDir;
export void AutoDetect();
#endif #endif
export std::string RunCommand(const std::string_view cmd); export std::string RunCommand(const std::string_view cmd);
export void RunCommandIgnore(const std::string_view cmd); export void RunCommandIgnore(const std::string_view cmd);