Skip to content

Commit

Permalink
refactor: Split Windows dependency installation into modular steps
Browse files Browse the repository at this point in the history
  • Loading branch information
silviot committed Dec 7, 2024
1 parent b2c9a39 commit 5659de9
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,43 @@ jobs:
- name: Install target
if: matrix.arch == 'arm64'
run: rustup target add aarch64-pc-windows-msvc
- name: Install Dependencies
- name: Setup Windows build variables
run: |
$arch = "${{ matrix.arch }}"
$triplet = if ($arch -eq "x64") { "x64-windows" } else { "arm64-windows" }
echo "VCPKG_TRIPLET=$triplet" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VCPKG_ROOT=C:\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh

# Install GTK4, libadwaita and their dependencies
vcpkg install pkgconf:$triplet gtk4:$triplet libadwaita:$triplet
# Set up various required paths
$vcpkgRoot = "C:\vcpkg"
$installPrefix = "$vcpkgRoot\installed\$triplet"
- name: Install GTK4 and dependencies
run: |
Write-Host "Installing GTK4 and dependencies for $env:VCPKG_TRIPLET..."
vcpkg install pkgconf:$env:VCPKG_TRIPLET
vcpkg install gtk4:$env:VCPKG_TRIPLET
vcpkg install libadwaita:$env:VCPKG_TRIPLET
shell: pwsh

# Add necessary paths to PATH
- name: Configure pkg-config paths
run: |
$installPrefix = "$env:VCPKG_ROOT\installed\$env:VCPKG_TRIPLET"
Write-Host "Setting up PATH..."
echo "$installPrefix\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "$vcpkgRoot\downloads\tools\pkgconfig\windows\pkg-config-0.29.2-3\tools\pkg-config-0.29.2\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Set pkg-config related environment variables
echo "PKG_CONFIG=$vcpkgRoot\downloads\tools\pkgconfig\windows\pkg-config-0.29.2-3\tools\pkg-config-0.29.2\bin\pkg-config.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "$env:VCPKG_ROOT\downloads\tools\pkgconfig\windows\pkg-config-0.29.2-3\tools\pkg-config-0.29.2\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Host "Setting up pkg-config environment..."
echo "PKG_CONFIG=$env:VCPKG_ROOT\downloads\tools\pkgconfig\windows\pkg-config-0.29.2-3\tools\pkg-config-0.29.2\bin\pkg-config.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "PKG_CONFIG_PATH=$installPrefix\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "PKG_CONFIG_LIBDIR=$installPrefix\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "PKG_CONFIG_ALLOW_CROSS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh

# Verify pkg-config installation and paths
- name: Verify pkg-config setup
run: |
Write-Host "Verifying pkg-config installation..."
pkg-config --version
Write-Host "Checking GTK4 and libadwaita configuration..."
pkg-config --debug --print-errors --cflags --libs gtk4 libadwaita-1
shell: pwsh
- name: Build
Expand Down

0 comments on commit 5659de9

Please sign in to comment.