1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Projucer (MSVC): Fix multi-arch PCH project generation

Co-authored-by: Ryaan Ahmed <ryaan.ahmed@bandlab.com>
This commit is contained in:
Oli 2025-04-23 13:27:06 +01:00
parent 243d3756fc
commit 522217d9c5

View file

@ -1350,38 +1350,38 @@ public:
auto& config = *static_cast<const MSVCBuildConfiguration*> (&*i);
for (const auto& arch : config.getArchitectures())
auto pchFileContent = config.getPrecompiledHeaderFileContent();
if (pchFileContent.isEmpty())
continue;
auto pchFile = owner.getTargetFolder().getChildFile (config.getPrecompiledHeaderFilename())
.withFileExtension (".h");
build_tools::writeStreamToFile (pchFile, [&] (MemoryOutputStream& mo)
{
auto pchFileContent = config.getPrecompiledHeaderFileContent();
mo << pchFileContent;
});
if (pchFileContent.isEmpty())
continue;
auto pchSourceFile = pchFile.withFileExtension (".cpp");
auto pchFile = owner.getTargetFolder().getChildFile (config.getPrecompiledHeaderFilename()).withFileExtension (".h");
build_tools::writeStreamToFile (pchSourceFile, [this] (MemoryOutputStream& mo)
{
mo.setNewLineString (owner.getNewLineString());
build_tools::writeStreamToFile (pchFile, [&] (MemoryOutputStream& mo)
{
mo << pchFileContent;
});
writeAutoGenWarningComment (mo);
auto pchSourceFile = pchFile.withFileExtension (".cpp");
mo << " This is an empty source file generated by JUCE required for Visual Studio PCH." << newLine
<< newLine
<< "*/" << newLine
<< newLine;
});
build_tools::writeStreamToFile (pchSourceFile, [this] (MemoryOutputStream& mo)
{
mo.setNewLineString (owner.getNewLineString());
auto* pchSourceElement = cpps.createNewChildElement ("ClCompile");
pchSourceElement->setAttribute ("Include", prependDot (pchSourceFile.getFileName()));
writeAutoGenWarningComment (mo);
mo << " This is an empty source file generated by JUCE required for Visual Studio PCH." << newLine
<< newLine
<< "*/" << newLine
<< newLine;
});
auto* pchSourceElement = cpps.createNewChildElement ("ClCompile");
pchSourceElement->setAttribute ("Include", prependDot (pchSourceFile.getFileName()));
for (const auto& arch : config.getArchitectures())
setSourceFilePCHSettings (*pchSourceElement, pchFile, "Create", config, arch);
}
}
}