Skip to content

Commit

Permalink
CI: Add support for Windows ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyvct committed Nov 20, 2022
1 parent cea28cb commit de74b88
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ jobs:
if: always()
strategy:
matrix:
arch: [x64, x86]
arch: [x64, x86, ARM64]
env:
CMAKE_GENERATOR: 'Visual Studio 17 2022'
CMAKE_SYSTEM_VERSION: '10.0.18363.657'
Expand Down Expand Up @@ -324,6 +324,7 @@ jobs:
- name: 'Restore VLC dependency from cache'
id: vlc-cache
if: matrix.arch != 'ARM64'
uses: actions/cache@v3
env:
CACHE_NAME: 'vlc-cache'
Expand All @@ -333,6 +334,7 @@ jobs:

- name: 'Restore Chromium Embedded Framework from cache'
id: cef-cache
if: matrix.arch != 'ARM64'
uses: actions/cache@v3
env:
CACHE_NAME: 'cef-cache'
Expand Down
26 changes: 22 additions & 4 deletions CI/windows/01_install_dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Param(
[Switch]$Help = $(if (Test-Path variable:Help) { $Help }),
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }),
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }),
[ValidateSet('x86', 'x64')]
[ValidateSet('x86', 'x64', 'ARM64')]
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] })
)

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

$ArchSuffix = $BuildArch
$ArchSuffix = $BuildArch.ToLower()

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

Expand All @@ -52,17 +52,26 @@ function Install-qt-deps {
Write-Status "Setup for pre-built dependency Qt v${Version}"
Ensure-Directory $DepsBuildDir

$ArchSuffix = $BuildArch
$ArchSuffix = $BuildArch.ToLower()

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

if (${BuildArch} -eq "arm64") {
Write-Step "Download x64 qt..."
$ProgressPreference = $(if ($Quiet.isPresent) { 'SilentlyContinue' } else { 'Continue' })
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-deps/releases/download/${Version}/windows-deps-qt6-${Version}-${ArchSuffix}.zip" -UseBasicParsing -OutFile "windows-deps-qt6-${Version}-${ArchSuffix}.zip"
$ProgressPreference = "Continue"

Write-Step "Unpack x64 qt..."
Expand-Archive -Path "windows-deps-qt6-${Version}-${ArchSuffix}.zip" -DestinationPath "${DepsBuildDir}/qt_host" -Force
}

Write-Step "Download..."
$ProgressPreference = $(if ($Quiet.isPresent) { 'SilentlyContinue' } else { 'Continue' })
Invoke-WebRequest -Uri "https://github.com/obsproject/obs-deps/releases/download/${Version}/windows-deps-qt6-${Version}-${ArchSuffix}.zip" -UseBasicParsing -OutFile "windows-deps-qt6-${Version}-${ArchSuffix}.zip"
$ProgressPreference = "Continue"

Write-Step "Unpack..."

Expand-Archive -Path "windows-deps-qt6-${Version}-${ArchSuffix}.zip" -DestinationPath "${DepsBuildDir}/windows-deps-${Version}-${ArchSuffix}" -Force
} else {
Write-Step "Found existing pre-built Qt..."
Expand All @@ -75,6 +84,10 @@ function Install-vlc {
[String]$Version
)

if (${BuildArch} -eq "arm64") {
Write-Status "Skip VLC for Winodws ARM64"
}

Write-Status "Setup for dependency VLC v${Version}"
Ensure-Directory $DepsBuildDir

Expand All @@ -98,6 +111,11 @@ function Install-cef {
[Parameter(Mandatory=$true)]
[String]$Version
)

if (${BuildArch} -eq "arm64") {
Write-Status "Skip VLC for Winodws ARM64"
}

Write-Status "Setup for dependency CEF v${Version} - ${BuildArch}"

Ensure-Directory $DepsBuildDir
Expand Down
12 changes: 10 additions & 2 deletions CI/windows/02_build_obs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Param(
[Switch]$Quiet = $(if (Test-Path variable:Quiet) { $Quiet }),
[Switch]$Verbose = $(if (Test-Path variable:Verbose) { $Verbose }),
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" } else { "build" }),
[ValidateSet('x86', 'x64')]
[ValidateSet('x86', 'x64', 'ARM64')]
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] }),
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" } else { "RelWithDebInfo" })
Expand Down Expand Up @@ -61,14 +61,20 @@ function Configure-OBS {
$CmakePrefixPath = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/windows-deps-${WindowsDepsVersion}-${BuildArch}"
$CefDirectory = Resolve-Path -Path "${CheckoutDir}/../obs-build-dependencies/cef_binary_${WindowsCefVersion}_windows_${BuildArch}"
$BuildDirectoryActual = "${BuildDirectory}$(if (${BuildArch} -eq "x64") { "64" } else { "32" })"
$GeneratorPlatform = "$(if (${BuildArch} -eq "x64") { "x64" } else { "Win32" })"

$GeneratorPlatform = "$(if (${BuildArch} -eq "x86") { "Win32" } else { ${BuildArch} })"
if (${BuildArch} -eq "arm64") {
$Qt_Host_Path = Resolve-Path -Path "${CmakePrefixPath}/../qt_host"
}

if ( $PSVersionTable.PSVersion -ge '7.3.0' ) {
$CmakeCommand = @(
"-G", ${CmakeGenerator}
"-DCMAKE_GENERATOR_PLATFORM=${GeneratorPlatform}",
"-DCMAKE_SYSTEM_VERSION=${CmakeSystemVersion}",
"-DCMAKE_PREFIX_PATH:PATH=${CmakePrefixPath}",
"-DCMAKE_TOOLCHAIN_FILE=${CmakePrefixPath}/lib/cmake/Qt6/qt.toolchain.cmake",
"$(if (${BuildArch} -eq "arm64") { "QT_HOST_PATH=${Qt_Host_Path}" })",
"-DCEF_ROOT_DIR:PATH=${CefDirectory}",
"-DENABLE_BROWSER=ON",
"-DVLC_PATH:PATH=${CheckoutDir}/../obs-build-dependencies/vlc-${WindowsVlcVersion}",
Expand All @@ -95,6 +101,8 @@ function Configure-OBS {
"-DCMAKE_GENERATOR_PLATFORM=`"${GeneratorPlatform}`"",
"-DCMAKE_SYSTEM_VERSION=`"${CmakeSystemVersion}`"",
"-DCMAKE_PREFIX_PATH:PATH=`"${CmakePrefixPath}`"",
"-DCMAKE_TOOLCHAIN_FILE=`"${CmakePrefixPath}\lib\cmake\Qt6\qt.toolchain.cmake`"",
"$(if (${BuildArch} -eq "arm64") { "QT_HOST_PATH=${Qt_Host_Path}" })",
"-DCEF_ROOT_DIR:PATH=`"${CefDirectory}`"",
"-DENABLE_BROWSER=ON",
"-DVLC_PATH:PATH=`"${CheckoutDir}/../obs-build-dependencies/vlc-${WindowsVlcVersion}`"",
Expand Down
18 changes: 17 additions & 1 deletion CI/windows/03_package_obs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Param(
[Switch]$BuildInstaller = $(if ($BuildInstaller.isPresent) { $BuildInstaller }),
[Switch]$CombinedArchs = $(if ($CombinedArchs.isPresent) { $CombinedArchs }),
[String]$BuildDirectory = $(if (Test-Path variable:BuildDirectory) { "${BuildDirectory}" } else { "build" }),
[ValidateSet('x86', 'x64')]
[ValidateSet('x86', 'x64', 'ARM64')]
[String]$BuildArch = $(if (Test-Path variable:BuildArch) { "${BuildArch}" } else { ('x86', 'x64')[[System.Environment]::Is64BitOperatingSystem] }),
[ValidateSet("Release", "RelWithDebInfo", "MinSizeRel", "Debug")]
[String]$BuildConfiguration = $(if (Test-Path variable:BuildConfiguration) { "${BuildConfiguration}" } else { "RelWithDebInfo" })
Expand Down Expand Up @@ -82,6 +82,22 @@ function Package-OBS {
Compress-Archive -Force @CompressVars
$ProgressPreference = 'Continue'

} elseif ($BuildArch -eq "ARM64") {
Write-Step "Install 64-bit OBS..."
Invoke-Expression "cmake --build `"${BuildDirectory}64`" --config ${BuildConfiguration} -t install"

$CompressVars = @{
Path = "${CheckoutDir}/build64/install/bin", "${CheckoutDir}/build64/install/data", "${CheckoutDir}/build64/install/obs-plugins"
CompressionLevel = "Optimal"
DestinationPath = "${FileName}-Win-ARM64.zip"
}

Write-Step "Creating zip archive..."

$ProgressPreference = $(if ($Quiet.isPresent) { 'SilentlyContinue' } else { 'Continue' })
Compress-Archive -Force @CompressVars
$ProgressPreference = 'Continue'

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

0 comments on commit de74b88

Please sign in to comment.