Skip to content

Commit

Permalink
Try new vcpkg (#2572)
Browse files Browse the repository at this point in the history
* Try new vcpkg

* Lower pin on VCPKG

* Get VCPK from GHA

* Remove all VCPKG patching

* Set VCPKG root

* Cache VCPKG dependencies

* Point CMake to VCPKG dir

* Fix path

* Adjust CMAKE_PREFIX_PATH

* Weekly cache of VCPKG

* Try setting VCPKG_ROOT
  • Loading branch information
AntoinePrv authored Jun 12, 2023
1 parent fbbd6c0 commit 338bdd4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
64 changes: 30 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,36 +285,27 @@ jobs:
environment-file: ./libmamba/environment-static-dev-win.yml
environment-name: build_env
cache-env: true
- name: fix up vcpkg recipes
shell: python
run: |
# See https://github.com/microsoft/vcpkg/pull/28919
import os
from pathlib import Path
vcpkg_root = Path(os.environ["MAMBA_ROOT_PREFIX"]) / "envs" / "build_env" / "Library" / "share" / "vcpkg"
f = vcpkg_root / "scripts" / "cmake" / "vcpkg_acquire_msys.cmake"
text = f.read_text()
text = text.replace("fdd86f4ffa6e274d6fef1676a4987971b1f2e1ec556eee947adcb4240dc562180afc4914c2bdecba284012967d3d3cf4d1a392f798a3b32a3668d6678a86e8d3", "fbdcf2572d242b14ef3b39f29a6119ee58705bad651c9da48ffd11e80637e8d767d20ed5d562f67d92eecd01f7fc3bc351af9d4f84fb9b321d2a9aff858b3619")
text = text.replace("https://repo.msys2.org/msys/x86_64/msys2-runtime-3.2.0-8-x86_64.pkg.tar.zst", "https://repo.msys2.org/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst")
text = text.replace("b309799e5a9d248ef66eaf11a0bd21bf4e8b9bd5c677c627ec83fa760ce9f0b54ddf1b62cbb436e641fbbde71e3b61cb71ff541d866f8ca7717a3a0dbeb00ebf", "a202ddaefa93d8a4b15431dc514e3a6200c47275c5a0027c09cc32b28bc079b1b9a93d5ef65adafdc9aba5f76a42f3303b1492106ddf72e67f1801ebfe6d02cc")
text = text.replace("https://repo.msys2.org/msys/x86_64/libtool-2.4.6-9-x86_64.pkg.tar.xz", "https://repo.msys2.org/msys/x86_64/libtool-2.4.7-3-x86_64.pkg.tar.zst")
f.write_text(text)
- name: remove vcpkg manifest file
# we need to remove the vcpkg.json file to be able to work not in manifest mode
run: rm vcpkg.json
- name: build static windows dependencies with vcpkg
- name: Get Week
id: get-week
shell: bash
run: echo "week=$(/bin/date -u "+%Y%U")" >> "${GITHUB_OUTPUT}"
- name: Restore cached VCPKG dependencies
id: cache-vcpkg-restore
uses: actions/cache/restore@v3
with:
path: C:\vcpkg
key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ steps.get-week.outputs.week }}-
- name: Build static windows dependencies with vcpkg
shell: cmd /C CALL {0}
# Latest VCPKG is from GHA because releases are not up to date with VCPKG server
run: |
call micromamba activate build_env
if %errorlevel% neq 0 exit /b %errorlevel%
set VCPKG_ROOT=C:\vcpkg
if %errorlevel% neq 0 exit /b %errorlevel%
ROBOCOPY .\ports\libsolv %VCPKG_ROOT%\ports\libsolv
@rem ROBOCOPY has 0 and 1 as successfull exit codes
if %errorlevel% neq 0 if %errorlevel% neq 1 exit /b %errorlevel%
Expand All @@ -328,8 +319,11 @@ jobs:
if %errorlevel% neq 0 exit /b %errorlevel%
vcpkg install reproc --triplet x64-windows-static
if %errorlevel% neq 0 exit /b %errorlevel%
set CMAKE_PREFIX_PATH=%VCPKG_ROOT%\installed\x64-windows-static\;%CMAKE_PREFIX_PATH%
if %errorlevel% neq 0 exit /b %errorlevel%
- name: Save VCPKG dependencies
uses: actions/cache/save@v3
with:
path: C:\vcpkg
key: ${{ steps.cache-vcpkg-restore.outputs.cache-primary-key }}
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
Expand All @@ -339,18 +333,20 @@ jobs:
run: |
call micromamba activate build_env
if %errorlevel% neq 0 exit /b %errorlevel%
mkdir build
@rem Used by CMake
set VCPKG_ROOT=C:\vcpkg
if %errorlevel% neq 0 exit /b %errorlevel%
cd build
cmake -B build ^
-D CMAKE_PREFIX_PATH=C:\vcpkg\installed\x64-windows-static\ ^
-D CMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-D BUILD_LIBMAMBA=ON ^
-D BUILD_STATIC=ON ^
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-D CMAKE_C_COMPILER_LAUNCHER=sccache ^
-G Ninja
if %errorlevel% neq 0 exit /b %errorlevel%
cmake .. -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DBUILD_LIBMAMBA=ON ^
-DBUILD_STATIC=ON ^
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-DCMAKE_C_COMPILER_LAUNCHER=sccache ^
-GNinja
cmake --build build --parallel
if %errorlevel% neq 0 exit /b %errorlevel%
ninja
- name: build cache statistics
run: sccache --show-stats
- name: Cleanup
Expand Down
1 change: 0 additions & 1 deletion libmamba/environment-static-dev-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
dependencies:
- vs2019_win-64
- ninja
- vcpkg
- python
- curl
- cli11 >=2.2,<3
Expand Down

0 comments on commit 338bdd4

Please sign in to comment.