Tutorial: Add a port to the vcpkg open-source registry
This tutorial guides you on how to package a library for vcpkg using a custom overlay. We recommended that you read the Packaging a library tutorial before proceeding.
Prerequisites
- A terminal
- Git
1 - Fork the vcpkg Repository
- Navigate to the vcpkg GitHub repository.
- Click the "Fork" button at the top right corner of the page.
- Choose your GitHub account as the destination for the fork.
2 - Add your fork as a remote
Navigate to the directory where you've cloned the original vcpkg repository, then add your fork as a remote. Replace <Your-GitHub-Username>
with your GitHub username:
git remote add myfork https://github.com/<Your-GitHub-Username>/vcpkg.git
You can check that the remote was added correctly by running:
git remote -v
You should see myfork
listed among the remotes.
3 - Create a topic branch
Before making changes, it's usually good to create a new branch:
git checkout -b <topic-branch-name>
4 - Copy the overlay port to the ports
directory
Add the vcpkg-sample-library
port that was created in the packaging a library tutorial to the vcpkg\ports
directory:
cp -R <path/to/vcpkg-sample-library> <ports/vcpkg-sample-library>
xcopy <path/to/vcpkg-sample-library> <ports/vcpkg-sample-library> /E
Copy-Item -Path <path/to/vcpkg-sample-library> -Destination <ports/vcpkg-sample-library> -Recurse
5 - Commit and push changes
Commit the changes:
git add ports/<library-name> git commit -m "Add vcpkg-sample-library to vcpkg"
Run
vcpkg x-add-version
:vcpkg x-add-version vcpkg-sample-library
Commit version changes
git commit -m "version database"
Push the changes to your fork:
git push myfork <topic-branch-name>
6 - Create a pull request
- Navigate to your forked repository on GitHub.
- Click on "Compare & pull request" button.
- Verify the changes
- Add a descriptive title and comments
- Fill out the pr review checklist
- Click "Create pull request."
That's it! You've successfully added a port
to vcpkg's curated registry.
Next steps
For more information, see: