| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- # Build script for Tauri application(OpenSSL 静态链接进 exe,无需 libcrypto DLL)
- [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
- $ErrorActionPreference = "Stop"
- $ProjectRoot = $PSScriptRoot
- $APIUrl = "http://125.122.32.114:9000"
- # OpenSSL 静态链接(与 .cargo/config.toml +crt-static 一致)
- . (Join-Path $ProjectRoot "scripts\set-openssl-static-env.ps1")
- Set-Location $ProjectRoot
- Write-Host "========================================"
- Write-Host " Building Tauri App (static OpenSSL)"
- Write-Host "========================================"
- Write-Host ""
- Write-Host "Checking Rust..."
- if (-not (Get-Command rustc -ErrorAction SilentlyContinue)) {
- Write-Host "ERROR: Rust not found!"
- exit 1
- }
- Write-Host " Rust OK"
- Write-Host "Checking Node.js..."
- if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
- Write-Host "ERROR: Node.js not found!"
- exit 1
- }
- Write-Host " Node OK"
- Write-Host ""
- Write-Host "OpenSSL static linking:"
- Write-Host " OPENSSL_DIR=$env:OPENSSL_DIR"
- Write-Host " OPENSSL_LIB_DIR=$env:OPENSSL_LIB_DIR"
- Write-Host " OPENSSL_STATIC=$env:OPENSSL_STATIC"
- Write-Host ""
- Write-Host "Setting API URL: $APIUrl"
- $env:DEFAULT_BACKEND_API_URL = $APIUrl
- Write-Host ""
- Write-Host "Installing dependencies..."
- npm install --silent
- Write-Host ""
- Write-Host "Building Tauri application..."
- Write-Host ""
- $startTime = Get-Date
- npm run tauri build
- if ($LASTEXITCODE -ne 0) {
- Write-Host ""
- Write-Host "BUILD FAILED!" -ForegroundColor Red
- exit 1
- }
- $endTime = Get-Date
- $duration = New-TimeSpan -Start $startTime -End $endTime
- Write-Host ""
- Write-Host "========================================"
- Write-Host " BUILD SUCCESS!" -ForegroundColor Green
- Write-Host "========================================"
- Write-Host ""
- Write-Host "Duration: $($duration.ToString('mm\:ss'))"
- Write-Host "API URL: $APIUrl"
- Write-Host ""
- $exe = Get-ChildItem "src-tauri\target\release" -Filter "*.exe" -File -ErrorAction SilentlyContinue |
- Where-Object { $_.DirectoryName -like "*release" -and $_.Length -gt 5MB } |
- Sort-Object Length -Descending | Select-Object -First 1
- if ($exe) {
- $size = "{0:N2} MB" -f ($exe.Length / 1MB)
- Write-Host "Standalone EXE:"
- Write-Host " $($exe.FullName)" -ForegroundColor Green
- Write-Host " Size: $size"
- # 定制版分发副本(不覆盖 steamSH_V*.exe / SteamSH_Portable.zip)
- $customName = "SteamQG.exe"
- $customPath = Join-Path $ProjectRoot $customName
- Copy-Item -Path $exe.FullName -Destination $customPath -Force
- Write-Host ""
- Write-Host "Custom portable copy:"
- Write-Host " $customPath" -ForegroundColor Green
- Write-Host " (old SteamSH_Portable.zip / steamSH_V*.exe left untouched)"
- }
- $nsisFiles = Get-ChildItem -Path "src-tauri\target\release\bundle\nsis" -Filter "*setup.exe" -ErrorAction SilentlyContinue
- if ($nsisFiles) {
- Write-Host ""
- Write-Host "NSIS Installer:"
- foreach ($nsis in $nsisFiles) {
- $size = "{0:N2} MB" -f ($nsis.Length / 1MB)
- Write-Host " $($nsis.FullName)" -ForegroundColor Cyan
- Write-Host " Size: $size"
- }
- }
- Write-Host ""
- Write-Host "Build complete!"
|