/ Cpp.Build.props
Cpp.Build.props
  1  <?xml version="1.0" encoding="utf-8"?>
  2  <Project ToolsVersion="4.0"
  3    xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  4  
  5    <!-- Skip building C++ test projects when BuildTests=false -->
  6    <PropertyGroup Condition="'$(_IsSkippedTestProject)' == 'true'">
  7      <UsePrecompiledHeaders>false</UsePrecompiledHeaders>
  8      <RunCodeAnalysis>false</RunCodeAnalysis>
  9    </PropertyGroup>
 10  
 11    <!-- Project configurations -->
 12    <ItemGroup Label="ProjectConfigurations">
 13      <ProjectConfiguration Include="Debug|x64">
 14        <Configuration>Debug</Configuration>
 15        <Platform>x64</Platform>
 16      </ProjectConfiguration>
 17      <ProjectConfiguration Include="Release|x64">
 18        <Configuration>Release</Configuration>
 19        <Platform>x64</Platform>
 20      </ProjectConfiguration>
 21      <ProjectConfiguration Include="Debug|ARM64">
 22        <Configuration>Debug</Configuration>
 23        <Platform>ARM64</Platform>
 24      </ProjectConfiguration>
 25      <ProjectConfiguration Include="Release|ARM64">
 26        <Configuration>Release</Configuration>
 27        <Platform>ARM64</Platform>
 28      </ProjectConfiguration>
 29    </ItemGroup>
 30  
 31    <!-- Run code analysis locally and in PR CI, but not on release CI -->
 32    <PropertyGroup Condition="'$(SkipCppCodeAnalysis)' == ''">
 33      <RunCodeAnalysis>true</RunCodeAnalysis>
 34      <CodeAnalysisRuleSet>$(MsbuildThisFileDirectory)\CppRuleSet.ruleset</CodeAnalysisRuleSet>
 35      <CAExcludePath>$(MSBuildThisFileDirectory)deps;$(MSBuildThisFileDirectory)packages;$(CAExcludePath)</CAExcludePath>
 36    </PropertyGroup>
 37  
 38    <!-- C++ source compile-specific things for all configurations -->
 39    <PropertyGroup>
 40      <PreferredToolArchitecture>x64</PreferredToolArchitecture>
 41      <PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
 42      <VcpkgEnabled>false</VcpkgEnabled>
 43      <ReplaceWildcardsInProjectItems>true</ReplaceWildcardsInProjectItems>
 44      <ExternalIncludePath>$(MSBuildThisFileDirectory)deps;$(MSBuildThisFileDirectory)packages;$(ExternalIncludePath)</ExternalIncludePath>
 45      <!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
 46      <!-- This covers the case where a .dll exports a .lib, but doesn't have any ClCompile entries. -->
 47      <LinkControlFlowGuard>Guard</LinkControlFlowGuard>
 48    </PropertyGroup>
 49    <ItemDefinitionGroup>
 50      <ClCompile>
 51        <!-- Make angle-bracket includes external and turn off code analysis for them -->
 52        <TreatAngleIncludeAsExternal>true</TreatAngleIncludeAsExternal>
 53        <ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
 54        <DisableAnalyzeExternal>true</DisableAnalyzeExternal>
 55  
 56        <MultiProcessorCompilation>true</MultiProcessorCompilation>
 57        <PrecompiledHeader Condition="'$(UsePrecompiledHeaders)' != 'false'">Use</PrecompiledHeader>
 58        <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
 59        <WarningLevel>Level4</WarningLevel>
 60        <DisableSpecificWarnings>4679;4706;4874;5271;%(DisableSpecificWarnings)</DisableSpecificWarnings>
 61        <DisableAnalyzeExternal >true</DisableAnalyzeExternal>
 62        <ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
 63        <ConformanceMode>false</ConformanceMode>
 64        <TreatWarningAsError>true</TreatWarningAsError>
 65        <LanguageStandard>stdcpplatest</LanguageStandard>
 66        <BuildStlModules>false</BuildStlModules>
 67        <AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
 68        <!-- TODO: _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for compatibility with VS 17.8. Check if we can remove. -->
 69        <PreprocessorDefinitions>_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 70        <!-- CLR + CFG are not compatible >:{ -->
 71        <ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
 72        <DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
 73        <SDLCheck>true</SDLCheck>
 74      </ClCompile>
 75      <Link>
 76        <SubSystem>Windows</SubSystem>
 77      </Link>
 78      <Lib>
 79        <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
 80      </Lib>
 81    </ItemDefinitionGroup>
 82  
 83    <!-- C++ source compile-specific things for Debug/Release configurations -->
 84    <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
 85      <ClCompile>
 86        <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 87        <Optimization>Disabled</Optimization>
 88        <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
 89      </ClCompile>
 90      <Link>
 91        <GenerateDebugInformation>true</GenerateDebugInformation>
 92      </Link>
 93    </ItemDefinitionGroup>
 94    <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
 95      <ClCompile>
 96        <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 97        <Optimization>MaxSpeed</Optimization>
 98        <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
 99        <FunctionLevelLinking>true</FunctionLevelLinking>
100        <IntrinsicFunctions>true</IntrinsicFunctions>
101      </ClCompile>
102      <Link>
103        <GenerateDebugInformation>true</GenerateDebugInformation>
104        <EnableCOMDATFolding>true</EnableCOMDATFolding>
105        <OptimizeReferences>true</OptimizeReferences>
106      </Link>
107    </ItemDefinitionGroup>
108  
109    <!-- Global props OverrideWindowsTargetPlatformVersion-->
110    <PropertyGroup Label="Globals">
111      <WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
112      <TargetPlatformVersion>10.0.26100.0</TargetPlatformVersion>
113      <WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
114    </PropertyGroup>
115  
116    <!-- Props that are constant for both Debug and Release configurations -->
117    <PropertyGroup Label="Configuration">
118      <PlatformToolset>v143</PlatformToolset>
119      <PlatformToolset Condition="'$(VisualStudioVersion)' == '18.0'">v145</PlatformToolset>
120      <CharacterSet>Unicode</CharacterSet>
121      <DesktopCompatible>true</DesktopCompatible>
122      <SpectreMitigation>Spectre</SpectreMitigation>
123    </PropertyGroup>
124  
125    <!-- Debug/Release props -->
126    <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
127      <UseDebugLibraries>true</UseDebugLibraries>
128      <LinkIncremental>true</LinkIncremental>
129    </PropertyGroup>
130    <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
131      <UseDebugLibraries>false</UseDebugLibraries>
132      <WholeProgramOptimization>true</WholeProgramOptimization>
133      <LinkIncremental>false</LinkIncremental>
134    </PropertyGroup>
135  
136  </Project>