mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-07-08 11:29:58 +02:00
## Summary Migrate `deps/spdlog` from a git submodule to **vcpkg manifest mode** with an overlay port pinned to the **exact same commit** (`gabime/spdlog@616866fc`). Replaces the polyfill shim added in #47910 with a proper port-level patch. This is the follow-up to PR #47928, which I closed after @zadjii-msft / @DHowett clarified that the intended direction was a single combined "move to vcpkg **and** apply a patch file" (one change, not two stepping stones). ## Guidance honored Per @zadjii-msft (offline): - ✅ Convert each submodule to vcpkg **one at a time** — this PR is **spdlog only**. `deps/expected-lite` stays a submodule (separate PR next). - ✅ Atomic commit per dep (multiple commits on the branch for review traceability; squash on merge gives the requested single commit). - ✅ **Don't bump the version.** Only variable changed: submodule → vcpkg. Same commit (`616866fc`, v1.8.5 + 38) the submodule pointed at. Per @DHowett ([review](https://github.com/microsoft/PowerToys/pull/48039#pullrequestreview-4338835150)): - ✅ No vcpkg submodule — vswhere-first detection via a Terminal-style `steps-install-vcpkg.yml` template; three-tier `VcpkgRoot` fallback (env var → VS-shipped → runtime clone pinned to manifest baseline). ## Design - **Repo-root manifest**: `vcpkg.json` declares only `spdlog`, with `builtin-baseline` pinned. `vcpkg-configuration.json` registers `deps/vcpkg-overlays/` as overlay-ports. - **Overlay port** `deps/vcpkg-overlays/spdlog/`: `vcpkg_from_github(REF 616866fc...)` with bundled fmt preserved (`-DSPDLOG_FMT_EXTERNAL=OFF`); the MSVC 14.51 fix from #47910 carried as a proper vcpkg patch on `include/spdlog/fmt/bundled/format.h`. - **vcpkg integration is global** (set in `Cpp.Build.props`, imported via `ForceImportBeforeCppProps` for every `.vcxproj`). An earlier attempt to make vcpkg per-project-opt-in via `deps/spdlog.props` failed because ~85 PowerToys `.vcxproj` files import `spdlog.props` AFTER `Microsoft.Cpp.targets`, by which point `vcpkg.props`' `ClCompile` hook is dead-on-arrival. The trade-off (every C++ project invokes `vcpkg install` once at build time, ~0.5 s on cache hits, manifest declares only spdlog so install set is fixed) is documented in the expanded `Cpp.Build.props` comment. - **`deps/spdlog.props`** is now a thin shim that only sets the historical `SPDLOG_*` preprocessor defines for source-compat. - **`Cpp.Build.targets`** is a new file imported via `ForceImportAfterCppTargets` to load `vcpkg.targets` after `Microsoft.Cpp.targets`. A fail-fast `<Target>` errors with a clear message if `vcpkg.props` can't be found at the resolved `VcpkgRoot`. - **Removes** `deps/spdlog-msvc-fix/` polyfill, in-tree wrapper `src/logging/`, spdlog submodule, the single `<ProjectReference>` in `logger.vcxproj`, plus 3 `.slnf` refs and 2 `.slnx` refs (`PowerToys.slnx` + `installer/PowerToysSetup.slnx`), plus 3 hard-coded `..\deps\spdlog\include` entries in `<AdditionalIncludeDirectories>`. - **CI**: new reusable `.pipelines/v2/templates/steps-install-vcpkg.yml` (vswhere-first, manifest-baseline-pinned fallback clone, respects `useVSPreview`). Gated `Cache@2` for `%LOCALAPPDATA%\vcpkg\archives` keyed on overlay-port contents. Same vcpkg detection added to `tools\build\build-essentials.ps1` for local devs. ## Verification Local build matrix (all 4 configs of `logger.vcxproj` and a representative late-import consumer): | Config | Result | Notes | |--------|--------|-------| | Release \| x64 | ✅ | vcpkg install ~21 s, `logger.lib` produced | | Debug \| x64 | ✅ | **Validates patch fixes the actual MSVC 14.51 bug** (`_ITERATOR_DEBUG_LEVEL > 0` → `_SECURE_SCL`) | | Release \| ARM64 | ✅ | vcpkg cross-installs `arm64-windows-static` spdlog in ~16 s | | Debug \| ARM64 | ✅ | **Previously DISABLED for the in-tree spdlog** (per `<Build Solution="Debug\|ARM64" Project="false" />` in `PowerToysSetup.slnx`); this migration FIXES that latent gap | | FancyZonesLib (Release \| x64) | ✅ | Late-import-pattern consumer; previously broke in v2 | Full PowerToys CI (x64 + arm64 + CmdPal SDK + all GitHub Actions checks) green. **Consumer audit**: 72 `.vcxproj` files reference `logger.vcxproj`; all 72 also import `deps/spdlog.props`. No transitive-link breakage. ## Out of scope (intentional) - `deps/expected-lite` migration — next PR per "one-at-a-time" rule. - Remote vcpkg binary cache (Azure Artifacts NuGet feed). Local pipeline `Cache@2` works for now, but a remote feed survives across pipelines and is the long-term answer. Happy to split this into a follow-up. ## Notes for review - Patch in the overlay port is identical content to PR #47928's patch but regenerated with LF line endings (vcpkg's `vcpkg_apply_patches` is strict; no `--ignore-whitespace`). - Once PowerToys eventually bumps spdlog past v1.14 (which ships fmt 10.2 and drops the affected code path), the overlay port can be deleted and we can use upstream vcpkg's `spdlog` directly. - Re. official-release pipelines and terrapin / less-restricted network isolation: VS-shipped vcpkg is the primary path (no network); the fallback clone is only exercised when VS doesn't ship vcpkg. Happy to wire terrapin into the fallback as a follow-up if the official build template needs it. Closes the work tracked in #47928 (which was closed unmerged). --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Dustin L. Howett <dustin@howett.net>
179 lines
9.5 KiB
XML
179 lines
9.5 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>
|
|
<!-- TODO: _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for compatibility with VS 17.8. Check if we can remove. -->
|
|
<PreprocessorDefinitions>_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING;_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>
|
|
<SpectreMitigation>Spectre</SpectreMitigation>
|
|
</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>
|