Skip to content

Commit d591643

Browse files
rbqvqricky8955555faratechReenigneArcher
authored
build(windows): add arm64 support (#3905)
Signed-off-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Signed-off-by: Coia Prant <coiaprant@gmail.com> Co-authored-by: Ricky8955555 <rkmiao@duck.com> Co-authored-by: Mike Fara <mjfara@gmail.com> Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
1 parent cdc4443 commit d591643

File tree

20 files changed

+242
-56
lines changed

20 files changed

+242
-56
lines changed

.github/workflows/ci-bundle.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
- name: Install npm dependencies
2424
run: npm install --ignore-scripts
2525

26+
- name: Debug install
27+
if: always()
28+
run: cat "${HOME}/.npm/_logs/*-debug-0.log" || true
29+
2630
- name: Build
2731
env:
2832
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/ci-windows.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ jobs:
2929
arch: x86_64
3030
msystem: ucrt64
3131
toolchain: ucrt-x86_64
32+
- name: Windows-ARM64
33+
os: windows-11-arm
34+
arch: aarch64
35+
msystem: clangarm64
36+
toolchain: clang-aarch64
3237
steps:
3338
- name: Checkout
3439
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -46,7 +51,9 @@ jobs:
4651
4752
- name: Update Windows dependencies
4853
env:
49-
MSYSTEM: ${{ matrix.msystem }}
54+
# MSYSTEM is a built-in environment variable of MSYS2.
55+
# Do not use this environment variable name.
56+
MATRIX_MSYSTEM: ${{ matrix.msystem }}
5057
TOOLCHAIN: ${{ matrix.toolchain }}
5158
shell: msys2 {0}
5259
run: |
@@ -62,17 +69,22 @@ jobs:
6269
"mingw-w64-${TOOLCHAIN}-curl-winssl"
6370
"mingw-w64-${TOOLCHAIN}-gcc"
6471
"mingw-w64-${TOOLCHAIN}-graphviz"
65-
"mingw-w64-${TOOLCHAIN}-MinHook"
6672
"mingw-w64-${TOOLCHAIN}-miniupnpc"
6773
"mingw-w64-${TOOLCHAIN}-nlohmann-json"
6874
"mingw-w64-${TOOLCHAIN}-nodejs"
69-
"mingw-w64-${TOOLCHAIN}-nsis"
7075
"mingw-w64-${TOOLCHAIN}-onevpl"
7176
"mingw-w64-${TOOLCHAIN}-openssl"
7277
"mingw-w64-${TOOLCHAIN}-opus"
7378
"mingw-w64-${TOOLCHAIN}-toolchain"
7479
)
7580
81+
if [[ "${MATRIX_MSYSTEM}" == "ucrt64" ]]; then
82+
dependencies+=(
83+
"mingw-w64-${TOOLCHAIN}-MinHook"
84+
"mingw-w64-${TOOLCHAIN}-nsis"
85+
)
86+
fi
87+
7688
# do not modify below this line
7789
7890
ignore_packages=()
@@ -83,7 +95,7 @@ jobs:
8395
tarball="${pkg}-${version}-any.pkg.tar.zst"
8496
8597
# download working version
86-
wget "https://repo.msys2.org/mingw/${MSYSTEM}/${tarball}"
98+
wget "https://repo.msys2.org/mingw/${MATRIX_MSYSTEM}/${tarball}"
8799
88100
tarballs="${tarballs} ${tarball}"
89101
done
@@ -189,6 +201,11 @@ jobs:
189201
mv ./cpack_artifacts/Sunshine.msi ../artifacts/Sunshine-${{ matrix.name }}-installer.msi
190202
mv ./cpack_artifacts/Sunshine.zip ../artifacts/Sunshine-${{ matrix.name }}-portable.zip
191203
204+
- name: Debug nsis
205+
if: always()
206+
shell: msys2 {0}
207+
run: cat ./build/cpack_artifacts/_CPack_Packages/win64/NSIS/NSISOutput.log || true
208+
192209
- name: Debug wix
193210
if: always()
194211
shell: msys2 {0}

cmake/compile_definitions/windows.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
99
# gcc complains about misleading indentation in some mingw includes
1010
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-misleading-indentation)
1111

12+
# Disable warnings for Windows ARM64
13+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
14+
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-dll-attribute-on-redeclaration) # Boost
15+
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-unknown-warning-option) # ViGEmClient
16+
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-unused-variable) # Boost
17+
endif()
18+
1219
# see gcc bug 98723
1320
add_definitions(-DUSE_BOOST_REGEX)
1421

cmake/dependencies/windows.cmake

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
# windows specific dependencies
22

3-
# Make sure MinHook is installed
4-
find_library(MINHOOK_LIBRARY libMinHook.a REQUIRED)
5-
find_path(MINHOOK_INCLUDE_DIR MinHook.h PATH_SUFFIXES include REQUIRED)
3+
# MinHook setup - use installed minhook for AMD64, otherwise download minhook-detours for ARM64
4+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
5+
# Make sure MinHook is installed for x86/x64
6+
find_library(MINHOOK_LIBRARY libMinHook.a REQUIRED)
7+
find_path(MINHOOK_INCLUDE_DIR MinHook.h PATH_SUFFIXES include REQUIRED)
68

7-
add_library(minhook::minhook STATIC IMPORTED)
8-
set_property(TARGET minhook::minhook PROPERTY IMPORTED_LOCATION ${MINHOOK_LIBRARY})
9-
target_include_directories(minhook::minhook INTERFACE ${MINHOOK_INCLUDE_DIR})
9+
add_library(minhook::minhook STATIC IMPORTED)
10+
set_property(TARGET minhook::minhook PROPERTY IMPORTED_LOCATION ${MINHOOK_LIBRARY})
11+
target_include_directories(minhook::minhook INTERFACE ${MINHOOK_INCLUDE_DIR})
12+
else()
13+
# Download pre-built minhook-detours for ARM64
14+
message(STATUS "Downloading minhook-detours pre-built binaries for ARM64")
15+
include(FetchContent)
16+
17+
FetchContent_Declare(
18+
minhook-detours
19+
URL https://github.com/m417z/minhook-detours/releases/download/v1.0.6/minhook-detours-1.0.6.zip
20+
URL_HASH SHA256=E719959D824511E27395A82AEDA994CAAD53A67EE5894BA5FC2F4BF1FA41E38E
21+
)
22+
FetchContent_MakeAvailable(minhook-detours)
23+
24+
# Create imported library for the pre-built DLL
25+
set(_MINHOOK_DLL
26+
"${minhook-detours_SOURCE_DIR}/Release/minhook-detours.ARM64.Release.dll"
27+
CACHE INTERNAL "Path to minhook-detours DLL")
28+
add_library(minhook::minhook SHARED IMPORTED GLOBAL)
29+
set_property(TARGET minhook::minhook PROPERTY IMPORTED_LOCATION "${_MINHOOK_DLL}")
30+
set_property(TARGET minhook::minhook PROPERTY IMPORTED_IMPLIB
31+
"${minhook-detours_SOURCE_DIR}/Release/minhook-detours.ARM64.Release.lib")
32+
set_target_properties(minhook::minhook PROPERTIES
33+
INTERFACE_INCLUDE_DIRECTORIES "${minhook-detours_SOURCE_DIR}/src"
34+
)
35+
endif()

cmake/packaging/windows.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ install(TARGETS sunshine RUNTIME DESTINATION "." COMPONENT application)
44
# Hardening: include zlib1.dll (loaded via LoadLibrary() in openssl's libcrypto.a)
55
install(FILES "${ZLIB}" DESTINATION "." COMPONENT application)
66

7+
# ARM64: include minhook-detours DLL (shared library for ARM64)
8+
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64" AND DEFINED _MINHOOK_DLL)
9+
install(FILES "${_MINHOOK_DLL}" DESTINATION "." COMPONENT application)
10+
endif()
11+
712
# ViGEmBus installer
813
set(VIGEMBUS_INSTALLER "${CMAKE_BINARY_DIR}/scripts/vigembus_installer.exe")
914
set(VIGEMBUS_DOWNLOAD_URL_1 "https://github.com/nefarius/ViGEmBus/releases/download")

cmake/packaging/windows_nsis.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33

44
set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT__DIR}\\\\${PROJECT_EXE}")
55

6+
# Enable detailed logging only on AMD64
7+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
8+
set(NSIS_LOGSET_COMMAND "LogSet on")
9+
else()
10+
set(NSIS_LOGSET_COMMAND "")
11+
endif()
12+
613
# Extra install commands
714
# Runs the main setup script which handles all installation tasks
815
SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
916
"${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
10-
; Enable detailed logging
11-
LogSet on
17+
${NSIS_LOGSET_COMMAND}
1218
IfSilent +3 0
1319
nsExec::ExecToLog \
1420
'powershell -ExecutionPolicy Bypass \
@@ -24,8 +30,7 @@ SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
2430
# Runs the main setup script which handles all uninstallation tasks
2531
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
2632
"${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
27-
; Enable detailed logging
28-
LogSet on
33+
${NSIS_LOGSET_COMMAND}
2934
nsExec::ExecToLog \
3035
'powershell -ExecutionPolicy Bypass \
3136
-File \\\"$INSTDIR\\\\scripts\\\\sunshine-setup.ps1\\\" -Action uninstall'

docs/building.md

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,53 @@ sudo port install "${dependencies[@]}"
126126
```
127127

128128
#### Windows
129-
First you need to install [MSYS2](https://www.msys2.org), then startup "MSYS2 UCRT64" and execute the following
130-
commands.
129+
130+
> [!WARNING]
131+
> Cross-compilation is not supported on Windows. You must build on the target architecture.
132+
133+
First, you need to install [MSYS2](https://www.msys2.org).
134+
135+
For AMD64 startup "MSYS2 UCRT64" (or for ARM64 startup "MSYS2 CLANGARM64") then execute the following commands.
131136

132137
##### Update all packages
133138
```bash
134139
pacman -Syu
135140
```
136141

142+
##### Set toolchain variable
143+
For UCRT64:
144+
```bash
145+
export TOOLCHAIN="ucrt-x86_64"
146+
```
147+
148+
For CLANGARM64:
149+
```bash
150+
export TOOLCHAIN="clang-aarch64"
151+
```
152+
137153
##### Install dependencies
138154
```bash
139155
dependencies=(
140156
"git"
141-
"mingw-w64-ucrt-x86_64-boost" # Optional
142-
"mingw-w64-ucrt-x86_64-cmake"
143-
"mingw-w64-ucrt-x86_64-cppwinrt"
144-
"mingw-w64-ucrt-x86_64-curl-winssl"
145-
"mingw-w64-ucrt-x86_64-doxygen" # Optional, for docs... better to install official Doxygen
146-
"mingw-w64-ucrt-x86_64-graphviz" # Optional, for docs
147-
"mingw-w64-ucrt-x86_64-MinHook"
148-
"mingw-w64-ucrt-x86_64-miniupnpc"
149-
"mingw-w64-ucrt-x86_64-nodejs"
150-
"mingw-w64-ucrt-x86_64-nsis"
151-
"mingw-w64-ucrt-x86_64-onevpl"
152-
"mingw-w64-ucrt-x86_64-openssl"
153-
"mingw-w64-ucrt-x86_64-opus"
154-
"mingw-w64-ucrt-x86_64-toolchain"
157+
"mingw-w64-${TOOLCHAIN}-boost" # Optional
158+
"mingw-w64-${TOOLCHAIN}-cmake"
159+
"mingw-w64-${TOOLCHAIN}-cppwinrt"
160+
"mingw-w64-${TOOLCHAIN}-curl-winssl"
161+
"mingw-w64-${TOOLCHAIN}-doxygen" # Optional, for docs... better to install official Doxygen
162+
"mingw-w64-${TOOLCHAIN}-graphviz" # Optional, for docs
163+
"mingw-w64-${TOOLCHAIN}-miniupnpc"
164+
"mingw-w64-${TOOLCHAIN}-nodejs"
165+
"mingw-w64-${TOOLCHAIN}-onevpl"
166+
"mingw-w64-${TOOLCHAIN}-openssl"
167+
"mingw-w64-${TOOLCHAIN}-opus"
168+
"mingw-w64-${TOOLCHAIN}-toolchain"
155169
)
170+
if [[ "${MSYSTEM}" == "UCRT64" ]]; then
171+
dependencies+=(
172+
"mingw-w64-${TOOLCHAIN}-MinHook"
173+
"mingw-w64-${TOOLCHAIN}-nsis"
174+
)
175+
fi
156176
pacman -S "${dependencies[@]}"
157177
```
158178

docs/getting_started.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,21 +329,30 @@ brew uninstall sunshine
329329
330330
### Windows
331331

332+
> [!NOTE]
333+
> Sunshine supports ARM64 on Windows; however, this should be considered experimental. This version does not properly
334+
> support GPU scheduling and any hardware acceleration.
335+
332336
#### Installer (recommended)
333337

334338
> [!CAUTION]
335339
> The msi installer is preferred moving forward. Before using a different type of installer, you should manually
336340
> uninstall the previous installation.
337341
338-
1. Download and install
339-
[Sunshine-Windows-AMD64-installer.msi](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-installer.msi)
340-
[Sunshine-Windows-AMD64-installer.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-installer.exe)
342+
1. Download and install based on your architecture:
343+
344+
| Architecture | Installer |
345+
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
346+
| AMD64/x64 (Intel/AMD) | [Sunshine-Windows-AMD64-installer.msi](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-installer.msi) |
347+
| AMD64/x64 (Intel/AMD) | [Sunshine-Windows-AMD64-installer.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-installer.exe) |
348+
| ARM64 | [Sunshine-Windows-ARM64-installer.msi](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-ARM64-installer.msi) |
349+
| ARM64 | [Sunshine-Windows-ARM64-installer.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-ARM64-installer.exe) |
341350

342351
> [!TIP]
343352
> Installer logs can be found in the following locations.<br>
344353
> | File | log paths |
345354
> | ---- | --------- |
346-
> | .exe | `%%PROGRAMFILES%/Sunshine/install.log`<br>`%%TEMP%/Sunshine/logs/install/` |
355+
> | .exe | `%%PROGRAMFILES%/Sunshine/install.log` (AMD64 only)<br>`%%TEMP%/Sunshine/logs/install/` |
347356
> | .msi | `%%TEMP%/Sunshine/logs/install/` |
348357
349358
> [!CAUTION]
@@ -359,8 +368,13 @@ overflow menu. Different versions of Windows may provide slightly different step
359368
> By using this package instead of the installer, performance will be reduced. This package is not
360369
> recommended for most users. No support will be provided!
361370
362-
1. Download and extract
363-
[Sunshine-Windows-AMD64-portable.zip](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-portable.zip)
371+
1. Download and extract based on your architecture:
372+
373+
| Architecture | Installer |
374+
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
375+
| AMD64/x64 (Intel/AMD) | [Sunshine-Windows-AMD64-portable.zip](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-portable.zip) |
376+
| ARM64 | [Sunshine-Windows-ARM64-portable.zip](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-ARM64-portable.zip) |
377+
364378
2. Open command prompt as administrator
365379
3. Firewall rules
366380

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
"@vitejs/plugin-vue": "6.0.1",
2323
"serve": "14.2.5",
2424
"vite": "6.3.6",
25-
"vite-plugin-ejs": "1.7.0"
25+
"vite-plugin-ejs": "1.7.0",
26+
"@rollup/wasm-node": "4.57.1"
27+
},
28+
"overrides": {
29+
"rollup": "npm:@rollup/wasm-node@4.57.1"
2630
}
2731
}

scripts/linux_build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ elif grep -q "Debian GNU/Linux 12 (bookworm)" /etc/os-release; then
695695
cuda_version="12.9.1"
696696
cuda_build="575.57.08"
697697
gcc_version="13"
698-
nvm_node=0
698+
nvm_node=1
699699
elif grep -q "Debian GNU/Linux 13 (trixie)" /etc/os-release; then
700700
distro="debian"
701701
version="13"
@@ -704,7 +704,7 @@ elif grep -q "Debian GNU/Linux 13 (trixie)" /etc/os-release; then
704704
cuda_version="12.9.1"
705705
cuda_build="575.57.08"
706706
gcc_version="14"
707-
nvm_node=0
707+
nvm_node=1
708708
elif grep -q "PLATFORM_ID=\"platform:f41\"" /etc/os-release; then
709709
distro="fedora"
710710
version="41"

0 commit comments

Comments
 (0)