fix: use manual vcpkg installation for macOS builds

Replaces cargo-vcpkg with direct vcpkg installation for macOS to fix
libogg build failures. Uses vcpkg 2025.10.17 with proper SDL2 package
installation and VCPKG_ROOT environment variable for rust-sdl2
integration. Windows and Linux continue using cargo-vcpkg.
This commit is contained in:
Ryan Walters
2025-11-02 11:34:55 -06:00
parent 3f6126418a
commit aeb03aaf52
2 changed files with 39 additions and 4 deletions

View File

@@ -49,7 +49,8 @@ jobs:
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
- name: Cache vcpkg - name: Cache cargo-vcpkg (Non-macOS)
if: runner.os != 'macOS'
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: target/vcpkg path: target/vcpkg
@@ -57,13 +58,49 @@ jobs:
restore-keys: | restore-keys: |
A-vcpkg-${{ runner.os }}-${{ matrix.target }}- A-vcpkg-${{ runner.os }}-${{ matrix.target }}-
- name: Cache vcpkg (macOS)
if: runner.os == 'macOS'
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/vcpkg/installed
${{ github.workspace }}/vcpkg/packages
key: vcpkg-2025.10.17-${{ matrix.target }}
restore-keys: |
vcpkg-2025.10.17-
- name: Vcpkg Linux Dependencies - name: Vcpkg Linux Dependencies
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libltdl-dev sudo apt-get install -y libltdl-dev
- name: Vcpkg - name: Setup vcpkg (macOS)
if: runner.os == 'macOS'
run: |
# Clone vcpkg at latest stable release
git clone https://github.com/microsoft/vcpkg.git ${{ github.workspace }}/vcpkg
cd ${{ github.workspace }}/vcpkg
git checkout 2025.10.17
# Bootstrap vcpkg
./bootstrap-vcpkg.sh -disableMetrics
# Determine triplet based on target
if [ "${{ matrix.target }}" = "aarch64-apple-darwin" ]; then
TRIPLET="arm64-osx"
else
TRIPLET="x64-osx"
fi
# Install SDL2 packages
./vcpkg install sdl2 sdl2-image sdl2-ttf sdl2-gfx sdl2-mixer --triplet=$TRIPLET
# Set VCPKG_ROOT for rust-sdl2 to find it
echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV
- name: Vcpkg (Non-macOS)
if: runner.os != 'macOS'
run: | run: |
cargo install cargo-vcpkg cargo install cargo-vcpkg
cargo vcpkg -v build cargo vcpkg -v build

View File

@@ -83,8 +83,6 @@ rev = "2024.11.16" # to check for a new one, check https://github.com/microsoft/
[package.metadata.vcpkg.target] [package.metadata.vcpkg.target]
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" } x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }
x86_64-unknown-linux-gnu = { triplet = "x64-linux" } x86_64-unknown-linux-gnu = { triplet = "x64-linux" }
x86_64-apple-darwin = { triplet = "x64-osx" }
aarch64-apple-darwin = { triplet = "arm64-osx" }
[features] [features]
# Windows-specific features # Windows-specific features