Skip to content

Commit f0ece3d

Browse files
committed
Test vcpkg nuget.
1 parent 88f90f7 commit f0ece3d

1 file changed

Lines changed: 31 additions & 12 deletions

File tree

.github/workflows/build-pcl.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: build-pcl
22

33
on: [push, pull_request]
44

5+
permissions:
6+
packages: write
7+
58
jobs:
69
gcc-build:
710
runs-on: ubuntu-24.04
@@ -230,23 +233,39 @@ jobs:
230233
generator: 'Visual Studio 17 2022'
231234
platform_args: '-A x64'
232235
env:
236+
USERNAME: PointCloudLibrary
237+
FEED_URL: https://nuget.pkg.github.com/PointCloudLibrary/index.json
238+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/PointCloudLibrary/index.json,readwrite"
233239
CONFIGURATION: Release
234-
VCPKG_ROOT: '${{ github.workspace }}\vcpkg'
235240
IS_MAIN: ${{ github.ref == 'refs/heads/master' }}
236241
steps:
237242
- uses: actions/checkout@v4
238-
- name: Cache vcpkg installed
239-
uses: actions/cache@v4
240-
with:
241-
path: ${{ env.VCPKG_ROOT }}\installed
242-
key: vcpkg-${{ matrix.architecture }}-${{ hashFiles('**/vcpkg.json') }}
243-
restore-keys: |
244-
vcpkg-${{ matrix.architecture }}-
243+
- name: Bootstrap vcpkg
244+
run: |
245+
echo %VCPKG_INSTALLATION_ROOT%
246+
cd "%VCPKG_INSTALLATION_ROOT%"
247+
ls
248+
git pull > nul
249+
./bootstrap-vcpkg.bat -disableMetrics
250+
shell: cmd
251+
- name: Add NuGet sources
252+
shell: pwsh
253+
run: |
254+
.$(vcpkg fetch nuget) `
255+
sources add `
256+
-Source "${{ env.FEED_URL }}" `
257+
-StorePasswordInClearText `
258+
-Name GitHubPackages `
259+
-UserName "${{ env.USERNAME }}" `
260+
-Password "${{ secrets.GITHUB_TOKEN }}"
261+
.$(vcpkg fetch nuget) `
262+
setapikey "${{ secrets.GITHUB_TOKEN }}" `
263+
-Source "${{ env.FEED_URL }}"
245264
- name: Setup vcpkg
246265
shell: pwsh
247266
run: |
248-
if (-Not (Test-Path "$Env:VCPKG_ROOT")) { git clone https://github.com/microsoft/vcpkg.git "$Env:VCPKG_ROOT" }
249-
cd "$Env:VCPKG_ROOT"
267+
if (-Not (Test-Path "$Env:VCPKG_INSTALLATION_ROOT")) { git clone https://github.com/microsoft/vcpkg.git "$Env:VCPKG_INSTALLATION_ROOT" }
268+
cd "$Env:VCPKG_INSTALLATION_ROOT"
250269
.\bootstrap-vcpkg.bat
251270
- name: Set vcpkg triplet
252271
shell: pwsh
@@ -257,13 +276,13 @@ jobs:
257276
shell: pwsh
258277
run: |
259278
$packages = @('boost','eigen3','flann','qhull','cjson','gtest','vtk','glew','freeglut')
260-
foreach ($p in $packages) { & "$Env:VCPKG_ROOT\vcpkg.exe" install "$($p):$Env:VCPKG_TRIPLET" }
279+
foreach ($p in $packages) { & "$Env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install "$($p):$Env:VCPKG_TRIPLET" }
261280
- name: Configure (${{ matrix.name }})
262281
shell: cmd
263282
run: |
264283
cmake -B build -S . -G"${{ matrix.generator }}" ${{ matrix.platform_args }} ^
265284
-DVCPKG_TARGET_TRIPLET=%VCPKG_TRIPLET% ^
266-
-DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" ^
285+
-DCMAKE_TOOLCHAIN_FILE="%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake" ^
267286
-DCMAKE_BUILD_TYPE=MinSizeRel ^
268287
-DVCPKG_APPLOCAL_DEPS=ON ^
269288
-DPCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32=ON ^

0 commit comments

Comments
 (0)