-
Notifications
You must be signed in to change notification settings - Fork 33
vcpkg notes
Mradul Dubey edited this page Aug 31, 2023
·
16 revisions
The About vcpkg and its sub sections in reference-1 provide a good introduction to understand vcpkg port structure, versions, and triplets.
- Open vcpkg/ports/<package_name>/
- . update the vcpkg_from_github() function in portfile.cmake file
- Update the REPO Name with the target repo (ex: Apra-Labs/openh264)
- Update REF to the required commit to extract the source code .
- calcaulate sha512 value for the above commit.
- changes the HEAD_REF to the target branch name of given repo.
- . Update the version-date and port version in vcpkg/ports/<package_name>/vcpkg.json file.
- . update the vcpkg_from_github() function in portfile.cmake file
- Update the baseline and port version in vcpkg/version/baseline.json file .
- commit the following vcpkg code.(Needs to be done)
- Now generate git-tree hash using the command: git rev-parse HEAD:ports/<package_name>
- Update git-tree with above generated hash, version-date and port-version in vcpkg/versions//package_name.json file
- commit and push the code the vcpkg code
- Update Aprapipes/base/vcpkg.json file: Change the builtin-baseline with the latest commit ID of vcpkg, also change the vcpkg submodule point to the latest commit.
- Also delete buildtrees, downloads, packages and installed folders in ApraPipes/vcpkg/ .
- If Above point 8 does not work try to delete archives in C:\Users\developer\AppData\Local\vcpkg\
Upgrade vcpkg port to use novel thirdparty library. [The library does not exist in vcpkg package directory]
- If the novel library is not a package in vcpkg directory then follow these steps. You need to write the portfile and json file.
- Lookup the general format of portfile in the reference given and write one for the library.Add a vcpkg.json file.
- Fork the novel library repository in ApraLabs and create a branch (forApraPipes) and point the portfile to it. This is to keep main in sync with original repo and also facilitates dependency issues.
- Then follow the same steps as for a library in vcpkg directory. (above section)
- If the library you're adding has dependency on a different library i.e depender. If the dependee library is not already a vcpkg port then it must be added by following the above steps.
- Once both the libraries are added its possible some errors may come up while building the second library eg - dependee library not found.
- If the library is built using cmake check the cmakelist to see which line tries to find the dependee library eg - find_package().
- In vcpkg, find_package() mostly won't be able to find the library using default paths since the installed library and headers are moved to build/vcpkg_installed folder from vcpkg/vcpkg_installed in vcpkg. If this is the case then you may have to point the right path.
- Sidenote - If the depender is dependent on many libraries and requires many changes in cmakelist but you dont want to change the cmakelist then a better way is to use a vcpkg-cmake-wrapper which replaces the find_package() functionality and helps it find the library.
- You can also add the path to library and header files in the cmakelist with relative path (use vcpkg_installed_dir to find them) and have the modified cmakelist in forAprapipes branch in the fork. This will prevent adding hardcoded paths to library files.
- Do not try to point the path to anywhere in vcpkg directory in aprapipes.
References :