-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathBuildAllPlatforms.ps1
More file actions
162 lines (146 loc) · 4.22 KB
/
Copy pathBuildAllPlatforms.ps1
File metadata and controls
162 lines (146 loc) · 4.22 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
[CmdletBinding()]
Param(
[Parameter()]
[ValidateSet(
'bzip2',
'detours',
'dnssd',
'expat',
'freetype',
'fstrcmp',
'giflib',
'GoogleTest',
'harfbuzz',
'libaacs',
'libbdplus',
'libcdio',
'libffi',
'libfribidi',
'libgpg-error',
'libgcrypt',
'libjpeg-turbo',
'libiconv',
'libplist',
'libpng',
'libwebp',
'libxml2',
'miniwdk',
'openssl',
'python',
'pillow',
'pycryptodome',
'shairplay',
'sqlite',
'tinyxml',
'winflexbison',
'xz',
'zlib',
'zstd',
'DependenciesRequired',
'DependenciesRequiredDebug'
)]
[string[]] $Packages = @('DependenciesRequired'),
[switch] $GenerateProjects,
[switch] $Rel = $false,
[switch] $Deb = $false,
[switch] $Rebuild = $false,
[switch] $Desktop = $false,
[switch] $App = $false,
[ValidateSet( 'win32', 'x64', 'arm64' )]
[string[]] $Platforms = @( 'win32', 'x64', 'arm64' ),
[ValidateSet('10.0.18362.0', '10.0.22621.0')]
[string] $SdkVersion = '10.0.22621.0',
[ValidateSet(16, 17)]
[int] $VsVersion = 17,
[switch] $Zip = $false
)
$ErrorActionPreference = "Stop"
$ExcludedFromUwp = @(
'detours',
'dnssd',
'libplist',
'shairplay'
)
if ($GenerateProjects) {
foreach ($platform in $platforms) {
if ($Desktop -and ($platform -ne 'arm')) {
$path = "$PsScriptRoot\Build\$platform"
cmake -G "Visual Studio $VsVersion" -A $platform -Thost=x64 -DPATCH="C:\Program Files\Git\usr\bin\patch.exe" -S $PsScriptRoot -B $path
}
if ($App -and ($platform -ne 'arm64') -and ($platform -ne 'win32')) {
$path = "$PsScriptRoot\Build\win10-$Platform"
cmake -G "Visual Studio $VsVersion" -A $platform -Thost=x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="$SdkVersion" -DPATCH="C:\Program Files\Git\usr\bin\patch.exe" -S $PsScriptRoot -B $path
}
}
}
$cleanFirst
if ($Rebuild) {
$cleanFirst = "--clean-first"
}
$desktopPackages = $Packages
$appPackages = [string[]]($Packages | Where-Object { $_ -notin $ExcludedFromUwp })
foreach ($platform in $platforms) {
if ($Desktop -and ($platform -ne 'arm')) {
$path = "$PsScriptRoot\Build\$platform"
if ($Deb) {
cmake --build $path --config Debug -t @desktopPackages $cleanFirst --parallel -- -m
if ($LASTEXITCODE -ne 0) {
Write-Error "Some packages failed to build, $desktopPackages"
return;
}
}
if ($Rel) {
cmake --build $path --config RelWithDebInfo -t @desktopPackages $cleanFirst --parallel -- -m
if ($LASTEXITCODE -ne 0) {
Write-Error "Some packages failed to build, $desktopPackages"
return;
}
}
}
if ($App -and ($platform -ne 'arm64') -and ($platform -ne 'win32')) {
$storePath = "$PsScriptRoot\Build\win10-$Platform"
if ($Deb) {
cmake --build $storePath --config Debug -t @appPackages $cleanFirst --parallel -- -m
if ($LASTEXITCODE -ne 0) {
Write-Error "Some packages failed to build, $appPackages"
return;
}
}
if ($Rel) {
cmake --build $storePath --config RelWithDebInfo -t @appPackages $cleanFirst --parallel -- -m
if ($LASTEXITCODE -ne 0) {
Write-Error "Some packages failed to build, $appPackages"
return;
}
}
}
}
if ($Zip) {
if ($desktopPackages.Count -gt 0) {
$desktopPackages = [string[]]($desktopPackages | foreach-Object { "$_-zip" })
$appPackages = [string[]]($appPackages | foreach-Object { "$_-zip" })
}
elseif ($desktopPackages.Count -eq 0) {
$desktopPackages = @('zip')
$appPackages = @('zip')
}
foreach ($platform in $platforms) {
if ($Desktop -and ($platform -ne 'arm')) {
$path = "$PsScriptRoot\Build\$platform"
cmake --build $path --config RelWithDebInfo -t @desktopPackages --parallel -- -m
if ($LASTEXITCODE -ne 0) {
Write-Error "Some packages failed to package"
return;
}
}
if ($App -and ($platform -ne 'arm64') -and ($platform -ne 'win32')) {
$storePath = "$PsScriptRoot\Build\win10-$Platform"
cmake --build $storePath --config RelWithDebInfo -t @appPackages --parallel -- -m
if ($LASTEXITCODE -ne 0) {
Write-Error "Some packages failed to package"
return;
}
}
}
}
Write-Host "All done"