Skip to content

Commit ff916e5

Browse files
PatTheMavRytoEX
authored andcommitted
CI: Fix Windows build scripts relying on localized architecture string
Current build scripts rely on comparing a architecture string provided by the OS which will be localised in certain languages. This change uses a boolean 64-bit flag to use script-defined identifiers to avoid this issue.
1 parent c7bf564 commit ff916e5

5 files changed

Lines changed: 42 additions & 42 deletions

File tree

.github/workflows/main.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ jobs:
284284
if: always()
285285
strategy:
286286
matrix:
287-
arch: [64, 32]
287+
arch: [x64, x86]
288288
env:
289289
CMAKE_GENERATOR: 'Visual Studio 16 2019'
290290
CMAKE_SYSTEM_VERSION: '10.0.18363.657'
@@ -325,8 +325,8 @@ jobs:
325325
env:
326326
CACHE_NAME: 'cef-cache'
327327
with:
328-
path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_WIN }}_windows${{ matrix.arch }}_minimal
329-
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_WIN }}-${{ env.CACHE_REVISION }}
328+
path: ${{ github.workspace }}/obs-build-dependencies/cef_binary_${{ env.CEF_BUILD_VERSION_WIN }}_windows_${{ matrix.arch }}
329+
key: ${{ runner.os }}-pr-${{ env.CACHE_NAME }}-${{ env.CEF_BUILD_VERSION_WIN }}-${{ matrix.arch }}-${{ env.CACHE_REVISION }}
330330

331331
- name: Setup Environment
332332
id: setup
@@ -338,23 +338,23 @@ jobs:
338338
env:
339339
RESTORED_VLC: ${{ steps.vlc-cache.outputs.cache-hit }}
340340
RESTORED_CEF: ${{ steps.cef-cache.outputs.cache-hit }}
341-
run: CI/windows/01_install_dependencies.ps1 -BuildArch ${{ matrix.arch }}-bit
341+
run: CI/windows/01_install_dependencies.ps1 -BuildArch ${{ matrix.arch }}
342342

343343
- name: 'Build OBS'
344-
run: CI/windows/02_build_obs.ps1 -BuildArch ${{ matrix.arch }}-bit
344+
run: CI/windows/02_build_obs.ps1 -BuildArch ${{ matrix.arch }}
345345

346346
- name: 'Create build artifact'
347347
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
348348
run: |
349-
CI/windows/03_package_obs.ps1 -BuildArch ${{ matrix.arch }}-bit -Package
350-
$ArtifactName = Get-ChildItem -filter "OBS-Studio-*-Win${{ matrix.arch }}.zip" -File
349+
CI/windows/03_package_obs.ps1 -BuildArch ${{ matrix.arch }} -Package
350+
$ArtifactName = Get-ChildItem -filter "OBS-Studio-*-Win-${{ matrix.arch }}.zip" -File
351351
Write-Output "FILE_NAME=${ArtifactName}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
352352
353353
- name: 'Upload build artifact'
354354
if: ${{ success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1') }}
355355
uses: actions/upload-artifact@v3
356356
with:
357-
name: 'obs-win${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
357+
name: 'obs-win-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
358358
path: '${{ env.FILE_NAME }}'
359359

360360
linux_package:
@@ -431,12 +431,12 @@ jobs:
431431
$null = New-Item -ItemType Directory -Force -Path install_temp
432432
}
433433
434-
Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win32.zip" -File)" -DestinationPath install_temp
435-
Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win64.zip" -File)" -Force -DestinationPath install_temp
434+
Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win-x86.zip" -File)" -DestinationPath install_temp
435+
Expand-Archive -Path "$(Get-ChildItem -filter "OBS-Studio-*-Win-x64.zip" -File)" -Force -DestinationPath install_temp
436436
437437
CI/windows/03_package_obs.ps1 -CombinedArchs -Package
438438
439-
$ArtifactName = (Get-ChildItem -filter "OBS-Studio-*-Windows.zip" -File).Name
439+
$ArtifactName = (Get-ChildItem -filter "OBS-Studio-*-Win-x64+x86.zip" -File).Name
440440
Write-Output "FILE_NAME=${ArtifactName}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
441441
442442
- name: 'Upload build artifact'

CI/build-windows.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Param(
77
[Switch]$BuildInstaller,
88
[Switch]$CombinedArchs,
99
[String]$BuildDirectory = "build",
10-
[ValidateSet("32-bit", "64-bit")]
11-
[String]$BuildArch = (Get-CimInstance CIM_OperatingSystem).OSArchitecture,
10+
[ValidateSet('x86', 'x64')]
11+
[String]$BuildArch = ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem],
1212
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
1313
[String]$BuildConfiguration = "RelWithDebInfo"
1414
)
@@ -30,11 +30,11 @@ Param(
3030
# -BuildDirectory : Directory to use for builds
3131
# Default: build64 on 64-bit systems
3232
# build32 on 32-bit systems
33-
# -BuildArch : Build architecture to use ("32-bit" or "64-bit")
33+
# -BuildArch : Build architecture to use (x86 or x64)
3434
# -BuildConfiguration : Build configuration to use
3535
# Default: RelWithDebInfo
3636
# -CombinedArchs : Create combined packages and installer
37-
# (64-bit and 32-bit) - Default: off
37+
# (x86 and x64) - Default: off
3838
# -Package : Prepare folder structure for installer creation
3939
#
4040
# Environment Variables (optional):
@@ -87,16 +87,16 @@ function Build-OBS-Main {
8787
}
8888

8989
if(!($SkipDependencyChecks.isPresent)) {
90-
Install-Dependencies -BuildArch 64-bit
90+
Install-Dependencies -BuildArch x64
9191
}
9292

93-
Build-OBS -BuildArch 64-bit
93+
Build-OBS -BuildArch x64
9494

9595
if(!($SkipDependencyChecks.isPresent)) {
96-
Install-Dependencies -BuildArch 32-bit
96+
Install-Dependencies -BuildArch x86
9797
}
9898

99-
Build-OBS -BuildArch 32-bit
99+
Build-OBS -BuildArch x86
100100
} else {
101101
if(!($SkipDependencyChecks.isPresent)) {
102102
Install-Dependencies
@@ -120,7 +120,7 @@ function Print-Usage {
120120
"-Verbose : Enable more verbose build process output"
121121
"-SkipDependencyChecks : Skip dependency checks - Default: off",
122122
"-BuildDirectory : Directory to use for builds - Default: build64 on 64-bit systems, build32 on 32-bit systems",
123-
"-BuildArch : Build architecture to use ('32-bit' or '64-bit') - Default: local architecture",
123+
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture",
124124
"-BuildConfiguration : Build configuration to use - Default: RelWithDebInfo",
125125
"-CombinedArchs : Create combined packages and installer (64-bit and 32-bit) - Default: off"
126126
"-Package : Prepare folder structure for installer creation"

CI/windows/01_install_dependencies.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Param(
22
[Switch]$Help = $(if (Test-Path variable:Help) { $Help }),
33
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }),
44
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }),
5-
[ValidateSet("32-bit", "64-bit")]
6-
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { (Get-CimInstance CIM_OperatingSystem).OSArchitecture })
5+
[ValidateSet('x86', 'x64')]
6+
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] })
77
)
88

99
##############################################################################
@@ -26,7 +26,7 @@ Function Install-obs-deps {
2626
Write-Status "Setup for pre-built Windows OBS dependencies v${Version}"
2727
Ensure-Directory $DepsBuildDir
2828

29-
$ArchSuffix = "$(if ($BuildArch -eq "64-bit") { "x64" } else { "x86" })"
29+
$ArchSuffix = $BuildArch
3030

3131
if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}")) {
3232

@@ -52,7 +52,7 @@ function Install-qt-deps {
5252
Write-Status "Setup for pre-built dependency Qt v${Version}"
5353
Ensure-Directory $DepsBuildDir
5454

55-
$ArchSuffix = "$(if ($BuildArch -eq "64-bit") { "x64" } else { "x86" })"
55+
$ArchSuffix = $BuildArch
5656

5757
if (!(Test-Path "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}/mkspecs")) {
5858

@@ -101,7 +101,7 @@ function Install-cef {
101101
Write-Status "Setup for dependency CEF v${Version} - ${BuildArch}"
102102

103103
Ensure-Directory $DepsBuildDir
104-
$ArchSuffix = "$(if ($BuildArch -eq "64-bit") { "x64" } else { "x86" })"
104+
$ArchSuffix = $BuildArch
105105

106106
if (!((Test-Path "${DepsBuildDir}/cef_binary_${Version}_windows_${ArchSuffix}") -and (Test-Path "${DepsBuildDir}/cef_binary_${Version}_windows_${ArchSuffix}/build/libcef_dll_wrapper/Release/libcef_dll_wrapper.lib"))) {
107107
Write-Step "Download..."
@@ -160,7 +160,7 @@ function Print-Usage {
160160
"-Quiet : Suppress most build process output",
161161
"-Verbose : Enable more verbose build process output",
162162
"-Choco : Enable automatic dependency installation via Chocolatey - Default: off"
163-
"-BuildArch : Build architecture to use (32-bit or 64-bit) - Default: local architecture"
163+
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture"
164164
)
165165

166166
$Lines | Write-Host

CI/windows/02_build_obs.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Param(
33
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }),
44
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }),
55
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" } else { "build" }),
6-
[ValidateSet("32-bit", "64-bit")]
7-
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { (Get-CimInstance CIM_OperatingSystem).OSArchitecture }),
6+
[ValidateSet('x86', 'x64')]
7+
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] }),
88
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
99
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" } else { "RelWithDebInfo" })
1010
)
@@ -41,7 +41,7 @@ function Build-OBS {
4141
Ensure-Directory ${CheckoutDir}
4242
Write-Step "Build OBS targets..."
4343

44-
Invoke-Expression "cmake --build $(if($BuildArch -eq "64-bit") { "build64" } else { "build32" }) --config ${BuildConfiguration}"
44+
Invoke-Expression "cmake --build $(if($BuildArch -eq "x64") { "build64" } else { "build32" }) --config ${BuildConfiguration}"
4545
}
4646

4747
function Configure-OBS {
@@ -56,10 +56,10 @@ function Configure-OBS {
5656
}
5757

5858
# TODO: Clean up archive and directory naming across dependencies
59-
$CmakePrefixPath = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/windows-deps-${WindowsDepsVersion}-$(if (${BuildArch} -eq "64-bit") { "x64" } else { "x86" })"
60-
$CefDirectory = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/cef_binary_${WindowsCefVersion}_windows_$(if (${BuildArch} -eq "64-bit") { "x64" } else { "x86" })"
61-
$BuildDirectoryActual = "${BuildDirectory}$(if (${BuildArch} -eq "64-bit") { "64" } else { "32" })"
62-
$GeneratorPlatform = "$(if (${BuildArch} -eq "64-bit") { "x64" } else { "Win32" })"
59+
$CmakePrefixPath = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/windows-deps-${WindowsDepsVersion}-${BuildArch}"
60+
$CefDirectory = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/cef_binary_${WindowsCefVersion}_windows_${BuildArch}"
61+
$BuildDirectoryActual = "${BuildDirectory}$(if (${BuildArch} -eq "x64") { "64" } else { "32" })"
62+
$GeneratorPlatform = "$(if (${BuildArch} -eq "x64") { "x64" } else { "Win32" })"
6363

6464
$CmakeCommand = @(
6565
"-S . -B `"${BuildDirectoryActual}`"",
@@ -112,7 +112,7 @@ function Print-Usage {
112112
"-Quiet : Suppress most build process output",
113113
"-Verbose : Enable more verbose build process output",
114114
"-BuildDirectory : Directory to use for builds - Default: build64 on 64-bit systems, build32 on 32-bit systems",
115-
"-BuildArch : Build architecture to use (32-bit or 64-bit) - Default: local architecture",
115+
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture",
116116
"-BuildConfiguration : Build configuration to use - Default: RelWithDebInfo"
117117
)
118118

CI/windows/03_package_obs.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Param(
55
[Switch]$BuildInstaller = $(if ($BuildInstaller.isPresent) { $BuildInstaller }),
66
[Switch]$CombinedArchs = $(if ($CombinedArchs.isPresent) { $CombinedArchs }),
77
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" } else { "build" }),
8-
[ValidateSet("32-bit", "64-bit")]
9-
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { (Get-CimInstance CIM_OperatingSystem).OSArchitecture }),
8+
[ValidateSet('x86', 'x64')]
9+
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] }),
1010
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
1111
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" } else { "RelWithDebInfo" })
1212
)
@@ -57,7 +57,7 @@ function Package-OBS {
5757
$CompressVars = @{
5858
Path = "${CheckoutDir}/build/install/*"
5959
CompressionLevel = "Optimal"
60-
DestinationPath = "${FileName}-Windows.zip"
60+
DestinationPath = "${FileName}-Win-x86+x64.zip"
6161
}
6262

6363
Write-Step "Creating zip archive..."
@@ -66,14 +66,14 @@ function Package-OBS {
6666
Compress-Archive -Force @CompressVars
6767
$ProgressPreference = 'Continue'
6868

69-
} elseif ($BuildArch -eq "64-bit") {
69+
} elseif ($BuildArch -eq "x64") {
7070
Write-Step "Install 64-bit OBS..."
7171
Invoke-Expression "cmake --build `"${BuildDirectory}64`" --config ${BuildConfiguration} -t install"
7272

7373
$CompressVars = @{
7474
Path = "${CheckoutDir}/build64/install/bin", "${CheckoutDir}/build64/install/data", "${CheckoutDir}/build64/install/obs-plugins"
7575
CompressionLevel = "Optimal"
76-
DestinationPath = "${FileName}-Win64.zip"
76+
DestinationPath = "${FileName}-Win-x64.zip"
7777
}
7878

7979
Write-Step "Creating zip archive..."
@@ -82,14 +82,14 @@ function Package-OBS {
8282
Compress-Archive -Force @CompressVars
8383
$ProgressPreference = 'Continue'
8484

85-
} elseif ($BuildArch -eq "32-bit") {
85+
} elseif ($BuildArch -eq "x86") {
8686
Write-Step "Install 32-bit OBS..."
8787
Invoke-Expression "cmake --build `"${BuildDirectory}32`" --config ${BuildConfiguration} -t install"
8888

8989
$CompressVars = @{
9090
Path = "${CheckoutDir}/build32/install/bin", "${CheckoutDir}/build32/install/data", "${CheckoutDir}/build32/install/obs-plugins"
9191
CompressionLevel = "Optimal"
92-
DestinationPath = "${FileName}-Win32.zip"
92+
DestinationPath = "${FileName}-Win-x86.zip"
9393
}
9494

9595
Write-Step "Creating zip archive..."
@@ -136,7 +136,7 @@ function Print-Usage {
136136
"-Verbose : Enable more verbose build process output",
137137
"-CombinedArchs : Create combined architecture package",
138138
"-BuildDirectory : Directory to use for builds - Default: build64 on 64-bit systems, build32 on 32-bit systems",
139-
"-BuildArch : Build architecture to use (32-bit or 64-bit) - Default: local architecture",
139+
"-BuildArch : Build architecture to use (x86 or x64) - Default: local architecture",
140140
"-BuildConfiguration : Build configuration to use - Default: RelWithDebInfo"
141141
)
142142

0 commit comments

Comments
 (0)