# OpenSSL static link env for Windows MSVC (+crt-static /MT). Dot-source from client-tauri root. $ErrorActionPreference = "Stop" [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $opensslRoot = "C:\Program Files\OpenSSL-Win64" $staticOnlyDir = Join-Path $opensslRoot "lib\VC\x64\static-only" $mtDir = Join-Path $opensslRoot "lib\VC\x64\MT" $cryptoStatic = Join-Path $mtDir "libcrypto_static.lib" $sslStatic = Join-Path $mtDir "libssl_static.lib" if (-not (Test-Path $cryptoStatic) -or -not (Test-Path $sslStatic)) { Write-Host "ERROR: OpenSSL MT static libs not found." -ForegroundColor Red Write-Host " Expected: $cryptoStatic" -ForegroundColor Yellow Write-Host " Expected: $sslStatic" -ForegroundColor Yellow Write-Host " Install Win64 FULL from https://slproweb.com/products/Win32OpenSSL.html" -ForegroundColor Cyan exit 1 } New-Item -ItemType Directory -Path $staticOnlyDir -Force | Out-Null Copy-Item $cryptoStatic (Join-Path $staticOnlyDir "libcrypto.lib") -Force Copy-Item $sslStatic (Join-Path $staticOnlyDir "libssl.lib") -Force $env:OPENSSL_DIR = $opensslRoot $env:OPENSSL_LIB_DIR = $staticOnlyDir $env:OPENSSL_INCLUDE_DIR = Join-Path $opensslRoot "include" # Required: without this, openssl-sys links DLLs; runtime needs libcrypto-3-x64.dll on target PC. $env:OPENSSL_STATIC = "1" $env:RUSTFLAGS = "-C target-feature=+crt-static" Write-Host "OpenSSL static env OK (OPENSSL_STATIC=1)." -ForegroundColor Green