-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.ps1
More file actions
70 lines (57 loc) · 1.53 KB
/
build.ps1
File metadata and controls
70 lines (57 loc) · 1.53 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
# Set error action preference and encoding
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# Environment variables for build
$env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin"
$env:VCPKG_ROOT = "C:\vcpkg"
$env:RUSTFLAGS = "-C target-feature=+crt-static"
$env:VCPKG_DEFAULT_TRIPLET = "x64-windows-static"
$env:CARGO_REGISTRIES_CRATES_IO_PROTOCOL = "sparse"
# Increase memory limits
$env:DART_VM_OPTIONS = "--old_gen_heap_size=4096 --max_old_space_size=4096"
$env:NODE_OPTIONS = "--max_old_space_size=4096"
# Parse command line arguments
param(
[switch]$portable,
[switch]$flutter,
[switch]$hwcodec,
[switch]$vram,
[switch]$feature,
[string]$featureName = "",
[switch]$skip_portable_pack
)
# Build command construction
$buildArgs = @("build.py")
if ($portable) {
$buildArgs += "--portable"
}
if ($flutter) {
$buildArgs += "--flutter"
}
if ($hwcodec) {
$buildArgs += "--hwcodec"
}
if ($vram) {
$buildArgs += "--vram"
}
if ($feature -and $featureName) {
$buildArgs += "--feature"
$buildArgs += $featureName
}
if ($skip_portable_pack) {
$buildArgs += "--skip-portable-pack"
}
# Execute build
try {
Write-Host "Starting build with arguments: $buildArgs"
python $buildArgs
if ($LASTEXITCODE -ne 0) {
throw "Build failed with exit code $LASTEXITCODE"
}
Write-Host "Build completed successfully"
} catch {
Write-Warning "Build failed"
Write-Warning $_.Exception.Message
exit 1
}