Skip to content

Commit 632d48d

Browse files
build(windows): add arm64 build
1 parent 0bdc918 commit 632d48d

File tree

7 files changed

+147
-73
lines changed

7 files changed

+147
-73
lines changed

.github/workflows/CI.yml

Lines changed: 75 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,26 @@ jobs:
740740
validate: false
741741

742742
build_win:
743-
name: Windows
743+
name: ${{ matrix.name }}
744744
needs: setup_release
745-
runs-on: windows-2019
745+
runs-on: ${{ matrix.os }}
746+
defaults:
747+
run:
748+
shell: msys2 {0}
749+
strategy:
750+
fail-fast: false
751+
matrix:
752+
include:
753+
- name: Windows-AMD64
754+
os: windows-2019
755+
arch: x86_64
756+
msystem: ucrt64
757+
toolchain: ucrt-x86_64
758+
- name: Windows-ARM64
759+
os: windows-11-arm
760+
arch: aarch64
761+
msystem: clangarm64
762+
toolchain: clang-aarch64
746763
steps:
747764
- name: Checkout
748765
uses: actions/checkout@v4
@@ -752,6 +769,7 @@ jobs:
752769
- name: Prepare tests
753770
id: prepare-tests
754771
if: false # todo: DirectX11 is not available, so even software encoder fails
772+
shell: pwsh
755773
run: |
756774
# function to download and extract a zip file
757775
function DownloadAndExtract {
@@ -854,63 +872,80 @@ jobs:
854872
Get-Content -Path monitor_list.txt
855873
856874
- name: Setup Dependencies Windows
857-
# if a dependency needs to be pinned, see https://github.com/LizardByte/build-deps/pull/186
858875
uses: msys2/setup-msys2@v2
859876
with:
860-
msystem: ucrt64
877+
msystem: ${{ matrix.msystem }}
861878
update: true
862-
install: >-
863-
wget
864879

865880
- name: Update Windows dependencies
866881
env:
867-
gcc_version: "14.2.0-3"
868-
shell: msys2 {0}
882+
MSYSTEM: ${{ matrix.msystem }}
883+
TOOLCHAIN: ${{ matrix.toolchain }}
869884
run: |
870-
broken_deps=(
871-
"mingw-w64-ucrt-x86_64-gcc"
872-
"mingw-w64-ucrt-x86_64-gcc-libs"
885+
# variables
886+
declare -A pinned_deps
887+
if [[ ${MSYSTEM} == "ucrt64" ]]; then
888+
pinned_deps["mingw-w64-${TOOLCHAIN}-gcc"]="14.2.0-3"
889+
pinned_deps["mingw-w64-${TOOLCHAIN}-gcc-libs"]="14.2.0-3"
890+
fi
891+
892+
dependencies=(
893+
"git"
894+
"mingw-w64-${TOOLCHAIN}-cmake"
895+
"mingw-w64-${TOOLCHAIN}-cppwinrt"
896+
"mingw-w64-${TOOLCHAIN}-curl-winssl"
897+
"mingw-w64-${TOOLCHAIN}-graphviz"
898+
"mingw-w64-${TOOLCHAIN}-miniupnpc"
899+
"mingw-w64-${TOOLCHAIN}-nlohmann-json"
900+
"mingw-w64-${TOOLCHAIN}-nodejs"
901+
"mingw-w64-${TOOLCHAIN}-onevpl"
902+
"mingw-w64-${TOOLCHAIN}-openssl"
903+
"mingw-w64-${TOOLCHAIN}-opus"
904+
"mingw-w64-${TOOLCHAIN}-toolchain"
873905
)
874906
907+
if [[ ${MSYSTEM} == "ucrt64" ]]; then
908+
dependencies+=(
909+
"mingw-w64-${TOOLCHAIN}-MinHook"
910+
"mingw-w64-${TOOLCHAIN}-nsis" # TODO: how to create an arm64 installer?
911+
)
912+
fi
913+
914+
# do not modify below this line
915+
916+
ignore_packages=()
875917
tarballs=""
876-
for dep in "${broken_deps[@]}"; do
877-
tarball="${dep}-${gcc_version}-any.pkg.tar.zst"
918+
for pkg in "${!pinned_deps[@]}"; do
919+
ignore_packages+=("${pkg}")
920+
version="${pinned_deps[$pkg]}"
921+
tarball="${pkg}-${version}-any.pkg.tar.zst"
878922
879923
# download and install working version
880-
wget https://repo.msys2.org/mingw/ucrt64/${tarball}
924+
wget "https://repo.msys2.org/mingw/${MSYSTEM}/${tarball}"
881925
882926
tarballs="${tarballs} ${tarball}"
883927
done
884928
885-
# install broken dependencies
929+
# Create the ignore string for pacman
930+
ignore_list=$(IFS=,; echo "${ignore_packages[*]}")
931+
932+
# install pinned dependencies
886933
if [ -n "$tarballs" ]; then
887934
pacman -U --noconfirm ${tarballs}
888935
fi
889936
890-
# install dependencies
891-
dependencies=(
892-
"git"
893-
"mingw-w64-ucrt-x86_64-cmake"
894-
"mingw-w64-ucrt-x86_64-cppwinrt"
895-
"mingw-w64-ucrt-x86_64-curl-winssl"
896-
"mingw-w64-ucrt-x86_64-graphviz"
897-
"mingw-w64-ucrt-x86_64-MinHook"
898-
"mingw-w64-ucrt-x86_64-miniupnpc"
899-
"mingw-w64-ucrt-x86_64-nlohmann-json"
900-
"mingw-w64-ucrt-x86_64-nodejs"
901-
"mingw-w64-ucrt-x86_64-nsis"
902-
"mingw-w64-ucrt-x86_64-onevpl"
903-
"mingw-w64-ucrt-x86_64-openssl"
904-
"mingw-w64-ucrt-x86_64-opus"
905-
"mingw-w64-ucrt-x86_64-toolchain"
906-
)
907-
908-
pacman -Syu --noconfirm --ignore="$(IFS=,; echo "${broken_deps[*]}")" "${dependencies[@]}"
937+
# Only add --ignore if we have packages to ignore
938+
if [ -n "$ignore_list" ]; then
939+
pacman -Syu --noconfirm --ignore="${ignore_list}" "${dependencies[@]}"
940+
else
941+
pacman -Syu --noconfirm "${dependencies[@]}"
942+
fi
909943
910944
- name: Install Doxygen
911945
# GCC compiled doxygen has issues when running graphviz
912946
env:
913947
DOXYGEN_VERSION: "1.11.0"
948+
shell: pwsh
914949
run: |
915950
# Set version variables
916951
$doxy_ver = $env:DOXYGEN_VERSION
@@ -940,7 +975,6 @@ jobs:
940975

941976
- name: Python Path
942977
id: python-path
943-
shell: msys2 {0}
944978
run: |
945979
# replace backslashes with double backslashes
946980
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g')
@@ -950,7 +984,6 @@ jobs:
950984
echo "python-path=${python_path}" >> $GITHUB_OUTPUT
951985
952986
- name: Build Windows
953-
shell: msys2 {0}
954987
env:
955988
BRANCH: ${{ github.head_ref || github.ref_name }}
956989
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
@@ -971,7 +1004,6 @@ jobs:
9711004
ninja -C build
9721005
9731006
- name: Package Windows
974-
shell: msys2 {0}
9751007
run: |
9761008
mkdir -p artifacts
9771009
cd build
@@ -981,12 +1013,11 @@ jobs:
9811013
cpack -G ZIP
9821014
9831015
# move
984-
mv ./cpack_artifacts/Sunshine.exe ../artifacts/sunshine-windows-installer.exe
985-
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-windows-portable.zip
1016+
mv ./cpack_artifacts/Sunshine.exe ../artifacts/Sunshine-${{ matrix.os }}-installer.exe
1017+
mv ./cpack_artifacts/Sunshine.zip ../artifacts/Sunshine-${{ matrix.os }}-portable.zip
9861018
9871019
- name: Run tests
9881020
id: test
989-
shell: msys2 {0}
9901021
working-directory: build/tests
9911022
run: |
9921023
./test_sunshine.exe --gtest_color=yes --gtest_output=xml:test_results.xml
@@ -995,7 +1026,6 @@ jobs:
9951026
id: test_report
9961027
# any except canceled or skipped
9971028
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
998-
shell: msys2 {0}
9991029
working-directory: build
10001030
run: |
10011031
${{ steps.python-path.outputs.python-path }} -m pip install gcovr
@@ -1018,7 +1048,7 @@ jobs:
10181048
disable_search: true
10191049
fail_ci_if_error: true
10201050
files: ./build/tests/test_results.xml
1021-
flags: ${{ runner.os }}
1051+
flags: ${{ matrix.name }}
10221052
handle_no_reports_found: true
10231053
token: ${{ secrets.CODECOV_TOKEN }}
10241054
verbose: true
@@ -1034,11 +1064,12 @@ jobs:
10341064
disable_search: true
10351065
fail_ci_if_error: true
10361066
files: ./build/coverage.xml
1037-
flags: ${{ runner.os }}
1067+
flags: ${{ matrix.name }}
10381068
token: ${{ secrets.CODECOV_TOKEN }}
10391069
verbose: true
10401070

10411071
- name: Package Windows Debug Info
1072+
shell: pwsh
10421073
working-directory: build
10431074
run: |
10441075
# use .dbg file extension for binaries to avoid confusion with real packages
@@ -1049,7 +1080,7 @@ jobs:
10491080
7z -r `
10501081
"-xr!CMakeFiles" `
10511082
"-xr!cpack_artifacts" `
1052-
a "../artifacts/sunshine-win32-debuginfo.7z" "*.dbg"
1083+
a "../artifacts/${{ matrix.name }}-debuginfo.7z" "*.dbg"
10531084
10541085
- name: Upload Artifacts
10551086
uses: actions/upload-artifact@v4

cmake/compile_definitions/windows.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ list(PREPEND PLATFORM_LIBRARIES
7575
libssp.a
7676
libstdc++.a
7777
libwinpthread.a
78-
minhook::minhook
7978
ntdll
8079
setupapi
8180
shlwapi
@@ -85,6 +84,12 @@ list(PREPEND PLATFORM_LIBRARIES
8584
wsock32
8685
)
8786

87+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
88+
list(APPEND PLATFORM_LIBRARIES
89+
minhook::minhook
90+
)
91+
endif()
92+
8893
if(SUNSHINE_ENABLE_TRAY)
8994
list(APPEND PLATFORM_TARGET_FILES
9095
"${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_windows.c")

cmake/dependencies/windows.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
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+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
4+
# Make sure MinHook is installed
5+
find_library(MINHOOK_LIBRARY libMinHook.a REQUIRED)
6+
find_path(MINHOOK_INCLUDE_DIR MinHook.h PATH_SUFFIXES include REQUIRED)
67

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})
8+
add_library(minhook::minhook STATIC IMPORTED)
9+
set_property(TARGET minhook::minhook PROPERTY IMPORTED_LOCATION ${MINHOOK_LIBRARY})
10+
target_include_directories(minhook::minhook INTERFACE ${MINHOOK_INCLUDE_DIR})
11+
endif()

docs/building.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,49 @@ sudo port install "${dependencies[@]}"
7272
```
7373

7474
#### Windows
75-
First you need to install [MSYS2](https://www.msys2.org), then startup "MSYS2 UCRT64" and execute the following
76-
commands.
75+
First you need to install [MSYS2](https://www.msys2.org).
76+
77+
For AMD64 startup "MSYS2 UCRT64", or for ARM64 startup "MSYS2 CLANGARM64", then execute the following commands.
7778

7879
##### Update all packages
7980
```bash
8081
pacman -Syu
8182
```
8283

84+
##### Set toolchain variable
85+
For UCRT64:
86+
```bash
87+
export TOOLCHAIN="ucrt64-x86_64"
88+
```
89+
90+
For CLANGARM64:
91+
```bash
92+
export TOOLCHAIN="clang-aarch64"
93+
```
94+
8395
##### Install dependencies
8496
```bash
8597
dependencies=(
8698
"git"
87-
"mingw-w64-ucrt-x86_64-boost" # Optional
88-
"mingw-w64-ucrt-x86_64-cmake"
89-
"mingw-w64-ucrt-x86_64-cppwinrt"
90-
"mingw-w64-ucrt-x86_64-curl-winssl"
91-
"mingw-w64-ucrt-x86_64-doxygen" # Optional, for docs... better to install official Doxygen
92-
"mingw-w64-ucrt-x86_64-graphviz" # Optional, for docs
93-
"mingw-w64-ucrt-x86_64-MinHook"
94-
"mingw-w64-ucrt-x86_64-miniupnpc"
95-
"mingw-w64-ucrt-x86_64-nodejs"
96-
"mingw-w64-ucrt-x86_64-nsis"
97-
"mingw-w64-ucrt-x86_64-onevpl"
98-
"mingw-w64-ucrt-x86_64-openssl"
99-
"mingw-w64-ucrt-x86_64-opus"
100-
"mingw-w64-ucrt-x86_64-toolchain"
99+
"mingw-w64-${TOOLCHAIN}-boost" # Optional
100+
"mingw-w64-${TOOLCHAIN}-cmake"
101+
"mingw-w64-${TOOLCHAIN}-cppwinrt"
102+
"mingw-w64-${TOOLCHAIN}-curl-winssl"
103+
"mingw-w64-${TOOLCHAIN}-doxygen" # Optional, for docs... better to install official Doxygen
104+
"mingw-w64-${TOOLCHAIN}-graphviz" # Optional, for docs
105+
"mingw-w64-${TOOLCHAIN}-miniupnpc"
106+
"mingw-w64-${TOOLCHAIN}-nodejs"
107+
"mingw-w64-${TOOLCHAIN}-onevpl"
108+
"mingw-w64-${TOOLCHAIN}-openssl"
109+
"mingw-w64-${TOOLCHAIN}-opus"
110+
"mingw-w64-${TOOLCHAIN}-toolchain"
101111
)
112+
if [[ ${MSYSTEM} == "ucrt64" ]]; then
113+
dependencies+=(
114+
"mingw-w64-${TOOLCHAIN}-MinHook"
115+
"mingw-w64-${TOOLCHAIN}-nsis" # TODO: how to create an arm64 installer?
116+
)
117+
fi
102118
pacman -S "${dependencies[@]}"
103119
```
104120

docs/getting_started.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,17 @@ brew uninstall sunshine
280280

281281
### Windows
282282

283+
Sunshine now supports ARM64 on Windows; however this should be considered experimental. This version does not properly
284+
support GPU scheduling.
285+
283286
#### Installer (recommended)
284287

285-
1. Download and install
286-
[sunshine-windows-installer.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/sunshine-windows-installer.exe)
288+
1. Download and install based on your architecture:
289+
290+
| Architecture | Installer |
291+
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
292+
| AMD64/x64 (Intel/AMD) | [Sunshine-Windows-AMD64-installer.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-installer.exe) |
293+
| ARM64 | [Sunshine-Windows-ARM64-installer.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-ARM64-installer.exe) |
287294

288295
@attention{You should carefully select or unselect the options you want to install. Do not blindly install or
289296
enable features.}
@@ -296,8 +303,13 @@ overflow menu. Different versions of Windows may provide slightly different step
296303
@warning{By using this package instead of the installer, performance will be reduced. This package is not
297304
recommended for most users. No support will be provided!}
298305

299-
1. Download and extract
300-
[sunshine-windows-portable.zip](https://github.com/LizardByte/Sunshine/releases/latest/download/sunshine-windows-portable.zip)
306+
1. Download and extract based on your architecture:
307+
308+
| Architecture | Installer |
309+
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
310+
| AMD64/x64 (Intel/AMD) | [Sunshine-Windows-AMD64-portable.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-AMD64-portable.zip) |
311+
| ARM64 | [Sunshine-Windows-ARM64-portable.exe](https://github.com/LizardByte/Sunshine/releases/latest/download/Sunshine-Windows-ARM64-portable.zip) |
312+
301313
2. Open command prompt as administrator
302314
3. Firewall rules
303315

0 commit comments

Comments
 (0)