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>
This commit is contained in:
Coia Prant 2026-02-08 10:03:05 +08:00 committed by GitHub
commit d591643706
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 242 additions and 56 deletions

View file

@ -9,6 +9,13 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
# gcc complains about misleading indentation in some mingw includes
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-misleading-indentation)
# Disable warnings for Windows ARM64
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64")
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-dll-attribute-on-redeclaration) # Boost
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-unknown-warning-option) # ViGEmClient
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-unused-variable) # Boost
endif()
# see gcc bug 98723
add_definitions(-DUSE_BOOST_REGEX)

View file

@ -1,9 +1,35 @@
# windows specific dependencies
# Make sure MinHook is installed
find_library(MINHOOK_LIBRARY libMinHook.a REQUIRED)
find_path(MINHOOK_INCLUDE_DIR MinHook.h PATH_SUFFIXES include REQUIRED)
# MinHook setup - use installed minhook for AMD64, otherwise download minhook-detours for ARM64
if(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
# Make sure MinHook is installed for x86/x64
find_library(MINHOOK_LIBRARY libMinHook.a REQUIRED)
find_path(MINHOOK_INCLUDE_DIR MinHook.h PATH_SUFFIXES include REQUIRED)
add_library(minhook::minhook STATIC IMPORTED)
set_property(TARGET minhook::minhook PROPERTY IMPORTED_LOCATION ${MINHOOK_LIBRARY})
target_include_directories(minhook::minhook INTERFACE ${MINHOOK_INCLUDE_DIR})
add_library(minhook::minhook STATIC IMPORTED)
set_property(TARGET minhook::minhook PROPERTY IMPORTED_LOCATION ${MINHOOK_LIBRARY})
target_include_directories(minhook::minhook INTERFACE ${MINHOOK_INCLUDE_DIR})
else()
# Download pre-built minhook-detours for ARM64
message(STATUS "Downloading minhook-detours pre-built binaries for ARM64")
include(FetchContent)
FetchContent_Declare(
minhook-detours
URL https://github.com/m417z/minhook-detours/releases/download/v1.0.6/minhook-detours-1.0.6.zip
URL_HASH SHA256=E719959D824511E27395A82AEDA994CAAD53A67EE5894BA5FC2F4BF1FA41E38E
)
FetchContent_MakeAvailable(minhook-detours)
# Create imported library for the pre-built DLL
set(_MINHOOK_DLL
"${minhook-detours_SOURCE_DIR}/Release/minhook-detours.ARM64.Release.dll"
CACHE INTERNAL "Path to minhook-detours DLL")
add_library(minhook::minhook SHARED IMPORTED GLOBAL)
set_property(TARGET minhook::minhook PROPERTY IMPORTED_LOCATION "${_MINHOOK_DLL}")
set_property(TARGET minhook::minhook PROPERTY IMPORTED_IMPLIB
"${minhook-detours_SOURCE_DIR}/Release/minhook-detours.ARM64.Release.lib")
set_target_properties(minhook::minhook PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${minhook-detours_SOURCE_DIR}/src"
)
endif()

View file

@ -4,6 +4,11 @@ install(TARGETS sunshine RUNTIME DESTINATION "." COMPONENT application)
# Hardening: include zlib1.dll (loaded via LoadLibrary() in openssl's libcrypto.a)
install(FILES "${ZLIB}" DESTINATION "." COMPONENT application)
# ARM64: include minhook-detours DLL (shared library for ARM64)
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64" AND DEFINED _MINHOOK_DLL)
install(FILES "${_MINHOOK_DLL}" DESTINATION "." COMPONENT application)
endif()
# ViGEmBus installer
set(VIGEMBUS_INSTALLER "${CMAKE_BINARY_DIR}/scripts/vigembus_installer.exe")
set(VIGEMBUS_DOWNLOAD_URL_1 "https://github.com/nefarius/ViGEmBus/releases/download")

View file

@ -3,12 +3,18 @@
set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT__DIR}\\\\${PROJECT_EXE}")
# Enable detailed logging only on AMD64
if(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
set(NSIS_LOGSET_COMMAND "LogSet on")
else()
set(NSIS_LOGSET_COMMAND "")
endif()
# Extra install commands
# Runs the main setup script which handles all installation tasks
SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
"${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
; Enable detailed logging
LogSet on
${NSIS_LOGSET_COMMAND}
IfSilent +3 0
nsExec::ExecToLog \
'powershell -ExecutionPolicy Bypass \
@ -24,8 +30,7 @@ SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
# Runs the main setup script which handles all uninstallation tasks
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
"${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
; Enable detailed logging
LogSet on
${NSIS_LOGSET_COMMAND}
nsExec::ExecToLog \
'powershell -ExecutionPolicy Bypass \
-File \\\"$INSTDIR\\\\scripts\\\\sunshine-setup.ps1\\\" -Action uninstall'