Files
PowerToys/src/common
Boliang Zhang (from Dev Box) 42fd684c48 fix(vcpkg): wire vcpkg integration globally so import order is correct; fix 3 hard-coded spdlog include paths; spell-check
Two root causes of the v2 CI failure on PR #48039:

1. Wrong import location for vcpkg integration
-----------------------------------------------
v2 put VcpkgEnabled/VcpkgRoot/vcpkg.props import into deps/spdlog.props,
which was then imported per-project. That works ONLY for projects that
import spdlog.props BEFORE Microsoft.Cpp.targets (e.g. src/common/logger/
logger.vcxproj, which imports it at line 42 before Cpp.targets at line 80).

But the majority of PowerToys .vcxproj files import spdlog.props AFTER
Microsoft.Cpp.targets (e.g. FancyZonesLib at L156/L157, SettingsAPI at
L54/L55, CmdPalKeyboardService at L132/L133). At that point Microsoft.Cpp.
targets has already set up ClCompile, so vcpkg.props' include-path wiring
is dead-on-arrival → C1083 errors for spdlog/spdlog.h.

Fix: follow the Windows Terminal pattern strictly — set all vcpkg properties
and import vcpkg.props in Cpp.Build.props (loaded via ForceImportBeforeCppProps
for every .vcxproj BEFORE Microsoft.Cpp.props). vcpkg.targets continues to
be imported in Cpp.Build.targets (loaded via ForceImportAfterCppTargets,
AFTER Microsoft.Cpp.targets). Order is now guaranteed correct for every
C++ project, regardless of where they import spdlog.props.

Side effect: vcpkg integration is now global rather than per-project opt-in.
Since the manifest at the repo root declares only spdlog, non-spdlog C++
projects pay only the vcpkg install latency (~0.5 s on cache hits) and
have an unused spdlog include path. With binary cache enabled this is
negligible.

deps/spdlog.props is reduced to a thin shim that just adds the historical
SPDLOG_* preprocessor defines for consumers (kept for backwards-compat;
85 projects already import it).

2. Three projects had hard-coded `deps\spdlog\include` paths
-----------------------------------------------------------
The earlier audit only checked for `<Import Project="...spdlog.props">`,
but missed projects that put `..\deps\spdlog\include` directly into
<AdditionalIncludeDirectories>. With deps/spdlog gone (submodule deleted)
these paths no longer exist.

Removed the hard-coded path entries from:
  - src/common/UnitTests-CommonUtils/UnitTests-CommonUtils.vcxproj
  - src/modules/LightSwitch/LightSwitchLib/LightSwitchLib.vcxproj
  - src/modules/LightSwitch/LightSwitchService/LightSwitchService.vcxproj

These projects already get the spdlog include path from vcpkg's global
auto-integration (via Cpp.Build.props), so no replacement needed. The
SPDLOG_* defines come from logger.h's transitive use, which still works.

3. Spell-check
--------------
Three more words flagged by check-spelling: `vcpkg` (lowercase variant,
case-sensitive against existing `Vcpkg`), `Applocal` (from
VcpkgApplocalDeps in Cpp.Build.props), and `pdbs` (lowercase variant from
`vcpkg_copy_pdbs` in the overlay portfile).

Verification
------------
Local builds all green:
  - src/common/logger/logger.vcxproj (Release|x64, 23.7 s) - sanity
  - src/modules/fancyzones/FancyZonesLib/FancyZonesLib.vcxproj (Release|x64, 70.7 s)
    - the LATE-import pattern that was failing in CI
  - src/modules/LightSwitch/LightSwitchLib (Release|x64, 10.8 s) - was hard-coded
  - src/common/SettingsAPI (Release|x64, 17.0 s) - late-import
  - src/common/UnitTests-CommonUtils (Debug|x64, 30.2 s) - was hard-coded AND
    exercises the MSVC 14.51 stdext::checked_array_iterator patch

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-26 23:35:47 +08:00
..
2026-05-21 17:27:52 +02:00
2020-06-19 13:27:29 +03:00