Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci-freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ jobs:
devel/evdev-proto \
devel/git \
devel/libevdev \
devel/libnotify \
devel/llvm${{ env.FREEBSD_CLANG_VERSION }} \
devel/ninja \
devel/pkgconf \
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ jobs:
icu4c@78 \
miniupnpc \
openssl@3 \
opus
opus \
qtbase \
qtsvg

- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ jobs:
"mingw-w64-${TOOLCHAIN}-openssl"
"mingw-w64-${TOOLCHAIN}-opus"
"mingw-w64-${TOOLCHAIN}-toolchain"
"mingw-w64-${TOOLCHAIN}-qt6-base"
"mingw-w64-${TOOLCHAIN}-qt6-svg"
)

if [[ "${MATRIX_MSYSTEM}" == "ucrt64" ]]; then
Expand Down Expand Up @@ -270,14 +272,23 @@ jobs:
echo "${linkage}"
echo "::endgroup::"

unexpected_for_binary="$(awk '
binary_dir="$(dirname "${binary}")"
unexpected_for_binary="$(awk -v binary_dir="${binary_dir}" '
BEGIN { IGNORECASE = 1 }
$1 == "zlib1.dll" { next }
$1 ~ /^minhook-detours\..*\.dll$/ { next }
$1 ~ /^api-ms-win-/ { next }
$1 ~ /^ext-ms-win-/ { next }
$0 ~ /=>[[:space:]]+not found/ { print }
$0 ~ /=>[[:space:]]+\/(clangarm64|clang64|mingw32|mingw64|ucrt64)\/bin\// { print }
$0 ~ /=>[[:space:]]+not found/ { print; next }
$0 ~ /=>[[:space:]]+\/(clangarm64|clang64|mingw32|mingw64|ucrt64)\/bin\// {
deployed_dll = binary_dir "/" $1
if ((getline _ < deployed_dll) >= 0) {
close(deployed_dll)
next
}
close(deployed_dll)
print
}
' <<< "${linkage}")"

if [[ -n "${unexpected_for_binary}" ]]; then
Expand Down
11 changes: 0 additions & 11 deletions cmake/packaging/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,6 @@ if(${SUNSHINE_TRAY} STREQUAL 1)
# Icons used by the Qt tray backend are no longer installed to the hicolor icon theme,
# because Qt6 will not allow icons not part of the theme... so we will use icons from our web directory instead

set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
libnotify4"
)
set(CPACK_RPM_PACKAGE_REQUIRES "\
${CPACK_RPM_PACKAGE_REQUIRES}, \
libnotify >= 0.8.0"
)
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
devel/libnotify
)
if(TRAY_QT_VERSION EQUAL 6)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
Expand Down
22 changes: 21 additions & 1 deletion cmake/packaging/macos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,34 @@ else()
PATTERN ".DS_Store" EXCLUDE
PATTERN "._*" EXCLUDE)

set(SUNSHINE_BUNDLE_FIXUP_DIRS "")
set(SUNSHINE_MACDEPLOYQT_CODE "")
if(SUNSHINE_ENABLE_TRAY)
include("${CMAKE_MODULE_PATH}/packaging/qt.cmake")
sunshine_require_qt_tool(macdeployqt SUNSHINE_MACDEPLOYQT_EXECUTABLE)
sunshine_collect_qt_library_dirs(SUNSHINE_BUNDLE_FIXUP_DIRS)
set(SUNSHINE_MACDEPLOYQT_CODE "
message(STATUS \"Running macdeployqt for: \${_app}\")
execute_process(
COMMAND \"${SUNSHINE_MACDEPLOYQT_EXECUTABLE}\" \"\${_app}\" -no-strip
RESULT_VARIABLE _macdeployqt_result
)
if(NOT _macdeployqt_result EQUAL 0)
message(FATAL_ERROR \"macdeployqt failed: \${_macdeployqt_result}\")
endif()
")
endif()

# Pull in non-system dylibs for a self-contained .app
install(CODE "
set(_app \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}.app\")
set(_bundle_fixup_dirs \"${SUNSHINE_BUNDLE_FIXUP_DIRS}\")
${SUNSHINE_MACDEPLOYQT_CODE}

message(STATUS \"Running fixup_bundle for: \${_app}\")
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS TRUE)
fixup_bundle(\"\${_app}\" \"\" \"\")
fixup_bundle(\"\${_app}\" \"\" \"\${_bundle_fixup_dirs}\")

# Remove Finder/resource-fork metadata that breaks codesign.
execute_process(COMMAND /usr/bin/xattr -rc \"\${_app}\")
Expand Down
89 changes: 89 additions & 0 deletions cmake/packaging/qt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Qt packaging helpers

function(sunshine_find_qt_tool tool_name out_var)

Check failure on line 3 in cmake/packaging/qt.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Missing docstring on function or macro declaration
foreach(qt_major IN ITEMS 6 5)
if(TARGET Qt${qt_major}::${tool_name})
get_target_property(_qt_tool Qt${qt_major}::${tool_name} IMPORTED_LOCATION)
if(_qt_tool)
set(${out_var} "${_qt_tool}" PARENT_SCOPE)
return()
endif()
endif()
endforeach()

set(_qt_tool_names "${tool_name}" "${tool_name}6" "${tool_name}5")

Check failure on line 14 in cmake/packaging/qt.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Invalid local variable name "_qt_tool_names" doesn't match `[a-z][a-z0-9_]+`
string(TOUPPER "${tool_name}" _qt_tool_name)
set(_qt_tool_var "SUNSHINE_${_qt_tool_name}_EXECUTABLE")

Check failure on line 16 in cmake/packaging/qt.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Invalid local variable name "_qt_tool_var" doesn't match `[a-z][a-z0-9_]+`
find_program(${_qt_tool_var} NAMES ${_qt_tool_names})
set(${out_var} "${${_qt_tool_var}}" PARENT_SCOPE)
endfunction()

function(sunshine_require_qt_tool tool_name out_var)

Check failure on line 21 in cmake/packaging/qt.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Missing docstring on function or macro declaration
sunshine_find_qt_tool("${tool_name}" _qt_tool)
if(NOT _qt_tool)
message(FATAL_ERROR
"${tool_name} is required to package Sunshine with the Qt tray backend")
endif()

set(${out_var} "${_qt_tool}" PARENT_SCOPE)
endfunction()

function(sunshine_deploy_qt_runtime target_name deploy_tool)

Check failure on line 31 in cmake/packaging/qt.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Missing docstring on function or macro declaration
if(NOT TARGET "${target_name}")
return()
endif()

add_custom_command(TARGET "${target_name}" POST_BUILD
COMMAND "${deploy_tool}"
${ARGN}
--dir "$<TARGET_FILE_DIR:${target_name}>"
"$<TARGET_FILE:${target_name}>"
COMMAND "${CMAKE_COMMAND}"
"-DSUNSHINE_RUNTIME_TARGET=$<TARGET_FILE:${target_name}>"
"-DSUNSHINE_RUNTIME_OUTPUT_DIR=$<TARGET_FILE_DIR:${target_name}>"
-P "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/windows_runtime_deps.cmake"
COMMENT "Deploying Qt runtime for ${target_name}"
VERBATIM)
endfunction()

function(sunshine_collect_qt_library_dirs out_var)

Check failure on line 49 in cmake/packaging/qt.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Missing docstring on function or macro declaration
set(_qt_dirs "")
foreach(qt_major IN ITEMS 6 5)
foreach(qt_component IN ITEMS Core Gui Widgets Svg DBus)
if(TARGET Qt${qt_major}::${qt_component})
set(_qt_location "")
foreach(_qt_property IN ITEMS
IMPORTED_LOCATION_RELEASE
IMPORTED_LOCATION_RELWITHDEBINFO
IMPORTED_LOCATION)
get_target_property(_qt_property_location Qt${qt_major}::${qt_component} ${_qt_property})
if(_qt_property_location)
set(_qt_location "${_qt_property_location}")
break()
endif()
endforeach()

if(_qt_location)
get_filename_component(_qt_dir "${_qt_location}" DIRECTORY)
foreach(_qt_depth RANGE 1 8)
if(NOT _qt_dir)
break()
endif()

list(APPEND _qt_dirs "${_qt_dir}")
get_filename_component(_qt_parent "${_qt_dir}" DIRECTORY)
if(_qt_parent STREQUAL _qt_dir)
break()
endif()
set(_qt_dir "${_qt_parent}")
endforeach()
endif()
endif()
endforeach()
endforeach()

if(_qt_dirs)
list(REMOVE_DUPLICATES _qt_dirs)
endif()
set(${out_var} "${_qt_dirs}" PARENT_SCOPE)
endfunction()
42 changes: 42 additions & 0 deletions cmake/packaging/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,48 @@ if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64" AND DEFINED _MINHOOK_DLL)
install(FILES "${_MINHOOK_DLL}" DESTINATION "." COMPONENT application)
endif()

if(SUNSHINE_ENABLE_TRAY)
include("${CMAKE_MODULE_PATH}/packaging/qt.cmake")
sunshine_require_qt_tool(windeployqt SUNSHINE_WINDEPLOYQT_EXECUTABLE)

set(SUNSHINE_WINDEPLOYQT_OPTIONS
--no-opengl-sw
--no-quick-import
--no-system-d3d-compiler
--no-translations)

sunshine_deploy_qt_runtime(
sunshine
"${SUNSHINE_WINDEPLOYQT_EXECUTABLE}"
${SUNSHINE_WINDEPLOYQT_OPTIONS})

install(CODE "
set(_qt_deploy_dir \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")
set(_qt_deploy_options ${SUNSHINE_WINDEPLOYQT_OPTIONS})
execute_process(
COMMAND \"${SUNSHINE_WINDEPLOYQT_EXECUTABLE}\"
\${_qt_deploy_options}
--dir \"\${_qt_deploy_dir}\"
\"\${_qt_deploy_dir}/sunshine.exe\"
RESULT_VARIABLE _qt_deploy_result
)
if(NOT _qt_deploy_result EQUAL 0)
message(FATAL_ERROR \"windeployqt failed: \${_qt_deploy_result}\")
endif()

execute_process(
COMMAND \"${CMAKE_COMMAND}\"
\"-DSUNSHINE_RUNTIME_TARGET=\${_qt_deploy_dir}/sunshine.exe\"
\"-DSUNSHINE_RUNTIME_OUTPUT_DIR=\${_qt_deploy_dir}\"
-P \"${CMAKE_MODULE_PATH}/packaging/windows_runtime_deps.cmake\"
RESULT_VARIABLE _runtime_deploy_result
)
if(NOT _runtime_deploy_result EQUAL 0)
message(FATAL_ERROR \"Runtime dependency deployment failed: \${_runtime_deploy_result}\")
endif()
" COMPONENT application)
endif()

# ViGEmBus installer
set(SUNSHINE_THIRD_PARTY_DIR "third-party")
set(VIGEMBUS_INSTALLER "${CMAKE_BINARY_DIR}/${SUNSHINE_THIRD_PARTY_DIR}/vigembus_installer.exe")
Expand Down
98 changes: 98 additions & 0 deletions cmake/packaging/windows_runtime_deps.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Deploy MSYS2 runtime DLLs that are reported by ldd for a Windows binary.

if(NOT DEFINED SUNSHINE_RUNTIME_TARGET)
message(FATAL_ERROR "SUNSHINE_RUNTIME_TARGET is required")
endif()

if(NOT DEFINED SUNSHINE_RUNTIME_OUTPUT_DIR)
message(FATAL_ERROR "SUNSHINE_RUNTIME_OUTPUT_DIR is required")
endif()

string(REGEX REPLACE "^\"|\"$" "" SUNSHINE_RUNTIME_TARGET "${SUNSHINE_RUNTIME_TARGET}")
string(REGEX REPLACE "^\"|\"$" "" SUNSHINE_RUNTIME_OUTPUT_DIR "${SUNSHINE_RUNTIME_OUTPUT_DIR}")

find_program(SUNSHINE_LDD_EXECUTABLE ldd)
if(NOT SUNSHINE_LDD_EXECUTABLE)
message(FATAL_ERROR "ldd is required to deploy MSYS2 runtime dependencies")
endif()

find_program(SUNSHINE_CYGPATH_EXECUTABLE cygpath)
if(NOT SUNSHINE_CYGPATH_EXECUTABLE)
message(FATAL_ERROR "cygpath is required to deploy MSYS2 runtime dependencies")
endif()

function(sunshine_msys_path_to_cmake msys_path out_var)

Check failure on line 24 in cmake/packaging/windows_runtime_deps.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Missing docstring on function or macro declaration
execute_process(
COMMAND "${SUNSHINE_CYGPATH_EXECUTABLE}" -m "${msys_path}"
OUTPUT_VARIABLE _cmake_path
ERROR_VARIABLE _cygpath_error
RESULT_VARIABLE _cygpath_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _cygpath_result EQUAL 0)
message(FATAL_ERROR "cygpath failed for ${msys_path}: ${_cygpath_error}")
endif()

set(${out_var} "${_cmake_path}" PARENT_SCOPE)
endfunction()

function(sunshine_copy_msys_dependency msys_path output_dir out_path)

Check failure on line 38 in cmake/packaging/windows_runtime_deps.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Missing docstring on function or macro declaration
sunshine_msys_path_to_cmake("${msys_path}" _source_path)
get_filename_component(_dll_name "${_source_path}" NAME)
set(_deployed_path "${output_dir}/${_dll_name}")

Check failure on line 41 in cmake/packaging/windows_runtime_deps.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Invalid local variable name "_deployed_path" doesn't match `[a-z][a-z0-9_]+`

if(NOT EXISTS "${_deployed_path}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${_source_path}"
"${_deployed_path}"
ERROR_VARIABLE _copy_error
RESULT_VARIABLE _copy_result)
if(NOT _copy_result EQUAL 0)
message(FATAL_ERROR "Failed to copy ${_source_path}: ${_copy_error}")
endif()
endif()

set(${out_path} "${_deployed_path}" PARENT_SCOPE)
endfunction()

file(GLOB_RECURSE _deployed_dlls
LIST_DIRECTORIES false
"${SUNSHINE_RUNTIME_OUTPUT_DIR}/*.dll")

set(_pending "${SUNSHINE_RUNTIME_TARGET}" ${_deployed_dlls})
set(_processed "")

while(_pending)
list(POP_FRONT _pending _runtime_binary)
list(FIND _processed "${_runtime_binary}" _processed_index)
if(NOT _processed_index EQUAL -1)
continue()
endif()

list(APPEND _processed "${_runtime_binary}")

execute_process(
COMMAND "${SUNSHINE_LDD_EXECUTABLE}" "${_runtime_binary}"
OUTPUT_VARIABLE _ldd_output
ERROR_VARIABLE _ldd_error
RESULT_VARIABLE _ldd_result)
if(NOT _ldd_result EQUAL 0)
message(FATAL_ERROR "ldd failed for ${_runtime_binary}: ${_ldd_error}")
endif()

string(REGEX MATCHALL "[^\r\n]+" _ldd_lines "${_ldd_output}")
foreach(_ldd_line IN LISTS _ldd_lines)

Check failure on line 84 in cmake/packaging/windows_runtime_deps.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Invalid argument name "_ldd_line" doesn't match `[a-z][a-z0-9_]+`
if(_ldd_line MATCHES "=>[ \t]+not[ \t]+found")
message(FATAL_ERROR "Runtime dependency not found: ${_ldd_line}")
endif()

if(_ldd_line MATCHES "=>[ \t]+(/(clangarm64|clang64|mingw32|mingw64|ucrt64)/bin/[^ \t\r\n]+\\.dll)")
sunshine_copy_msys_dependency("${CMAKE_MATCH_1}" "${SUNSHINE_RUNTIME_OUTPUT_DIR}" _deployed_dll)
list(FIND _processed "${_deployed_dll}" _deployed_processed_index)
list(FIND _pending "${_deployed_dll}" _deployed_pending_index)
if(_deployed_processed_index EQUAL -1 AND _deployed_pending_index EQUAL -1)
list(APPEND _pending "${_deployed_dll}")
endif()
endif()
endforeach()
endwhile()

Check failure on line 98 in cmake/packaging/windows_runtime_deps.cmake

View workflow job for this annotation

GitHub Actions / Common Lint / Common Lint

Missing Newline at EOF

cmake/packaging/windows_runtime_deps.cmake:98: File is missing a newline at the end. Please add a trailing newline.
1 change: 0 additions & 1 deletion docker/clion-toolchain.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ apt-get install -y --no-install-recommends \
libevdev-dev \
libgbm-dev \
libminiupnpc-dev \
libnotify-dev \
libnuma-dev \
libopus-dev \
libpulse-dev \
Expand Down
7 changes: 6 additions & 1 deletion docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pkg install -y \
devel/evdev-proto \
devel/git \
devel/libevdev \
devel/libnotify \
devel/ninja \
devel/pkgconf \
devel/qt6-base \
Expand Down Expand Up @@ -94,6 +93,8 @@ dependencies=(
"openssl@3"
"opus"
"pkg-config"
"qtbase"
"qtsvg"
)
brew install "${dependencies[@]}"
```
Expand Down Expand Up @@ -122,6 +123,8 @@ dependencies=(
"ninja"
"npm9"
"pkgconfig"
"qt6-qtbase"
"qt6-qtsvg"
)
sudo port install "${dependencies[@]}"
```
Expand Down Expand Up @@ -166,6 +169,8 @@ dependencies=(
"mingw-w64-${TOOLCHAIN}-openssl"
"mingw-w64-${TOOLCHAIN}-opus"
"mingw-w64-${TOOLCHAIN}-toolchain"
"mingw-w64-${TOOLCHAIN}-qt6-base"
"mingw-w64-${TOOLCHAIN}-qt6-svg"
)
if [[ "${MSYSTEM}" == "UCRT64" ]]; then
dependencies+=(
Expand Down
1 change: 0 additions & 1 deletion packaging/linux/Arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ depends=(
'libdrm'
'libevdev'
'libmfx'
'libnotify'
'libpipewire'
'libpulse'
'libva'
Expand Down
Loading
Loading