2026-05-22 15:47:48 +05:30
|
|
|
$vcpkgRoot = $env:VCPKG_ROOT
|
|
|
|
|
if (-not $vcpkgRoot) {
|
|
|
|
|
$vcpkgRoot = "C:\Users\furqa\vcpkg"
|
|
|
|
|
$env:VCPKG_ROOT = $vcpkgRoot
|
|
|
|
|
Write-Host "VCPKG_ROOT was not set. Defaulting to $vcpkgRoot" -ForegroundColor Yellow
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
|
|
|
|
|
if (-not (Test-Path $vcvars)) {
|
|
|
|
|
$vcvars = "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (-not (Test-Path $vcvars)) {
|
|
|
|
|
Write-Error "Could not find vcvars64.bat. Please ensure Visual Studio or Build Tools is installed."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Host "Loading MSVC environment variables using $vcvars..." -ForegroundColor Cyan
|
|
|
|
|
cmd /c "`"$vcvars`" && set" | Where-Object { $_ -match '=' } | ForEach-Object {
|
|
|
|
|
$name, $value = $_ -split '=', 2
|
|
|
|
|
[System.Environment]::SetEnvironmentVariable($name, $value, 'Process')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Host "Configuring CMake preset 'win-local-pdfium'..." -ForegroundColor Cyan
|
|
|
|
|
cmake --preset win-local-pdfium
|
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
|
|
|
Write-Error "CMake configuration failed."
|
|
|
|
|
exit $LASTEXITCODE
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-26 11:23:29 +05:30
|
|
|
Write-Host "Building all targets..." -ForegroundColor Cyan
|
|
|
|
|
cmake --build --preset win-local-pdfium
|
2026-05-22 15:47:48 +05:30
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
|
|
|
Write-Error "Build failed."
|
|
|
|
|
exit $LASTEXITCODE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Host "Success! The python extension is compiled and copied to the gateway." -ForegroundColor Green
|