Skip to content

Commit f6c219c

Browse files
authored
Merge pull request #226 from microsoft/peter-update
Adding ARM64 to the configuration
2 parents 14b1b3d + fe0f694 commit f6c219c

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

GoogleTestAdapter/GoogleTestProjectTemplate/GoogleTest.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<Configuration>Release</Configuration>
1818
<Platform>x64</Platform>
1919
</ProjectConfiguration>
20+
$arm64config$
2021
</ItemGroup>
2122
<PropertyGroup Label="Globals">
2223
<ProjectGuid>{$guid1$}</ProjectGuid>
@@ -77,6 +78,7 @@
7778
<SubSystem>Console</SubSystem>
7879
</Link>
7980
</ItemDefinitionGroup>
81+
$arm64debugplatform$
8082
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
8183
<ClCompile>
8284
<PrecompiledHeader>Use</PrecompiledHeader>
@@ -109,4 +111,5 @@
109111
<EnableCOMDATFolding>true</EnableCOMDATFolding>
110112
</Link>
111113
</ItemDefinitionGroup>
114+
$arm64releaseplatform$
112115
</Project>

GoogleTestAdapter/NewProjectWizard/WizardImplementation.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ public class WizardImplementation : IWizard
2525
private const string RuntimeDebug = "$rtdebug$";
2626
private const string RuntimeRelease = "$rtrelease$";
2727
private const string RunSilent = "$runsilent$";
28+
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>";
30+
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>";
32+
private const string ARM64Config = "$arm64config$";
33+
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>";
2834
private List<Project> projects = new List<Project>();
2935
private int selectedProjectIndex;
3036
private IWizard nugetWizard;
@@ -176,6 +182,16 @@ public void RunStarted(object automationObject,
176182
.Select(moniker => TryParsePlatformVersion(moniker))
177183
.Where(name => name != null)
178184
.OrderByDescending(p => p.Version).ToList();
185+
186+
if (!this.IsARM64()) {
187+
arm64DebugXMLChunk = "";
188+
arm64ReleaseXMLChunk = "";
189+
arm64ConfigXML = "";
190+
}
191+
replacementsDictionary[ARM64Config] = arm64ConfigXML;
192+
replacementsDictionary[ARM64DebugPlatform] = arm64DebugXMLChunk;
193+
replacementsDictionary[ARM64ReleasePlatform] = arm64ReleaseXMLChunk;
194+
179195
Platform latestPlatform = allPlatformsForLatestSdk.FirstOrDefault();
180196

181197
if (latestPlatform == null)
@@ -195,6 +211,16 @@ public void RunStarted(object automationObject,
195211
}
196212
}
197213

214+
/// <summary>
215+
/// Checks architecture of Visual Studio Process.
216+
/// </summary>
217+
/// <returns>boolean indicating if running arm64 VS</returns>
218+
protected bool IsARM64() {
219+
string cpu = System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE", EnvironmentVariableTarget.Process);
220+
221+
return cpu.Equals("ARM64", StringComparison.OrdinalIgnoreCase);
222+
}
223+
198224
// This method is only called for item templates,
199225
// not for project templates.
200226
public bool ShouldAddProjectItem(string filePath)

0 commit comments

Comments
 (0)