diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e259dd79..9ea9921c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -460,7 +460,7 @@ jobs: strategy: fail-fast: true matrix: - target: [x64, x86] + target: [x64, x86, arm64] include: - target: x64 config: 'Release' @@ -468,6 +468,9 @@ jobs: - target: x86 config: 'Release' type: 'static' + - target: arm64 + config: 'Release' + type: 'static' env: CACHE_REVISION: '3' defaults: diff --git a/Build-Dependencies.ps1 b/Build-Dependencies.ps1 index b2c9b9439..8d2ff4f2d 100644 --- a/Build-Dependencies.ps1 +++ b/Build-Dependencies.ps1 @@ -3,7 +3,7 @@ param( [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')] [string] $Configuration = 'Release', [string[]] $Dependencies, - [ValidateSet('x86', 'x64')] + [ValidateSet('x86', 'x64', 'arm64')] [string] $Target, [switch] $Clean, [switch] $Quiet, @@ -27,6 +27,15 @@ if ( $PSVersionTable.PSVersion -lt '7.0.0' ) { } function Run-Stages { + # trap { + # Write-Host '---------------------------------------------------------------------------------------------------' + # Write-Host -NoNewLine '[OBS-DEPS] ' + # Write-Host -ForegroundColor Red 'Error(s) occurred:' + # Write-Host '---------------------------------------------------------------------------------------------------' + # Write-Error $_ + # exit 2 + # } + $Stages = @('Setup') if ( ( $SkipAll ) -or ( $SkipBuild ) ) { @@ -151,14 +160,14 @@ function Package-Dependencies { } function Build-Main { - trap { - Write-Host '---------------------------------------------------------------------------------------------------' - Write-Host -NoNewLine '[OBS-DEPS] ' - Write-Host -ForegroundColor Red 'Error(s) occurred:' - Write-Host '---------------------------------------------------------------------------------------------------' - Write-Error $_ - exit 2 - } + # trap { + # Write-Host '---------------------------------------------------------------------------------------------------' + # Write-Host -NoNewLine '[OBS-DEPS] ' + # Write-Host -ForegroundColor Red 'Error(s) occurred:' + # Write-Host '---------------------------------------------------------------------------------------------------' + # Write-Error $_ + # exit 2 + # } $script:PackageName = ((Get-Item $PSCommandPath).Basename).Split('-')[1] if ( $script:PackageName -eq 'Dependencies' ) { diff --git a/deps.windows/40-detours.ps1 b/deps.windows/40-detours.ps1 index 45173388b..af9613fd2 100644 --- a/deps.windows/40-detours.ps1 +++ b/deps.windows/40-detours.ps1 @@ -2,7 +2,7 @@ param( [string] $Name = 'detours', [string] $Version = '4.0.1', [string] $Uri = 'https://github.com/microsoft/detours.git', - [string] $Hash = 'e4bfd6b03e50de46b47abfbd1e46b384f0c5f833' + [string] $Hash = '734ac64899c44933151c1335f6ef54a590219221' ) function Setup { @@ -34,7 +34,7 @@ function Build { BuildPath = "src" BuildCommand = "nmake" Target = $Target - HostArchitecture = $Target + # HostArchitecture = $Target } Invoke-DevShell @Params diff --git a/deps.windows/40-luajit.ps1 b/deps.windows/40-luajit.ps1 index d71aa973e..e2d122c5e 100644 --- a/deps.windows/40-luajit.ps1 +++ b/deps.windows/40-luajit.ps1 @@ -6,10 +6,20 @@ param( ) function Setup { + if (${Target} -eq "arm64") { + Log-Information "Skipping Setup ${Name} for Windows ARM64" + return + } + Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath $Path } function Build { + if (${Target} -eq "arm64") { + Log-Information "Skipping Build ${Name} for Windows ARM64" + return + } + Log-Information "Build (${Target})" Set-Location $Path @@ -24,6 +34,11 @@ function Build { } function Install { + if (${Target} -eq "arm64") { + Log-Information "Skipping Install ${Name} for Windows ARM64" + return + } + Log-Information "Install (${Target})" Set-Location $Path diff --git a/deps.windows/60-ntv2.ps1 b/deps.windows/60-ntv2.ps1 index 83909f702..80ef80cd1 100644 --- a/deps.windows/60-ntv2.ps1 +++ b/deps.windows/60-ntv2.ps1 @@ -7,6 +7,11 @@ param( ) function Setup { + if (${Target} -eq "arm64") { + Log-Information "Skipping Setup ${Name} for Windows ARM64" + return + } + Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath $Path } @@ -20,6 +25,11 @@ function Clean { } function Configure { + if (${Target} -eq "arm64") { + Log-Information "Skipping Configure ${Name} for Windows ARM64" + return + } + Log-Information "Configure (${Target})" Set-Location $Path @@ -43,6 +53,11 @@ function Configure { } function Build { + if (${Target} -eq "arm64") { + Log-Information "Skipping Build ${Name} for Windows ARM64" + return + } + Log-Information "Build (${Target})" Set-Location $Path @@ -59,6 +74,11 @@ function Build { } function Install { + if (${Target} -eq "arm64") { + Log-Information "Skipping Install ${Name} for Windows ARM64" + return + } + Log-Information "Install (${Target})" Set-Location $Path @@ -75,6 +95,11 @@ function Install { } function Fixup { + if (${Target} -eq "arm64") { + Log-Information "Skipping Fixup ${Name} for Windows ARM64" + return + } + Log-Information "Fixup (${Target})" Set-Location $Path diff --git a/deps.windows/60-python.ps1 b/deps.windows/60-python.ps1 index 086612d0a..43bc2743e 100644 --- a/deps.windows/60-python.ps1 +++ b/deps.windows/60-python.ps1 @@ -9,6 +9,8 @@ param( } ) +# TODO: download ARM64 version of python instead of using pyenv + function Enable-PyEnv { $Env:PYENV = "$(Get-Location | Convert-Path)\pyenv-win" $Env:PYENV_ROOT = $Env:PYENV @@ -37,6 +39,11 @@ function Disable-PyEnv { } function Setup { + if (${Target} -eq "arm64") { + Log-Information "Skipping Setup ${Name} for Windows ARM64" + return + } + Setup-Dependency -Uri $Uri -Hash $Hash -DestinationPath $Path } diff --git a/utils.pwsh/Invoke-DevShell.ps1 b/utils.pwsh/Invoke-DevShell.ps1 index c51f8820c..8f015ed95 100644 --- a/utils.pwsh/Invoke-DevShell.ps1 +++ b/utils.pwsh/Invoke-DevShell.ps1 @@ -20,7 +20,7 @@ function Invoke-DevShell { [Parameter(Mandatory)] [string] $BuildCommand, [Parameter(Mandatory)] - [ValidateSet('x86', 'x64')] + [ValidateSet('x86', 'x64', 'arm64')] [string] $Target, [string] $HostArchitecture = ( 'x86', 'x64' )[ [System.Environment]::Is64BitOperatingSystem ] ) diff --git a/utils.pwsh/Setup-Target.ps1 b/utils.pwsh/Setup-Target.ps1 index db31c2ff3..72c78c2b9 100644 --- a/utils.pwsh/Setup-Target.ps1 +++ b/utils.pwsh/Setup-Target.ps1 @@ -3,16 +3,36 @@ function Setup-Target { . $PSScriptRoot/Logger.ps1 } - $Target64Bit = ( $script:Target -eq 'x64' ) - - $script:ConfigData = @{ - Arch = ('x86', 'x64')[$Target64Bit] - UnixArch = ('x86', 'x86_64')[$Target64Bit] - CmakeArch = ('Win32', 'x64')[$Target64Bit] - Bitness = ('32', '64')[$Target64Bit] - OutputPath = "${script:ProjectRoot}\windows\obs-${script:PackageName}-${script:Target}" + $script:ConfigData = switch ($script:Target) { + 'arm64' { + @{ + Arch = 'arm64' + UnixArch = 'aarch64' + CmakeArch = 'ARM64' + Bitness = '64' + OutputPath = "${script:ProjectRoot}\windows\obs-${script:PackageName}-${script:Target}" + } + } + 'x64' { + @{ + Arch = 'x64' + UnixArch = 'x86_64' + CmakeArch = 'x64' + Bitness = '64' + OutputPath = "${script:ProjectRoot}\windows\obs-${script:PackageName}-${script:Target}" + } + } + 'x86' { + @{ + Arch = 'x86' + UnixArch = 'x86' + CmakeArch = 'Win32' + Bitness = '32' + OutputPath = "${script:ProjectRoot}\windows\obs-${script:PackageName}-${script:Target}" + } + } } - + Log-Debug " Architecture : $($script:ConfigData.Arch) CMake arch : $($script:ConfigData.CmakeArch) @@ -83,9 +103,9 @@ function Find-VisualStudio { # 2. VS2022 Preview # 3. VS2019 Release [string[]]$SupportedVSVersions = - "VisualStudio.17.Release", - "VisualStudio.17.Preview", - "VisualStudio.16.Release" + "VisualStudio.17.Release", + "VisualStudio.17.Preview", + "VisualStudio.16.Release" $NumSupportedVSVersions = $SupportedVSVersions.length if ( $VisualStudioData.GetType() -eq [object[]] ) {