Skip to content

Commit 2e4aa54

Browse files
committed
draft windows arm support
1 parent 46bf6c6 commit 2e4aa54

8 files changed

Lines changed: 126 additions & 20 deletions

File tree

.github/actions/run-tests/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ runs:
3838
if: ${{ runner.os == 'Windows' }}
3939
shell: pwsh
4040
run: |
41-
${{ inputs.workingDirectory }}/build_x64/tests/${{ inputs.config }}/advanced-scene-switcher-tests.exe
41+
${{ inputs.workingDirectory }}/build_${{ inputs.target }}/tests/${{ inputs.config }}/advanced-scene-switcher-tests.exe

.github/scripts/Build-Deps-Windows.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
param(
33
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
44
[string] $Configuration = 'RelWithDebInfo',
5-
[ValidateSet('x86', 'x64')]
5+
[ValidateSet('x86', 'x64', 'arm64')]
66
[string] $Target,
77
[ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
88
[string] $CMakeGenerator,
@@ -209,13 +209,14 @@ function Build {
209209
$msbuildExe = vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | select-object -first 1
210210

211211
if ($msbuildExe) {
212+
$LibusbPlatform = if ($Target -eq 'arm64') { 'arm64' } else { 'x64' }
212213
$env:CL="/wd5287"
213-
Invoke-External $msbuildExe "${LibusbPath}/msvc/libusb.sln" /property:Configuration=Release /property:Platform=x64
214+
Invoke-External $msbuildExe "${LibusbPath}/msvc/libusb.sln" /property:Configuration=Release /property:Platform=$LibusbPlatform
214215
Remove-Item Env:CL
215216

216-
$libusbBuildResultDirectory = "${LibusbPath}/build/v143/x64/Release"
217+
$libusbBuildResultDirectory = "${LibusbPath}/build/v143/${LibusbPlatform}/Release"
217218
if (-not (Test-Path -Path $libusbBuildResultDirectory)) {
218-
$libusbBuildResultDirectory = "${LibusbPath}/x64/Release/dll"
219+
$libusbBuildResultDirectory = "${LibusbPath}/${LibusbPlatform}/Release/dll"
219220
}
220221
Copy-Item -Path "${libusbBuildResultDirectory}/*" -Destination ${ADVSSDepPath} -Recurse -Force
221222
} else {
@@ -245,9 +246,10 @@ function Build {
245246

246247
if ($opensslDir) {
247248
Write-Host "Detected OpenSSL at: $opensslDir"
249+
$OpenSSLArch = if ($Target -eq 'arm64') { 'arm64' } else { 'x64' }
248250
$MqttCmakeArgs += "-DOPENSSL_ROOT_DIR=$opensslDir"
249-
$MqttCmakeArgs += "-DOPENSSL_CRYPTO_LIBRARY=$opensslDir\lib\VC\x64\MD\libcrypto.lib"
250-
$MqttCmakeArgs += "-DOPENSSL_SSL_LIBRARY=$opensslDir\lib\VC\x64\MD\libssl.lib"
251+
$MqttCmakeArgs += "-DOPENSSL_CRYPTO_LIBRARY=$opensslDir\lib\VC\$OpenSSLArch\MD\libcrypto.lib"
252+
$MqttCmakeArgs += "-DOPENSSL_SSL_LIBRARY=$opensslDir\lib\VC\$OpenSSLArch\MD\libssl.lib"
251253
} else {
252254
Write-Warning "OpenSSL not found - maybe cmake will find it ..."
253255
}

.github/scripts/Build-Windows.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[CmdletBinding()]
22
param(
3-
[ValidateSet('x64')]
3+
[ValidateSet('x64', 'arm64')]
44
[string] $Target = 'x64',
55
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
66
[string] $Configuration = 'RelWithDebInfo',

.github/scripts/Package-Windows.ps1

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[CmdletBinding()]
22
param(
3-
[ValidateSet('x64')]
3+
[ValidateSet('x64', 'arm64')]
44
[string] $Target = 'x64',
55
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
66
[string] $Configuration = 'RelWithDebInfo',
@@ -69,7 +69,8 @@ function Package {
6969
Remove-Item @RemoveArgs
7070

7171
$ReleasePath = "${ProjectRoot}/release/${Configuration}"
72-
$NewBinPath = "${ReleasePath}/${ProductName}/bin/64bit"
72+
$BinDirName = if ($Target -eq 'arm64') { 'arm64' } else { '64bit' }
73+
$NewBinPath = "${ReleasePath}/${ProductName}/bin/${BinDirName}"
7374
$NewDataPath = "${ReleasePath}/${ProductName}/data"
7475
$CIWindowsDir = "${ProjectRoot}/build-aux/CI/windows"
7576

@@ -80,7 +81,7 @@ function Package {
8081
New-Item -ItemType Directory -Force -Path $RecStaging | Out-Null
8182
Copy-Item -Path "${CIWindowsDir}/README.txt" -Destination "${RecStaging}/README.txt"
8283
if ( Test-Path -Path $NewBinPath ) {
83-
$RecBinPath = "${RecStaging}/${ProductName}/bin/64bit"
84+
$RecBinPath = "${RecStaging}/${ProductName}/bin/${BinDirName}"
8485
New-Item -ItemType Directory -Force -Path $RecBinPath | Out-Null
8586
Copy-Item -Path "${NewBinPath}/*" -Destination $RecBinPath -Recurse -Force
8687
}
@@ -102,7 +103,7 @@ function Package {
102103
New-Item -ItemType Directory -Force -Path $PortableStaging | Out-Null
103104
Copy-Item -Path "${CIWindowsDir}/README-portable.txt" -Destination "${PortableStaging}/README.txt"
104105
if ( Test-Path -Path $NewBinPath ) {
105-
$PortableBinPath = "${PortableStaging}/obs-plugins/64bit"
106+
$PortableBinPath = "${PortableStaging}/obs-plugins/${BinDirName}"
106107
New-Item -ItemType Directory -Force -Path $PortableBinPath | Out-Null
107108
Copy-Item -Path "${NewBinPath}/*" -Destination $PortableBinPath -Recurse -Force
108109
}
@@ -136,10 +137,10 @@ function Package {
136137
Copy-Item -Path "${Configuration}/*" -Destination $PkgRec -Recurse -Force
137138

138139
# Legacy layout (for OBS installation directory)
139-
if ( Test-Path "${Configuration}/${ProductName}/bin/64bit" ) {
140-
$PkgLegBin = "Package/portable/obs-plugins/64bit"
140+
if ( Test-Path "${Configuration}/${ProductName}/bin/${BinDirName}" ) {
141+
$PkgLegBin = "Package/portable/obs-plugins/${BinDirName}"
141142
New-Item -ItemType Directory -Force -Path $PkgLegBin | Out-Null
142-
Copy-Item -Path "${Configuration}/${ProductName}/bin/64bit/*" -Destination $PkgLegBin -Recurse -Force
143+
Copy-Item -Path "${Configuration}/${ProductName}/bin/${BinDirName}/*" -Destination $PkgLegBin -Recurse -Force
143144
}
144145
if ( Test-Path "${Configuration}/${ProductName}/data" ) {
145146
$PkgLegData = "Package/portable/data/obs-plugins/${ProductName}"

.github/workflows/build-project.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,57 @@ jobs:
311311
with:
312312
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ needs.check-event.outputs.commitHash }}
313313
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-windows-x64*.*
314+
315+
windows-arm64-build:
316+
name: Build for Windows ARM64 🪟
317+
runs-on: windows-2022
318+
needs: check-event
319+
defaults:
320+
run:
321+
shell: pwsh
322+
steps:
323+
- uses: actions/checkout@v6
324+
with:
325+
submodules: recursive
326+
fetch-depth: 0
327+
328+
- name: Set Up Environment 🔧
329+
id: setup
330+
run: |
331+
# Set Up Environment 🔧
332+
if ( $Env:RUNNER_DEBUG -ne $null ) {
333+
Set-PSDebug -Trace 1
334+
}
335+
336+
$BuildSpec = Get-Content -Path buildspec.json -Raw | ConvertFrom-Json
337+
$ProductName = $BuildSpec.name
338+
$GitOutput = git describe --tags
339+
340+
"pluginName=${ProductName}" >> $env:GITHUB_OUTPUT
341+
"pluginVersion=${GitOutput}" >> $env:GITHUB_OUTPUT
342+
343+
- name: Build Dependencies 🏗️
344+
uses: ./.github/actions/build-dependencies
345+
with:
346+
workingDirectory: ${{ github.workspace }}/plugin
347+
target: arm64
348+
config: ${{ needs.check-event.outputs.config }}
349+
350+
- name: Build Plugin 🧱
351+
uses: ./.github/actions/build-plugin
352+
with:
353+
target: arm64
354+
config: ${{ needs.check-event.outputs.config }}
355+
356+
- name: Package Plugin 📀
357+
uses: ./.github/actions/package-plugin
358+
with:
359+
target: arm64
360+
config: ${{ needs.check-event.outputs.config }}
361+
package: ${{ fromJSON(needs.check-event.outputs.package) }}
362+
363+
- name: Upload Artifacts 📡
364+
uses: actions/upload-artifact@v7
365+
with:
366+
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-arm64-${{ needs.check-event.outputs.commitHash }}
367+
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-*-windows-arm64*.*

CMakePresets.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,35 @@
7474
"ADVSS_ENABLE_TESTS": true
7575
}
7676
},
77+
{
78+
"name": "windows-arm64",
79+
"displayName": "Windows ARM64",
80+
"description": "Build for Windows ARM64",
81+
"inherits": ["template"],
82+
"binaryDir": "${sourceDir}/build_arm64",
83+
"condition": {
84+
"type": "equals",
85+
"lhs": "${hostSystemName}",
86+
"rhs": "Windows"
87+
},
88+
"generator": "Visual Studio 17 2022",
89+
"architecture": "ARM64",
90+
"warnings": {"dev": true, "deprecated": true},
91+
"cacheVariables": {
92+
"QT_VERSION": "6",
93+
"CMAKE_SYSTEM_VERSION": "10.0.18363.657"
94+
}
95+
},
96+
{
97+
"name": "windows-ci-arm64",
98+
"inherits": ["windows-arm64"],
99+
"displayName": "Windows ARM64 CI build",
100+
"description": "Build for Windows ARM64 on CI",
101+
"cacheVariables": {
102+
"CMAKE_COMPILE_WARNING_AS_ERROR": true,
103+
"ADVSS_ENABLE_TESTS": true
104+
}
105+
},
77106
{
78107
"name": "linux-x86_64",
79108
"displayName": "Linux x86_64",
@@ -162,6 +191,20 @@
162191
"description": "Windows CI build for x64 (RelWithDebInfo configuration)",
163192
"configuration": "RelWithDebInfo"
164193
},
194+
{
195+
"name": "windows-arm64",
196+
"configurePreset": "windows-arm64",
197+
"displayName": "Windows ARM64",
198+
"description": "Windows build for ARM64",
199+
"configuration": "RelWithDebInfo"
200+
},
201+
{
202+
"name": "windows-ci-arm64",
203+
"configurePreset": "windows-ci-arm64",
204+
"displayName": "Windows ARM64 CI",
205+
"description": "Windows CI build for ARM64 (RelWithDebInfo configuration)",
206+
"configuration": "RelWithDebInfo"
207+
},
165208
{
166209
"name": "linux-x86_64",
167210
"configurePreset": "linux-x86_64",

buildspec.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"label": "OBS sources",
77
"hashes": {
88
"macos": "39751f067bacc13d44b116c5138491b5f1391f91516d3d590d874edd21292291",
9-
"windows-x64": "2c8427c10b55ac6d68008df2e9a3e82f4647aaad18f105e30d4713c2de678ccf"
9+
"windows-x64": "2c8427c10b55ac6d68008df2e9a3e82f4647aaad18f105e30d4713c2de678ccf",
10+
"windows-arm64": "2c8427c10b55ac6d68008df2e9a3e82f4647aaad18f105e30d4713c2de678ccf"
1011
}
1112
},
1213
"prebuilt": {
@@ -15,7 +16,8 @@
1516
"label": "Pre-Built obs-deps",
1617
"hashes": {
1718
"macos": "495687e63383d1a287684b6e2e9bfe246bb8f156fe265926afb1a325af1edd2a",
18-
"windows-x64": "c8c642c1070dc31ce9a0f1e4cef5bb992f4bff4882255788b5da12129e85caa7"
19+
"windows-x64": "c8c642c1070dc31ce9a0f1e4cef5bb992f4bff4882255788b5da12129e85caa7",
20+
"windows-arm64": "f581cc61e8f734a8b12d485fc8662a408ca59d222814e4b37bce115bd442fb04"
1921
}
2022
},
2123
"qt6": {
@@ -24,10 +26,12 @@
2426
"label": "Pre-Built Qt6",
2527
"hashes": {
2628
"macos": "d3f5f04b6ea486e032530bdf0187cbda9a54e0a49621a4c8ba984c5023998867",
27-
"windows-x64": "0e76bf0555dd5382838850b748d3dcfab44a1e1058441309ab54e1a65b156d0a"
29+
"windows-x64": "0e76bf0555dd5382838850b748d3dcfab44a1e1058441309ab54e1a65b156d0a",
30+
"windows-arm64": "7aab240504931f32ea8e8d208a912a0d6ddbd78c16858f2e559c7c9b29ab9326"
2831
},
2932
"debugSymbols": {
30-
"windows-x64": "11b7be92cf66a273299b8f3515c07a5cfb61614b59a4e67f7fc5ecba5e2bdf21"
33+
"windows-x64": "11b7be92cf66a273299b8f3515c07a5cfb61614b59a4e67f7fc5ecba5e2bdf21",
34+
"windows-arm64": "884ae08291b5c87d83a7b0004ea8db356530c1f4ff9bdc814b5d599a8d28a152"
3135
}
3236
}
3337
},

plugins/openvr/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ endif()
2828

2929
if(EXISTS "${OpenVR_DIR}/CMakeLists.txt")
3030
set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P})
31-
if((NOT APPLE) AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
31+
if(WIN32 AND CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|arm64|aarch64")
32+
set(PROCESSOR_ARCH "arm64")
33+
elseif((NOT APPLE) AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
3234
set(PROCESSOR_ARCH "64")
3335
else()
3436
set(PROCESSOR_ARCH "32")

0 commit comments

Comments
 (0)