mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-11-04 12:01:21 +00:00
Spectre mitigations were briefly required for all MSVC-compiled code; however, it is no longer recommended best practice. These mitigations were always fragile and relied heavily on how the compiler generated the code. Removing mitigations here simplifies the build requirements.
182 lines
9.9 KiB
XML
182 lines
9.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project ToolsVersion="4.0"
|
|
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<!-- Skip building C++ test projects when BuildTests=false -->
|
|
<PropertyGroup Condition="'$(_IsSkippedTestProject)' == 'true'">
|
|
<UsePrecompiledHeaders>false</UsePrecompiledHeaders>
|
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
|
</PropertyGroup>
|
|
|
|
<!-- Project configurations -->
|
|
<ItemGroup Label="ProjectConfigurations">
|
|
<ProjectConfiguration Include="Debug|x64">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|x64">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Debug|ARM64">
|
|
<Configuration>Debug</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|ARM64">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>ARM64</Platform>
|
|
</ProjectConfiguration>
|
|
</ItemGroup>
|
|
|
|
<!-- Run code analysis locally and in PR CI, but not on release CI -->
|
|
<PropertyGroup Condition="'$(SkipCppCodeAnalysis)' == ''">
|
|
<RunCodeAnalysis>true</RunCodeAnalysis>
|
|
<CodeAnalysisRuleSet>$(MsbuildThisFileDirectory)\CppRuleSet.ruleset</CodeAnalysisRuleSet>
|
|
<CAExcludePath>$(MSBuildThisFileDirectory)deps;$(MSBuildThisFileDirectory)packages;$(CAExcludePath)</CAExcludePath>
|
|
</PropertyGroup>
|
|
|
|
<!-- C++ source compile-specific things for all configurations -->
|
|
<PropertyGroup>
|
|
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
|
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
|
|
<!-- vcpkg.targets is imported via Cpp.Build.targets after Microsoft.Cpp.targets. -->
|
|
<ForceImportAfterCppTargets>$(MSBuildThisFileDirectory)Cpp.Build.targets</ForceImportAfterCppTargets>
|
|
<ReplaceWildcardsInProjectItems>true</ReplaceWildcardsInProjectItems>
|
|
<ExternalIncludePath>$(MSBuildThisFileDirectory)deps;$(MSBuildThisFileDirectory)packages;$(ExternalIncludePath)</ExternalIncludePath>
|
|
<!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
|
|
<!-- This covers the case where a .dll exports a .lib, but doesn't have any ClCompile entries. -->
|
|
<LinkControlFlowGuard>Guard</LinkControlFlowGuard>
|
|
</PropertyGroup>
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<!-- Make angle-bracket includes external and turn off code analysis for them -->
|
|
<TreatAngleIncludeAsExternal>true</TreatAngleIncludeAsExternal>
|
|
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
|
|
<DisableAnalyzeExternal>true</DisableAnalyzeExternal>
|
|
|
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
<PrecompiledHeader Condition="'$(UsePrecompiledHeaders)' != 'false'">Use</PrecompiledHeader>
|
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
<WarningLevel>Level4</WarningLevel>
|
|
<DisableSpecificWarnings>4679;4706;4874;5271;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
<DisableAnalyzeExternal >true</DisableAnalyzeExternal>
|
|
<ExternalWarningLevel>TurnOffAllWarnings</ExternalWarningLevel>
|
|
<ConformanceMode>false</ConformanceMode>
|
|
<TreatWarningAsError>true</TreatWarningAsError>
|
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
|
<BuildStlModules>false</BuildStlModules>
|
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
|
<!-- TODO: _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for compatibility with VS 17.8. Check if we can remove. -->
|
|
<!-- TODO: _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS for VS 2026 (MSVC 14.51+). The STL turned
|
|
<experimental/coroutine> into a hard error (STL1011), and C++/WinRT's base.h still falls back to it when
|
|
__cpp_lib_coroutine isn't defined at include time. Remove once C++/WinRT no longer references the experimental header. -->
|
|
<PreprocessorDefinitions>_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<!-- CLR + CFG are not compatible >:{ -->
|
|
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
|
|
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
|
|
<SDLCheck>true</SDLCheck>
|
|
</ClCompile>
|
|
<Link>
|
|
<SubSystem>Windows</SubSystem>
|
|
</Link>
|
|
<Lib>
|
|
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
|
|
</Lib>
|
|
</ItemDefinitionGroup>
|
|
|
|
<!-- C++ source compile-specific things for Debug/Release configurations -->
|
|
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<Optimization>Disabled</Optimization>
|
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
</ClCompile>
|
|
<Link>
|
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
<Optimization>MaxSpeed</Optimization>
|
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
</ClCompile>
|
|
<Link>
|
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
<OptimizeReferences>true</OptimizeReferences>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
|
|
<!-- Global props OverrideWindowsTargetPlatformVersion-->
|
|
<PropertyGroup Label="Globals">
|
|
<WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
|
|
<TargetPlatformVersion>10.0.26100.0</TargetPlatformVersion>
|
|
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
|
|
</PropertyGroup>
|
|
|
|
<!-- Props that are constant for both Debug and Release configurations -->
|
|
<PropertyGroup Label="Configuration">
|
|
<PlatformToolset>v143</PlatformToolset>
|
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '18.0'">v145</PlatformToolset>
|
|
<CharacterSet>Unicode</CharacterSet>
|
|
<DesktopCompatible>true</DesktopCompatible>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
vcpkg integration. Set globally and loaded before Microsoft.Cpp.props (via
|
|
ForceImportBeforeCppProps) so that vcpkg.props' ClCompile hook is in place
|
|
before the C++ targets run. VcpkgRoot is resolved via the same three-tier
|
|
fallback used by microsoft/terminal (env var → VS-shipped → deps/vcpkg).
|
|
-->
|
|
<PropertyGroup Label="vcpkg">
|
|
<VcpkgEnabled>true</VcpkgEnabled>
|
|
<VcpkgEnableManifest>true</VcpkgEnableManifest>
|
|
<VcpkgManifestEnabled>true</VcpkgManifestEnabled>
|
|
<VcpkgManifestRoot>$(MSBuildThisFileDirectory)</VcpkgManifestRoot>
|
|
<VcpkgOSTarget>windows</VcpkgOSTarget>
|
|
<VcpkgUseStatic>true</VcpkgUseStatic>
|
|
<!--
|
|
Force VcpkgConfiguration to follow $(Configuration). Without this,
|
|
vcpkg.props infers VcpkgConfiguration from $(UseDebugLibraries), which
|
|
Microsoft.Cpp.Default.props has already defaulted to 'false' by the
|
|
time vcpkg.props is imported here (the PowerToys-wide Debug override
|
|
below runs LATER). That would silently link the Release-built spdlog
|
|
into Debug consumers and trigger LNK2038 (MT/MTd, _ITERATOR_DEBUG_LEVEL).
|
|
-->
|
|
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
|
|
<!-- vcpkg validates triplets case-sensitively; PowerToys uses ARM64 capital-case. -->
|
|
<VcpkgPlatformTarget Condition="'$(Platform)' == 'ARM64'">arm64</VcpkgPlatformTarget>
|
|
<VcpkgApplocalDeps>false</VcpkgApplocalDeps>
|
|
<VcpkgInstalledDir>$(MSBuildThisFileDirectory)vcpkg_installed\$(Platform)\</VcpkgInstalledDir>
|
|
<VcpkgRoot Condition="'$(VcpkgRoot)' == ''">$(VCPKG_ROOT)</VcpkgRoot>
|
|
<VcpkgRoot Condition="'$(VcpkgRoot)' == '' and '$(VsInstallRoot)' != ''">$(VsInstallRoot)\VC\vcpkg</VcpkgRoot>
|
|
<VcpkgRoot Condition="'$(VcpkgRoot)' == '' or !Exists('$(VcpkgRoot)\vcpkg.exe')">$(MSBuildThisFileDirectory)deps\vcpkg</VcpkgRoot>
|
|
<CAExcludePath>$(CAExcludePath);$(VcpkgInstalledDir)</CAExcludePath>
|
|
<VCPkgLocalAppDataDisabled>true</VCPkgLocalAppDataDisabled>
|
|
</PropertyGroup>
|
|
<!-- Fail fast with an actionable message instead of opaque C1083 spdlog/spdlog.h errors. -->
|
|
<Target Name="PowerToysEnsureVcpkgAvailable"
|
|
BeforeTargets="PrepareForBuild"
|
|
Condition="'$(MSBuildProjectExtension)' == '.vcxproj' and '$(VcpkgEnabled)' == 'true' and !Exists('$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props')">
|
|
<Error Text="PowerToys requires the 'vcpkg' Visual Studio component, but it was not found.%0A%0AOpen the Visual Studio Installer, click Modify on your VS install, search for 'vcpkg', enable 'C++ vcpkg package manager', and click Modify. (Visual Studio will also prompt you to install missing .vsconfig components when you open PowerToys.slnx.)%0A%0AIf you have vcpkg installed elsewhere, set the VCPKG_ROOT environment variable to its root before building.%0A%0ASearched: '$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props'" />
|
|
</Target>
|
|
<Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props"
|
|
Condition="'$(MSBuildProjectExtension)' == '.vcxproj' and Exists('$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props')" />
|
|
|
|
|
|
<!-- Debug/Release props -->
|
|
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
|
<UseDebugLibraries>true</UseDebugLibraries>
|
|
<LinkIncremental>true</LinkIncremental>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
|
<UseDebugLibraries>false</UseDebugLibraries>
|
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
<LinkIncremental>false</LinkIncremental>
|
|
</PropertyGroup>
|
|
|
|
</Project>
|