JUCE
JUCE copied to clipboard
[Bug]: Enabling a precompiled header and multiple architectures results in a malformed Visual Studio project
Detailed steps on how to reproduce the bug
Steps to Repro
See jucer file in first comment for an easy repro example.
- Create a new blank project in Projucer
- Create a Visual Studio 2022 exporter
- Create a new header file
- In the Visual Studio 2022 exporter (Debug or Release) enable "Use Precompiled Header", and...
- Select more than one Architecture (x64 and ARM64EC is our use case, but any two will do)
- Save and open in IDE
Result
vcxproj file is malformed and the solution/project will not open. The following is emitted in the ItemGroup containing all source to compile:
<ClCompile Include=".\JucePrecompiledHeader_Debug.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include=".\JucePrecompiledHeader_Debug.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
</ClCompile>
Note that there are two ClCompile entries for the debug PCH file.
What is the expected behaviour?
Valid output would look like this (and adjusting to this manually fixes the project):
<ClCompile Include=".\JucePrecompiledHeader_Debug.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64EC'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\JucePrecompiledHeader.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">JucePrecompiledHeader_Debug.h</ForcedIncludeFiles>
</ClCompile>
i.e., the various platform specific entries should be placed within the same ClCompile entry, rather than creating multiple ClCompile entries for the same platform.
Note that this behavior is already correct for other source files, and is only broken for precompiled headers.
Operating systems
Windows
What versions of the operating systems?
I'm on Windows 11 build 27788 (latest Canary channel build), but this is happening for team members on older builds, too.
Architectures
x86_64, Arm64/aarch64, Arm64EC (Windows)
Testing on the develop branch
The bug is present on the develop branch
Code of Conduct
- [x] I agree to follow the Code of Conduct