Skip to content

Commit 04540bb

Browse files
Merge pull request #229 from microsoft/dev/davidraygoza/ARM64Bugs
Fix Google Test project builds with ARM64
2 parents 5ddbb3b + 2db5b8a commit 04540bb

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

GoogleTestAdapter/GoogleTestProjectTemplate/GoogleTest.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<Configuration>Release</Configuration>
1818
<Platform>x64</Platform>
1919
</ProjectConfiguration>
20-
$arm64config$
20+
$arm64config$
2121
</ItemGroup>
2222
<PropertyGroup Label="Globals">
2323
<ProjectGuid>{$guid1$}</ProjectGuid>
@@ -43,6 +43,7 @@
4343
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
4444
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
4545
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
46+
$arm64Pch$
4647
</ClCompile>
4748
</ItemGroup>
4849
<ItemDefinitionGroup />

GoogleTestAdapter/NewProjectWizard/WizardImplementation.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public class WizardImplementation : IWizard
2626
private const string RuntimeRelease = "$rtrelease$";
2727
private const string RunSilent = "$runsilent$";
2828
private const string ARM64DebugPlatform = "$arm64debugplatform$";
29-
private string arm64DebugXMLChunk = " <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\"> <ClCompile> <PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ARM64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>$rtdebug$</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> </Link> </ItemDefinitionGroup>";
3029
private const string ARM64ReleasePlatform = "$arm64releaseplatform$";
31-
private string arm64ReleaseXMLChunk = " <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\"> <ClCompile> <PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PreprocessorDefinitions>ARM64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>$rtrelease$</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> </Link> </ItemDefinitionGroup>";
3230
private const string ARM64Config = "$arm64config$";
3331
private string arm64ConfigXML = "<ProjectConfiguration Include=\"Debug|ARM64\"> <Configuration>Debug</Configuration> <Platform>ARM64</Platform> </ProjectConfiguration> <ProjectConfiguration Include=\"Release|ARM64\"> <Configuration>Release</Configuration> <Platform>ARM64</Platform> </ProjectConfiguration>";
32+
private const string ARM64Pch = "$arm64Pch$";
33+
private string arm64PchXML = "<PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">Create</PrecompiledHeader> <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">Create</PrecompiledHeader>";
3434
private List<Project> projects = new List<Project>();
3535
private int selectedProjectIndex;
3636
private IWizard nugetWizard;
@@ -151,17 +151,24 @@ public void RunStarted(object automationObject,
151151
throw;
152152
}
153153

154+
string RuntimeDebugValue = "MultiThreadedDebugDLL";
155+
string RuntimeReleaseValue = "MultiThreadedDLL";
154156
if (configurationData.IsRuntimeStatic)
155157
{
156-
replacementsDictionary[RuntimeRelease] = "MultiThreaded";
157-
replacementsDictionary[RuntimeDebug] = "MultiThreadedDebug";
158+
RuntimeDebugValue = "MultiThreadedDebug";
159+
RuntimeReleaseValue = "MultiThreaded";
158160
}
159161
else
160162
{
161-
replacementsDictionary[RuntimeRelease] = "MultiThreadedDLL";
162-
replacementsDictionary[RuntimeDebug] = "MultiThreadedDebugDLL";
163+
RuntimeDebugValue = "MultiThreadedDebugDLL";
164+
RuntimeReleaseValue = "MultiThreadedDLL";
163165
}
164166

167+
string arm64DebugXMLChunk = $" <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\"> <ClCompile> <PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>ARM64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>{RuntimeDebugValue}</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> </Link> </ItemDefinitionGroup>";
168+
string arm64ReleaseXMLChunk = $" <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\"> <ClCompile> <PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PreprocessorDefinitions>ARM64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>{RuntimeReleaseValue}</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> </Link> </ItemDefinitionGroup>";
169+
replacementsDictionary[RuntimeDebug] = RuntimeDebugValue;
170+
replacementsDictionary[RuntimeRelease] = RuntimeReleaseValue;
171+
165172
if (!isPlatformSet)
166173
{
167174
IEnumerable<TargetPlatformSDK> platformSdks = ToolLocationHelper.GetTargetPlatformSdks();
@@ -184,11 +191,13 @@ public void RunStarted(object automationObject,
184191
.OrderByDescending(p => p.Version).ToList();
185192

186193
if (!this.IsARM64()) {
194+
arm64ConfigXML = "";
195+
arm64PchXML = "";
187196
arm64DebugXMLChunk = "";
188197
arm64ReleaseXMLChunk = "";
189-
arm64ConfigXML = "";
190198
}
191199
replacementsDictionary[ARM64Config] = arm64ConfigXML;
200+
replacementsDictionary[ARM64Pch] = arm64PchXML;
192201
replacementsDictionary[ARM64DebugPlatform] = arm64DebugXMLChunk;
193202
replacementsDictionary[ARM64ReleasePlatform] = arm64ReleaseXMLChunk;
194203

0 commit comments

Comments
 (0)