-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_windows.ps1
More file actions
86 lines (75 loc) · 2.57 KB
/
build_windows.ps1
File metadata and controls
86 lines (75 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Build script for SketchBridge on Windows (PowerShell)
#
# Prerequisites:
# - Python 3.10 or later
# - pip install pyinstaller
# - All SketchBridge dependencies installed
#
# Usage:
# .\build_windows.ps1
#
# Output:
# dist/SketchBridge/SketchBridge.exe
$ErrorActionPreference = "Stop"
Write-Host "============================================" -ForegroundColor Cyan
Write-Host "Building SketchBridge for Windows" -ForegroundColor Cyan
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
# Check if Python is available
try {
$pythonVersion = python --version 2>&1
Write-Host "Found: $pythonVersion" -ForegroundColor Green
} catch {
Write-Host "ERROR: Python is not installed or not in PATH" -ForegroundColor Red
exit 1
}
# Check if PyInstaller is available
$pyinstallerInstalled = python -c "import PyInstaller" 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "PyInstaller not found. Installing..." -ForegroundColor Yellow
pip install pyinstaller
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Failed to install PyInstaller" -ForegroundColor Red
exit 1
}
}
# Install/update dependencies
Write-Host ""
Write-Host "Installing dependencies..." -ForegroundColor Yellow
pip install -e . 2>&1 | Out-Null
# Clean previous builds
Write-Host ""
Write-Host "Cleaning previous builds..." -ForegroundColor Yellow
if (Test-Path "build") {
Remove-Item -Recurse -Force "build"
}
if (Test-Path "dist\SketchBridge") {
Remove-Item -Recurse -Force "dist\SketchBridge"
}
# Run PyInstaller
Write-Host ""
Write-Host "Running PyInstaller..." -ForegroundColor Yellow
pyinstaller sketch_bridge.spec --noconfirm
if ($LASTEXITCODE -ne 0) {
Write-Host ""
Write-Host "ERROR: Build failed!" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "============================================" -ForegroundColor Green
Write-Host "Build complete!" -ForegroundColor Green
Write-Host "============================================" -ForegroundColor Green
Write-Host ""
Write-Host "Output: dist\SketchBridge\SketchBridge.exe" -ForegroundColor Cyan
Write-Host ""
Write-Host "To distribute, copy the entire dist\SketchBridge folder."
Write-Host ""
# Show folder size
$folderSize = (Get-ChildItem -Recurse "dist\SketchBridge" | Measure-Object -Property Length -Sum).Sum / 1MB
Write-Host "Distribution size: $([math]::Round($folderSize, 1)) MB" -ForegroundColor Cyan
Write-Host ""
# Optionally run the built application
$run = Read-Host "Run SketchBridge now? (y/n)"
if ($run -eq "y") {
Start-Process "dist\SketchBridge\SketchBridge.exe"
}