This commit is contained in:
parent
a59ae046a2
commit
43d59e2f57
3 changed files with 8 additions and 31 deletions
|
|
@ -148,22 +148,19 @@ namespace Crafter {
|
||||||
|
|
||||||
std::string msvcVersion = folders.front();
|
std::string msvcVersion = folders.front();
|
||||||
|
|
||||||
clDir = std::format("{}\\MSVC\\{}\\bin\\Hostx64\\x64", directoryPath, msvcVersion);
|
|
||||||
clangClDir = std::format("{}\\Llvm\\x64\\bin", directoryPath);
|
|
||||||
|
|
||||||
std::string sourceFilePath = directoryPath + "\\MSVC\\" + msvcVersion + "\\modules\\std.ixx";
|
std::string sourceFilePath = directoryPath + "\\MSVC\\" + msvcVersion + "\\modules\\std.ixx";
|
||||||
|
|
||||||
std::println("Auto-Detected:\nCL: {}Clang: {}\nstd.ixx: {}", clDir, clangClDir, sourceFilePath);
|
std::println("Auto-Detected:\nCL: {}Clang: {}\nstd.ixx: {}", clDir, clangClDir, sourceFilePath);
|
||||||
|
|
||||||
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(sourceFilePath)) {
|
if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(sourceFilePath)) {
|
||||||
fs::copy(sourceFilePath, stdcppm, fs::copy_options::overwrite_existing);
|
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-include-angled-in-module-purview -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-include-angled-in-module-purview -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile std.cppm -o std.pcm", exeDir.string(), config.target, clangClDir, stdPcm));
|
||||||
if(result != "") {
|
if(result != "") {
|
||||||
std::cout << result << std::endl;
|
std::cout << result << std::endl;
|
||||||
throw std::runtime_error(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));
|
result = RunCommand(std::format("cd {}\\{} && {} cl.exe /std:c++latest /EHsc /nologo /W4 /MD /c \"{}\"", exeDir.string(), config.target, clDir, sourceFilePath));
|
||||||
std::cout << std::format("cd {}\\{} && \"{}\\cl.exe\" /std:c++latest /EHsc /nologo /W4 /MD /c \"{}\"", exeDir.string(), config.target, clDir, sourceFilePath) << std::endl;
|
std::cout << std::format("cd {}\\{} && {} cl.exe /std:c++latest /EHsc /nologo /W4 /MD /c \"{}\"", exeDir.string(), config.target, clDir, sourceFilePath) << std::endl;
|
||||||
std::cout << result << std::endl;
|
std::cout << result << std::endl;
|
||||||
std::cout << "hello?" << std::endl;
|
std::cout << "hello?" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
@ -174,26 +171,7 @@ namespace Crafter {
|
||||||
|
|
||||||
directoryPath.pop_back();
|
directoryPath.pop_back();
|
||||||
|
|
||||||
directoryPath += "\\VC\\Tools";
|
vsVars = std::format("\"{}\\VC\\Auxiliary\\Build\\vcvars64.bat\"", directoryPath);
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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::string msvcVersion = folders.front();
|
|
||||||
|
|
||||||
clDir = std::format("{}\\MSVC\\{}\\bin\\Hostx64\\x64", directoryPath, msvcVersion);
|
|
||||||
clangClDir = std::format("{}\\Llvm\\x64\\bin", directoryPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ namespace Crafter {
|
||||||
std::string command = std::format("clang++ --target={} -march={} -mtune={} -std={} -D CRAFTER_BUILD_CONFIGURATION_TARGET_{} -fprebuilt-module-path={}", config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).string());
|
std::string command = std::format("clang++ --target={} -march={} -mtune={} -std={} -D CRAFTER_BUILD_CONFIGURATION_TARGET_{} -fprebuilt-module-path={}", config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).string());
|
||||||
#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)
|
||||||
std::string command = std::format("\"{}\\clang-cl.exe\" /EHsc --target={} -march={} -mtune={} /std:{} /D CRAFTER_BUILD_CONFIGURATION_TARGET_{} -fprebuilt-module-path={}", clangClDir, config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).string());
|
std::string command = std::format("{} clang-cl.exe /EHsc --target={} -march={} -mtune={} /std:{} /D CRAFTER_BUILD_CONFIGURATION_TARGET_{} -fprebuilt-module-path={}", clangClDir, config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).string());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(config.target == "wasm32-wasi") {
|
if(config.target == "wasm32-wasi") {
|
||||||
|
|
@ -470,7 +470,7 @@ namespace Crafter {
|
||||||
libPath += std::format(" /LIBPATH:{}", lib);
|
libPath += std::format(" /LIBPATH:{}", lib);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildResult.errors = RunCommand(std::format("\"{}\\link.exe\" {} {} {}\\{}\\std.o msvcrt.lib kernel32.lib user32.lib /OUT:{}.exe", clDir, libPath, files, exeDir.string(), config.target, (binDir/outputName).string()));
|
buildResult.errors = RunCommand(std::format("{} link.exe {} {} {}\\{}\\std.o msvcrt.lib kernel32.lib user32.lib /OUT:{}.exe", clDir, libPath, files, exeDir.string(), config.target, (binDir/outputName).string()));
|
||||||
#endif
|
#endif
|
||||||
} else if(config.type == CRAFTER_CONFIGURATION_TYPE_LIBRARY) {
|
} else if(config.type == CRAFTER_CONFIGURATION_TYPE_LIBRARY) {
|
||||||
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
||||||
|
|
@ -478,7 +478,7 @@ namespace Crafter {
|
||||||
#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)
|
||||||
RunCommandIgnore(std::format("\"{}\\lib.exe\" {} /OUT:{}.lib", clDir, files, (binDir/fs::path(outputName)).string()));
|
RunCommandIgnore(std::format("{} lib.exe {} /OUT:{}.lib", clDir, files, (binDir/fs::path(outputName)).string()));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,7 @@ namespace Crafter {
|
||||||
export class Project;
|
export class Project;
|
||||||
export class Configuration;
|
export class Configuration;
|
||||||
#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 vsVars;
|
||||||
export std::string clangClDir;
|
|
||||||
export void AutoDetect();
|
export void AutoDetect();
|
||||||
#endif
|
#endif
|
||||||
export std::string RunCommand(const std::string_view cmd);
|
export std::string RunCommand(const std::string_view cmd);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue