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

  1. Navigate to the vcpkg GitHub repository.
  2. Click the "Fork" button at the top right corner of the page.
  3. 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

  1. Commit the changes:

     git add ports/<library-name>
     git commit -m "Add vcpkg-sample-library to vcpkg"
    
  2. Run vcpkg x-add-version:

    vcpkg x-add-version vcpkg-sample-library
    
  3. Commit version changes

     git commit -m "version database"
    
  4. Push the changes to your fork:

    git push myfork <topic-branch-name>
    

6 - Create a pull request

  1. Navigate to your forked repository on GitHub.
  2. Click on "Compare & pull request" button.
    1. Verify the changes
    2. Add a descriptive title and comments
    3. Fill out the pr review checklist
  3. Click "Create pull request."

That's it! You've successfully added a port to vcpkg's curated registry.

Next steps

For more information, see: