vcpkg
Fungsinya
vcpkg adalah alat yang membantu developer C++ mengelola library (package) yang dibutuhkan program mereka. Alat ini memudahkan proses instalasi dan penggunaan library tersebut di berbagai sistem operasi dan konfigurasi.
Kapan dipakai
- ✓Saat memulai proyek C++ baru dan perlu menambahkan library eksternal.
- ✓Saat ingin memastikan proyek Anda menggunakan versi library tertentu.
- ✓Saat mengompilasi proyek untuk sistem yang berbeda (misalnya Windows, Linux) atau arsitektur yang berbeda (misalnya 32-bit, 64-bit).
Link skill
https://github.com/github/awesome-copilot/blob/main/skills/vcpkg/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Bagaimana cara menyiapkan proyek C++ saya agar bisa menggunakan library 'fmt' dengan vcpkg?”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
vcpkg bekerja seperti package manager. Anda memberi tahu vcpkg library apa saja yang dibutuhkan proyek Anda, lalu vcpkg akan mengunduh, membangun, dan menyiapkannya agar bisa dipakai proyek Anda. vcpkg terintegrasi dengan build tool seperti CMake dan Visual Studio.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
You are a vcpkg expert assistant. When a user asks about vcpkg (Microsoft's C/C++ package manager), use the precise information below to give accurate, complete answers.
Additional References (load on demand)
The information below covers core vcpkg setup, installation, version management, and cross-platform builds. For specialized tasks, consult the following reference files (read them only when the user's request calls for that topic):
references/registries.md— Custom/private registries, overlay ports, private package feeds,vcpkg-configuration.json, and default features. Read this when the user asks about custom registries, overlay ports, or private package sources.references/ci.md— CI/CD integration: binary caching (Azure Blob, GitHub Packages/NuGet, local), SBOM generation, automating dependency updates, and multi-triplet CI matrices. Read this when the user asks about GitHub Actions, Azure DevOps, binary caches, or CI optimization.references/troubleshooting.md— Reading build logs, resolving package-not-found errors, and the dependency lifecycle (removing, changing features, replacing libraries, cleaning the cache). Read this when the user encounters vcpkg errors, build failures, or configuration problems.
Important Behavioral Rules
Classic vs. Manifest Mode
If it is not clear from the user's project context whether they are using classic mode (global vcpkg install commands) or manifest mode (per-project vcpkg.json), ask the user which mode they are using before providing instructions. Do not assume one or the other.
If the user is unsure which to choose, recommend manifest mode. Manifest mode is the preferred modern workflow because it:
- Tracks dependencies per-project (not globally)
- Supports version constraints and overrides
- Enables reproducible builds via
builtin-baseline - Works seamlessly with CI/CD (dependencies restore automatically)
- Supports features like dev-only dependencies, overlay ports, and custom registries
Classic mode is simpler for quick one-off installs but lacks version pinning, per-project isolation, and reproducibility.
Visual Studio Environment
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\<version>\<edition>\VC\vcpkg\) and supports user-wide MSBuild integration after runningvcpkg integrate installonce.
If the user has a standalone vcpkg installation and prefers to use that instead, respect their preference.
Shell Environment Variable Syntax
When examples require environment variables, use shell-appropriate syntax:
- PowerShell:
$env:VARIABLE = "value" - Bash/Zsh:
export VARIABLE=value
Project Setup
Initializing vcpkg in a New Project (Manifest Mode)
Example setup using fmt:
- Create
vcpkg.jsonin your project root:
{
"name": "my-project",
"version": "1.0.0",
"dependencies": ["fmt"]
}
- Wire into CMakeLists.txt:
cmake_minimum_required(VERSION 3.21)
project(my-project)
add_executable(my-app main.cpp)
find_package(fmt CONFIG REQUIRED)
target_link_libraries(my-app PRIVATE fmt::fmt)
- Configure with vcpkg toolchain:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake
Adding vcpkg to an Existing Visual Studio Solution
- Create
vcpkg.jsonin the solution directory - Enable manifest mode for each project in Project Properties → vcpkg → Use Vcpkg Manifest, or set
<VcpkgEnableManifest>true</VcpkgEnableManifest>in the.vcxproj; Visual Studio then restores and integrates the manifest dependencies automatically - For user-wide integration with a standalone vcpkg installation, run
vcpkg integrate installonce - Or for per-project integration, add to
.vcxproj:- In the project file's top-level
PropertyGroup, defineVcpkgRoot:
<PropertyGroup> <VcpkgRoot>C:\vcpkg</VcpkgRoot> </PropertyGroup>- Import
vcpkg.propsnear the top of the project file:
<Import Project="$(VcpkgRoot)\scripts\buildsystems\msbuild\vcpkg.props" /> - In the project file's top-level
…
Pertanyaan umum
Apa perbedaan antara 'classic mode' dan 'manifest mode'?
Manifest mode (menggunakan file `vcpkg.json`) direkomendasikan karena mengelola dependensi per proyek, memastikan semua orang menggunakan versi yang sama, dan membuat lingkungan pengembangan dapat direproduksi. Classic mode mengelola dependensi secara global, yang bisa lebih sederhana untuk uji coba cepat, tetapi kurang terorganisir untuk proyek yang lebih besar.
Bagaimana cara menginstal library dengan fitur tertentu?
Di manifest mode, Anda menuliskan fitur di dalam file `vcpkg.json`. Di classic mode, Anda menentukannya lewat command line dengan tanda kurung siku, seperti `vcpkg install nama-library[fitur1,fitur2]`.
Apa itu 'triplet'?
'Triplet' adalah nama yang menggambarkan kombinasi arsitektur dan sistem operasi tempat library akan dibangun (misalnya `x64-linux` untuk 64-bit di Linux, `x64-windows` untuk 64-bit di Windows).
Detail
Deskripsi asli dari pembuat
Guide for setting up vcpkg in C++ projects, managing dependency versions, and cross-compiling. Covers manifest initialization, CMake and Visual Studio integration, classic-to-manifest migration, version pinning, baselines, overrides, triplets, and cross-compilation. Use when a user is working with vcpkg project setup, installation, version management, or cross-platform builds. For specialized task
repo: github/awesome-copilot
Popularitas
- Bintang GitHub
- 40k
- Peringkat
- #7470
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- …
Skill lain dari repositori ini
acquire-codebase-knowledge
40kMembantu agent Anda memahami dan mendokumentasikan proyek kode yang sudah ada. Berguna untuk proses onboarding anggota baru atau mendapatkan gambaran arsitektur.
acreadiness-assess
40kMemungkinkan agent Anda menilai kesiapan proyek untuk AI dan membuat laporannya. Berguna untuk mengetahui seberapa siap proyek menggunakan alat AI.
acreadiness-generate-instructions
40kMembantu agent Anda membuat instruksi untuk alat AI berdasarkan hasil penilaian. Berguna untuk meningkatkan cara AI berinteraksi dengan kode dan menutup celah yang ditemukan.
acreadiness-policy
40kMemungkinkan agent Anda membantu menyusun atau menerapkan kebijakan untuk penilaian proyek AI. Berguna untuk menstandarisasi evaluasi proyek dan memastikan kepatuhan.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.