Skip to content

Commit a23bd54

Browse files
committed
Add a stress test project that includes every single projected SDK header and treats warnings as errors
1 parent fa079fb commit a23bd54

File tree

5 files changed

+153
-0
lines changed

5 files changed

+153
-0
lines changed

cppwinrt.sln

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
132132
run_tests.cmd = run_tests.cmd
133133
EndProjectSection
134134
EndProject
135+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress_test", "test\stress_test\stress_test.vcxproj", "{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}"
136+
ProjectSection(ProjectDependencies) = postProject
137+
{A91B8BF3-28E4-4D9E-8DBA-64B70E4F0270} = {A91B8BF3-28E4-4D9E-8DBA-64B70E4F0270}
138+
{D613FB39-5035-4043-91E2-BAB323908AF4} = {D613FB39-5035-4043-91E2-BAB323908AF4}
139+
{F1C915B3-2C64-4992-AFB7-7F035B1A7607} = {F1C915B3-2C64-4992-AFB7-7F035B1A7607}
140+
EndProjectSection
141+
EndProject
135142
Global
136143
GlobalSection(SolutionConfigurationPlatforms) = preSolution
137144
Debug|ARM64 = Debug|ARM64
@@ -394,6 +401,18 @@ Global
394401
{D4C8F881-84D5-4A7B-8BDE-AB4E34A05374}.Release|x64.Build.0 = Release|x64
395402
{D4C8F881-84D5-4A7B-8BDE-AB4E34A05374}.Release|x86.ActiveCfg = Release|Win32
396403
{D4C8F881-84D5-4A7B-8BDE-AB4E34A05374}.Release|x86.Build.0 = Release|Win32
404+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|ARM64.ActiveCfg = Debug|ARM64
405+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|ARM64.Build.0 = Debug|ARM64
406+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x64.ActiveCfg = Debug|x64
407+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x64.Build.0 = Debug|x64
408+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x86.ActiveCfg = Debug|Win32
409+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x86.Build.0 = Debug|Win32
410+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|ARM64.ActiveCfg = Release|ARM64
411+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|ARM64.Build.0 = Release|ARM64
412+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x64.ActiveCfg = Release|x64
413+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x64.Build.0 = Release|x64
414+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x86.ActiveCfg = Release|Win32
415+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x86.Build.0 = Release|Win32
397416
EndGlobalSection
398417
GlobalSection(SolutionProperties) = preSolution
399418
HideSolutionNode = FALSE
@@ -417,6 +436,7 @@ Global
417436
{08C40663-B6A3-481E-8755-AE32BAD99501} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0}
418437
{5FF6CD6C-515A-4D55-97B6-62AD9BCB77EA} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0}
419438
{D4C8F881-84D5-4A7B-8BDE-AB4E34A05374} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0}
439+
{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0}
420440
EndGlobalSection
421441
GlobalSection(ExtensibilityGlobals) = postSolution
422442
SolutionGuid = {2783B8FD-EA3B-4D6B-9F81-662D289E02AA}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[CmdletBinding()]
2+
Param
3+
(
4+
[Parameter(Mandatory=$true)]
5+
[string]$generatedFilesDir,
6+
7+
[Parameter(Mandatory=$true)]
8+
[string]$cppwinrtHeaderFolder
9+
)
10+
11+
if (!(Test-Path $generatedFilesDir))
12+
{
13+
mkdir $generatedFilesDir;
14+
}
15+
16+
$generatedPchContent = "#pragma once`r`n`r`n";
17+
18+
$allHeaders = Get-ChildItem "$cppwinrtHeaderFolder\\Windows.*.h";
19+
foreach ($header in $allHeaders)
20+
{
21+
$chunks = $header.FullName.Split("\\");
22+
$header = $chunks[$chunks.Length - 1];
23+
$generatedPchContent += "#include <winrt/$header>`r`n";
24+
}
25+
26+
Set-Content -Path "$generatedFilesDir\\pch.h" -Value $generatedPchContent -Force -Encoding UTF8

test/stress_test/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "pch.h"
2+
3+
using namespace winrt;
4+
5+
int main()
6+
{
7+
}

test/stress_test/pch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "pch.h"
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|ARM64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>ARM64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|Win32">
9+
<Configuration>Debug</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Release|ARM64">
13+
<Configuration>Release</Configuration>
14+
<Platform>ARM64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|Win32">
17+
<Configuration>Release</Configuration>
18+
<Platform>Win32</Platform>
19+
</ProjectConfiguration>
20+
<ProjectConfiguration Include="Debug|x64">
21+
<Configuration>Debug</Configuration>
22+
<Platform>x64</Platform>
23+
</ProjectConfiguration>
24+
<ProjectConfiguration Include="Release|x64">
25+
<Configuration>Release</Configuration>
26+
<Platform>x64</Platform>
27+
</ProjectConfiguration>
28+
</ItemGroup>
29+
<PropertyGroup Label="Globals">
30+
<CppWinRTOptimized>true</CppWinRTOptimized>
31+
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
32+
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
33+
<MinimalCoreWin>true</MinimalCoreWin>
34+
<VCProjectVersion>16.0</VCProjectVersion>
35+
<ProjectGuid>{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}</ProjectGuid>
36+
<RootNamespace>stress_test</RootNamespace>
37+
<ProjectName>stress_test</ProjectName>
38+
<ConfigurationType>Application</ConfigurationType>
39+
<!-- Not using the real nuget package so override-->
40+
<CppWinRTPackageDir>..\_build\$(Platform)\$(Configuration)</CppWinRTPackageDir>
41+
<CppWinRTPackage>false</CppWinRTPackage>
42+
</PropertyGroup>
43+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
44+
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
45+
<UseDebugLibraries>true</UseDebugLibraries>
46+
</PropertyGroup>
47+
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
48+
<UseDebugLibraries>false</UseDebugLibraries>
49+
<WholeProgramOptimization>true</WholeProgramOptimization>
50+
</PropertyGroup>
51+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
52+
<ItemDefinitionGroup>
53+
<ClCompile>
54+
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..;..\..\cppwinrt</AdditionalIncludeDirectories>
55+
<TreatWarningAsError>true</TreatWarningAsError>
56+
</ClCompile>
57+
<Link>
58+
<SubSystem>Console</SubSystem>
59+
</Link>
60+
<PreBuildEvent>
61+
<!-- <Command>$(CppWinRTDir)cppwinrt -in $(OutputPath)test_component.winmd $(OutputPath)test_component_no_pch.winmd -out "$(ProjectDir)Generated Files" -ref sdk -verbose</Command> -->
62+
<Command>powershell.exe -NoProfile -NonInteractive -File "$(ProjectDir)GeneratePrecompiledHeader.ps1" -generatedFilesDir "$(ProjectDir)Generated Files" -cppwinrtHeaderFolder "$(CppWinRTDir)\winrt"</Command>
63+
</PreBuildEvent>
64+
</ItemDefinitionGroup>
65+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
66+
<ClCompile>
67+
<Optimization>MaxSpeed</Optimization>
68+
<FunctionLevelLinking>true</FunctionLevelLinking>
69+
<IntrinsicFunctions>true</IntrinsicFunctions>
70+
<PreprocessorDefinitions>NOMINMAX;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
71+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
72+
</ClCompile>
73+
<Link>
74+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
75+
<OptimizeReferences>true</OptimizeReferences>
76+
</Link>
77+
</ItemDefinitionGroup>
78+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
79+
<ClCompile>
80+
<Optimization>Disabled</Optimization>
81+
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
82+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
83+
</ClCompile>
84+
</ItemDefinitionGroup>
85+
<ItemGroup>
86+
<ClCompile Include="main.cpp">
87+
<PrecompiledHeader>Use</PrecompiledHeader>
88+
</ClCompile>
89+
<ClCompile Include="pch.cpp">
90+
<PrecompiledHeader>Create</PrecompiledHeader>
91+
</ClCompile>
92+
</ItemGroup>
93+
<ItemGroup>
94+
<ClInclude Include="$(ProjectDir)Generated Files\pch.h" />
95+
</ItemGroup>
96+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
97+
<ImportGroup Label="ExtensionTargets">
98+
</ImportGroup>
99+
</Project>

0 commit comments

Comments
 (0)