Skip to content

Commit

Permalink
fix: Improve Windows build configuration for pkg-config and library d…
Browse files Browse the repository at this point in the history
…ependencies
  • Loading branch information
silviot committed Dec 7, 2024
1 parent 259bb63 commit f9a469c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,30 @@ jobs:
- 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 "$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
# Add required paths to system PATH
$env:Path = "$installPrefix\bin;$env:Path"
$env:Path = "$env:VCPKG_ROOT\downloads\tools\pkgconfig\windows\pkg-config-0.29.2-3\tools\pkg-config-0.29.2\bin;$env:Path"
# Set pkg-config environment variables
$env: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"
$env:PKG_CONFIG_PATH = "$installPrefix\lib\pkgconfig"
$env:PKG_CONFIG_LIBDIR = "$installPrefix\lib\pkgconfig"
$env:PKG_CONFIG_ALLOW_CROSS = "1"
$env:PKG_CONFIG_ALLOW_SYSTEM_CFLAGS = "1"
$env:PKG_CONFIG_ALLOW_SYSTEM_LIBS = "1"
# Export variables to GITHUB_ENV
"PKG_CONFIG=$env:PKG_CONFIG" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"PKG_CONFIG_PATH=$env:PKG_CONFIG_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"PKG_CONFIG_LIBDIR=$env:PKG_CONFIG_LIBDIR" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"PKG_CONFIG_ALLOW_CROSS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"PKG_CONFIG_ALLOW_SYSTEM_LIBS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Add to PATH for subsequent steps
"$installPrefix\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
"$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
shell: pwsh

- name: Verify pkg-config setup
Expand Down
13 changes: 13 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "aardvark",
"version-string": "0.1.0",
"dependencies": [
{
"name": "glib",
"version>=": "2.82.0"
},
"gtk4",
"libadwaita",
"pkgconf"
]
}

0 comments on commit f9a469c

Please sign in to comment.