Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mkckr0/setup-vcpkg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup vcpkg

Setup vcpkg with VCPKG_ROOT, VCPKG_DEFAULT_TRIPLET, asset caching and binary caching.

Inputs

VCPKG_ROOT

VCPKG_ROOT. Default value is "$VCPKG_INSTALLATION_ROOT".

VCPKG_DEFAULT_TRIPLET

VCPKG_DEFAULT_TRIPLET. Default value is "".

Side effects

  • export VCPKG_ROOT. That's to say you can access it by bash's $VCPKG_ROOT or action's ${{ env.VCPKG_ROOT }}.
  • export VCPKG_DOWNLOADS, which value is $GITHUB_WORKSPACE/vcpkg_downloads.
  • export VCPKG_DEFAULT_TRIPLET.
  • export VCPKG_DEFAULT_BINARY_CACHE, which value is $GITHUB_WORKSPACE/vcpkg_binary_cache.
  • restore vcpkg cache with key setup-vcpkg-$RUNNER_OS-.
  • ...
  • exec post script. cache VCPKG_DOWNLOADS and VCPKG_DEFAULT_BINARY_CACHE to a single archive with the key setup-vcpkg-$RUNNER_OS-$sha256sum. sha256sum is caculated according to VCPKG_DOWNLOADS and VCPKG_DEFAULT_BINARY_CACHE.

Outputs

Nothing.

Example usage

- uses: mkckr0/[email protected]
  with:
    VCPKG_DEFAULT_TRIPLET: 'x64-windows-static-md'
    
- name: Install deps via vcpkg
  run: vcpkg install asio spdlog

Known issues

CMake can't find installed packages via vcpkg on Windows.

The Visual Studio of Github Hosted Runner has a preinstalled vcpkg at C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\vcpkg. If you run vcvarsall.bat or VsDevCmd.bat, it will change VCPKG_ROOT to that version. If your CMakeLists.txt or CMakePresets.json use VCPKG_ROOT to locate the vcpkg.cmake, the issue will happen.
The simple solution is to reset VCPKG_ROOT manually.

- name: CMake Configure & Build
  run: |
    ${{ runner.os == 'Windows' && '&"$(vswhere -property installationPath)\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation' || ''}}
    ${{ runner.os == 'Windows' && '$env:VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT' || '' }}
    cmake --preset windows-Release
    cmake --build --preset windows-Release

About

Setup vcpkg with VCPKG_ROOT, VCPKG_DEFAULT_TRIPLET, asset caching and binary caching.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •