From ca6de3fc482a5c70ab8a9bd4c036dc05c5f89c74 Mon Sep 17 00:00:00 2001 From: Augustin Popa Date: Fri, 17 Jul 2026 01:07:54 -0700 Subject: [PATCH] Addressed more PR review feedback --- skills/vcpkg/SKILL.md | 48 +++++++++++++--------- skills/vcpkg/references/registries.md | 7 +++- skills/vcpkg/references/troubleshooting.md | 27 ++++++++---- 3 files changed, 53 insertions(+), 29 deletions(-) diff --git a/skills/vcpkg/SKILL.md b/skills/vcpkg/SKILL.md index 606e86eb..e6909544 100644 --- a/skills/vcpkg/SKILL.md +++ b/skills/vcpkg/SKILL.md @@ -30,11 +30,10 @@ Classic mode is simpler for quick one-off installs but lacks version pinning, pe ### Visual Studio Environment -If the user is working inside **Visual Studio** (not VS Code), prefer using the **in-box copy of vcpkg that ships with Visual Studio** rather than a standalone vcpkg clone, unless the user indicates they want to use a different installation. The VS-bundled vcpkg: -- Is located under the Visual Studio installation directory (e.g., `C:\Program Files\Microsoft Visual Studio\\\VC\vcpkg\`) -- Supports user-wide MSBuild integration after running `vcpkg integrate install` once -- Stays up-to-date with Visual Studio updates -- Can be used with Visual Studio Open Folder/CMake Presets projects, but CMake must still be configured to use the vcpkg toolchain (for example via `CMakePresets.json` or `-DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake`) +If the user is working inside **Visual Studio** (not VS Code), then: +- If the user is in **manifest mode**, prefer the in-box copy of vcpkg that ships with Visual Studio rather than a standalone clone. +- If the user is in **classic mode**, use a standalone vcpkg installation instead. +- The VS-bundled copy lives under the Visual Studio installation directory (e.g., `C:\Program Files\Microsoft Visual Studio\\\VC\vcpkg\`) and supports user-wide MSBuild integration after running `vcpkg integrate install` once. If the user has a standalone vcpkg installation and prefers to use that instead, respect their preference. @@ -82,18 +81,28 @@ cmake -B build -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cm 2. Create `vcpkg.json` in the solution directory 3. In VS, the integration is automatic via MSBuild props — no project file edits needed 4. Or per-project: add to `.vcxproj`: -```xml - - -``` + - In the project file's top-level `PropertyGroup`, define `VcpkgRoot`: + ```xml + + C:\vcpkg + + ``` + - Import `vcpkg.props` near the top of the project file: + ```xml + + ``` + - Import `vcpkg.targets` near the end of the project file: + ```xml + + ``` ### Classic-to-Manifest Migration 1. List what's currently installed: `vcpkg list` 2. Create `vcpkg.json` with those dependencies -3. Delete global installs: `vcpkg remove --recurse "*"` -4. Run `vcpkg install` in your project directory — manifest mode takes precedence -5. Update your build system to use `CMAKE_TOOLCHAIN_FILE` if not already +3. Run `vcpkg install` in your project directory — manifest mode uses its own project-specific `vcpkg_installed` tree, so leave the classic-mode installed tree in place during migration +4. Update your build system to use `CMAKE_TOOLCHAIN_FILE` if not already +5. Optional: remove classic-mode packages later by name with `vcpkg remove --recurse` if you no longer need them --- @@ -194,12 +203,12 @@ Use `overrides` only when a hard pin is required: } ``` -Always include `builtin-baseline` when using versioning. +Use a baseline for the registry that resolves the dependency. For the builtin registry, that means `builtin-baseline` in `vcpkg.json`. For a custom default registry, set the baseline in `vcpkg-configuration.json`. **Key points:** - `overrides` take precedence over all version constraints, including transitive ones. -- `builtin-baseline` is required for overrides. -- Overrides can pin versions older than the baseline if that version exists in the selected registry's versions database. +- The selected registry must have a baseline; `builtin-baseline` is only for the builtin registry. +- Overrides can pin versions older than the baseline if that version exists in the selected registry's version database. - Use `vcpkg x-history ` to inspect available versions. --- @@ -219,23 +228,24 @@ cmake -B build -DVCPKG_TARGET_TRIPLET=arm64-linux -DCMAKE_TOOLCHAIN_FILE=:arm64-windows ``` ### Building for Android (NDK) -1. Install packages: +1. Set `ANDROID_NDK_HOME` to your NDK path. +2. Install packages: ```console vcpkg install :arm64-android ``` Available Android triplets: `arm-neon-android`, `arm64-android`, `x86-android`, `x64-android` -2. In CMake: +3. In CMake, use the vcpkg toolchain and set the triplet: ```console -cmake -B build -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm64-android -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-24 +cmake -B build -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm64-android ``` For expanded CI and shell-specific examples, see `references/ci.md`. diff --git a/skills/vcpkg/references/registries.md b/skills/vcpkg/references/registries.md index a42d67c9..180eda6b 100644 --- a/skills/vcpkg/references/registries.md +++ b/skills/vcpkg/references/registries.md @@ -72,7 +72,12 @@ my-overlays/ "name": "telemetry-sdk", "version": "1.0.0", "description": "Internal telemetry SDK", - "dependencies": ["curl", "nlohmann-json"] + "dependencies": [ + "curl", + "nlohmann-json", + { "name": "vcpkg-cmake", "host": true }, + { "name": "vcpkg-cmake-config", "host": true } + ] } ``` diff --git a/skills/vcpkg/references/troubleshooting.md b/skills/vcpkg/references/troubleshooting.md index 3e70ba40..49400e35 100644 --- a/skills/vcpkg/references/troubleshooting.md +++ b/skills/vcpkg/references/troubleshooting.md @@ -76,17 +76,26 @@ vcpkg install curl[ssl,ssh] --recurse # permits rebuilding with the new featur ### Cleaning the vcpkg Cache ```powershell -# Remove all package build artifacts -vcpkg x-clean +# Remove build trees +Remove-Item -Recurse -Force \buildtrees -# Optional: remove local cache/install directories -Remove-Item -Recurse -Force \buildtrees,\downloads,\installed,.\vcpkg_installed +# Remove downloaded archives +Remove-Item -Recurse -Force \downloads + +# Remove installed packages (classic mode only) +Remove-Item -Recurse -Force \installed + +# Remove package build artifacts +Remove-Item -Recurse -Force \packages + +# In manifest mode, remove the local vcpkg_installed directory +Remove-Item -Recurse -Force .\vcpkg_installed ``` ```bash -# Remove all package build artifacts -vcpkg x-clean - -# Optional: remove local cache/install directories -rm -rf /buildtrees /downloads /installed ./vcpkg_installed +rm -rf /buildtrees +rm -rf /downloads +rm -rf /installed +rm -rf /packages +rm -rf ./vcpkg_installed ```