-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do a compiler options pass on all binaries contributing to WinAppSDK (#…
…2629) Tweak various compiler options for optimization (e.g. /GR-) and correctness/productivity (e.g. /W4). Project-wide standardization via new \WindowsAppSDK.Build.Cpp.props. See for more details. Corrected several inconsistencies across projects e.g. given Debug|Release + x86+x64+arm64 = 6 permutations, but some projects had an option set for only 5, or only 1. Most projects were mostly already setting most of these options so their changes were mostly removing the now-redundant project-specific setting and let the top-level project-wide standards handle it. This now standardizes all C++ projects to... * Compile (all): `/W4 /sdl /permissive- /std:c++17 /GR-` (except 2 projects that explicitly set `/std:c++20`) * Compile (debug): `/Od` * Compile (release): `/GS /GF /GL /Gy /Gw /Ob2 /Oi /Os /Oy` * Link (debug) `/DEBUG:FULL /INCREMENTAL` * Link (release): `/INCREMENTAL:NO /LTCG /OPT:ICF /OPT:REF` https://task.ms/39994837 Foundation https://task.ms/39994852 MRTCore * Add standardized (project-wide) C++ compile and link options * Remove ARM support (not supported, but some ARM-conditional fragments weren't removed) * Removed <WarningLevel> from all projects. Fixed up warnings masked by projects who'd set Level3 * Added SDLCheck for all builds. Added Disable-Optimization for Debug builds. Remove properties in *vcxproj redundnat with standardized options * Removed redundant <Optimization> from *vcxproj * Fixed warnings. Removed unnecessary delayload * Fixed some inconsistencies in project settings * Fixed AccessControlTests weren't copying the Bootstrap dll to the test's OutDir and thus the test dll wouldn't load * Fix some warnings in MRT. Had to disable read-only string pooling and strictstrings as workaround for some funky issues in MrtBaseUnitTests for now; filed bug for follow up to fix the errors * Corrected some comments. Added the missing LTCG option * Changed LTCG from fast to normal * Updated FavorSizeOrSpeed to Size instead of Speed * Move LinkIncremental=false for Release builds to the top-level project-wide standard * Host LinkIncremental=true if Configuration=Debug to be project wide setting (projects were routinely doing this locally, but inconsistently) * Fixed a comment * Added a cautionary note about why Detours.vcxproj has seemingly redundant or contradictory options and to be wary of making any changes * Removed options redundant with WindowsAppSDK.Build.Cpp.props * Elevate GenerateDebugInformation=Full to project-wide and remove redundancies. Move dev\WindowsAppSDK.Build.Cpp.props content to project wide (not just \dev) and delete the now obsolete dev\WindowsAppSDK.Build.Cpp.props (really only amounted to /ZH:SHA_256). * Incorporated feedback
- Loading branch information
1 parent
9c54e08
commit bdde939
Showing
60 changed files
with
237 additions
and
3,133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<!-- Build with the hybrid CRT (Universal CRT + Static VS CRT (for what little the Universal CRT doesn't cover) --> | ||
<Import Project="$(MSBuildThisFileDirectory)HybridCRT.props" /> | ||
|
||
<!-- Build with APIscan-friendly compiler+linker options --> | ||
<Import Project="$(MSBuildThisFileDirectory)ApiScan.Cpp.props" /> | ||
|
||
<!-- Common (all Configurations) options --> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<!-- /std:c++17 Enable ISO C++17 Standard --> | ||
<LanguageStandard>stdcpp17</LanguageStandard> | ||
|
||
<!-- /permissive- Enable Conformance mode (i.e. Disable 'permissive' mode) --> | ||
<ConformanceMode>true</ConformanceMode> | ||
|
||
<!-- /W4 Enable max warning level --> | ||
<WarningLevel>Level4</WarningLevel> | ||
|
||
<!-- /sdk Enable additional security checks--> | ||
<SDLCheck>true</SDLCheck> | ||
|
||
<!-- /GR- Disable RTTI (causes binary bloat) --> | ||
<RuntimeTypeInfo>false</RuntimeTypeInfo> | ||
|
||
<!-- /ZH:SHA_256 Hash algorithm for file checksums in debug info --> | ||
<AdditionalOptions>%(AdditionalOptions) /ZH:SHA_256</AdditionalOptions> | ||
</ClCompile> | ||
<Link> | ||
<!-- /DEBUG:FULL Create PDF containing full debug information --> | ||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
|
||
<!-- Debug-specific options --> | ||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> | ||
<!-- /INCREMENTAL Enable incremental linking --> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)' == 'Debug'"> | ||
<ClCompile> | ||
<!-- /d- Disable optimization --> | ||
<Optimization>Disabled</Optimization> | ||
</ClCompile> | ||
<Link> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
|
||
<!-- Release-specific options --> | ||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
<!-- /INCREMENTAL:NO Disable incremental linking --> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)' == 'Release'"> | ||
<ClCompile> | ||
<!-- /GS Enable Control Flow Guard --> | ||
<ControlFlowGuard>Guard</ControlFlowGuard> | ||
|
||
<!-- Compile-time optimizations: | ||
/GF Enable read-only string pooling (eliminate duplicate strings) | ||
/GL Whole Program Optimization | ||
/Gy Enable function-level linking | ||
/Gw Optimize Global Data (https://docs.microsoft.com/en-us/cpp/build/reference/gw-optimize-global-data) | ||
--> | ||
<StringPooling>true</StringPooling> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<AdditionalOptions>%(AdditionalOptions) /Gw</AdditionalOptions> | ||
|
||
<!-- /Oxs Enable most speed optimizations | ||
NOTE: /Oxs is short-hand for multiple options: | ||
/Ob2 Enable inline function expansion (/Ob2 = Any Suitable) | ||
/Oi Enable intrinsic functions | ||
/Os Favor fast code | ||
/Oy Omit frame pointers | ||
--> | ||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed> | ||
<OmitFramePointers>true</OmitFramePointers> | ||
</ClCompile> | ||
<Link> | ||
<!-- Link-time optimizations: | ||
/LCTG Enable Link Time Code Generation | ||
/OPT:ICF Enable COMDAT folding | ||
/OPT:REF Optimize references | ||
--> | ||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.