Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Enabling a precompiled header and multiple architectures results in a malformed Visual Studio project #1520

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -1350,36 +1350,36 @@ class MSVCProjectExporterBase : public ProjectExporter

auto& config = *static_cast<const MSVCBuildConfiguration*> (&*i);

for (const auto& arch : config.getArchitectures())
{
auto pchFileContent = config.getPrecompiledHeaderFileContent();
auto pchFileContent = config.getPrecompiledHeaderFileContent();

if (pchFileContent.isEmpty())
continue;
if (pchFileContent.isEmpty())
continue;

auto pchFile = owner.getTargetFolder().getChildFile (config.getPrecompiledHeaderFilename()).withFileExtension (".h");
auto pchFile = owner.getTargetFolder().getChildFile (config.getPrecompiledHeaderFilename()).withFileExtension (".h");

build_tools::writeStreamToFile (pchFile, [&] (MemoryOutputStream& mo)
{
mo << pchFileContent;
});
build_tools::writeStreamToFile (pchFile, [&] (MemoryOutputStream& mo)
{
mo << pchFileContent;
});

auto pchSourceFile = pchFile.withFileExtension (".cpp");
auto pchSourceFile = pchFile.withFileExtension (".cpp");

build_tools::writeStreamToFile (pchSourceFile, [this] (MemoryOutputStream& mo)
{
mo.setNewLineString (owner.getNewLineString());
build_tools::writeStreamToFile (pchSourceFile, [this] (MemoryOutputStream& mo)
{
mo.setNewLineString (owner.getNewLineString());
writeAutoGenWarningComment (mo);

writeAutoGenWarningComment (mo);
mo << " This is an empty source file generated by JUCE required for Visual Studio PCH." << newLine
<< newLine
<< "*/" << newLine
<< newLine;
});

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()));

auto* pchSourceElement = cpps.createNewChildElement ("ClCompile");
pchSourceElement->setAttribute ("Include", prependDot (pchSourceFile.getFileName()));
for (const auto& arch : config.getArchitectures())
{
setSourceFilePCHSettings (*pchSourceElement, pchFile, "Create", config, arch);
}
}
Expand Down