Skip to content
Merged
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 @@ -90,7 +90,9 @@ jobs:
icu4c@78 \
miniupnpc \
openssl@3 \
opus
opus \
qtbase \
qtsvg

- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
"mingw-w64-${TOOLCHAIN}-openssl"
"mingw-w64-${TOOLCHAIN}-opus"
"mingw-w64-${TOOLCHAIN}-toolchain"
"mingw-w64-${TOOLCHAIN}-qt6-static"
)

if [[ "${MATRIX_MSYSTEM}" == "ucrt64" ]]; then
Expand Down Expand Up @@ -239,10 +240,12 @@ jobs:
-S . \
-DBUILD_WERROR=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="${MINGW_PREFIX}/qt6-static" \
-DSUNSHINE_ASSETS_DIR=assets \
-DSUNSHINE_PUBLISHER_NAME="${GITHUB_REPOSITORY_OWNER}" \
-DSUNSHINE_PUBLISHER_WEBSITE="https://app.lizardbyte.dev" \
-DSUNSHINE_PUBLISHER_ISSUE_URL="https://app.lizardbyte.dev/support"
-DSUNSHINE_PUBLISHER_ISSUE_URL="https://app.lizardbyte.dev/support" \
-DSUNSHINE_USE_STATIC_QT=ON
echo "::add-matcher::.github/matchers/gcc.json"
ninja -C build
echo "::remove-matcher owner=gcc::"
Expand Down
7 changes: 7 additions & 0 deletions cmake/compile_definitions/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ 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

# Qt's static qwindows plugin and MinGW's Windowsapp import library both provide the
# UiaRaiseNotificationEvent import thunk on ARM64. Keep both required libraries while
# permitting lld to coalesce their identical definitions.
if(SUNSHINE_USE_STATIC_QT AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND SUNSHINE_LINK_OPTIONS -Wl,--allow-multiple-definition)
endif()
endif()

# see gcc bug 98723
Expand Down
42 changes: 42 additions & 0 deletions cmake/dependencies/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,49 @@ add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/lizardbyte-common")
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/libdisplaydevice")

if(SUNSHINE_ENABLE_TRAY)
if(SUNSHINE_USE_STATIC_QT)
set(_sunshine_find_library_suffixes "${CMAKE_FIND_LIBRARY_SUFFIXES}")
set(_sunshine_import_library_suffix "${CMAKE_IMPORT_LIBRARY_SUFFIX}")
set(_sunshine_pkg_config_argn "${PKG_CONFIG_ARGN}")
set(_sunshine_disable_find_package_harfbuzz "${CMAKE_DISABLE_FIND_PACKAGE_harfbuzz}")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".a")
set(PKG_CONFIG_ARGN --static)

# HarfBuzz's config-file target omits dependencies needed by its static archive.
# Use Qt's pkg-config fallback so --static supplies the complete link interface.
set(CMAKE_DISABLE_FIND_PACKAGE_harfbuzz TRUE)

# CMake's FindTIFF module does not propagate dependencies of the static archive.
# Provide its standard target from pkg-config before Qt imports the TIFF plugin.
find_package(PkgConfig REQUIRED)
pkg_check_modules(SUNSHINE_STATIC_TIFF REQUIRED IMPORTED_TARGET libtiff-4)
add_library(TIFF::TIFF INTERFACE IMPORTED)
target_link_libraries(TIFF::TIFF INTERFACE PkgConfig::SUNSHINE_STATIC_TIFF)

set(_sunshine_module_path "${CMAKE_MODULE_PATH}")
find_package(Qt6 REQUIRED COMPONENTS Widgets Svg)
get_target_property(_sunshine_qt_core_type Qt6::Core TYPE)
if(NOT _sunshine_qt_core_type STREQUAL "STATIC_LIBRARY")
message(FATAL_ERROR "SUNSHINE_USE_STATIC_QT requires a static Qt 6 installation.")
endif()
set(CMAKE_MODULE_PATH "${_sunshine_module_path}")
endif()

add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/tray")

if(SUNSHINE_USE_STATIC_QT)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${_sunshine_find_library_suffixes}")
set(CMAKE_IMPORT_LIBRARY_SUFFIX "${_sunshine_import_library_suffix}")
set(PKG_CONFIG_ARGN "${_sunshine_pkg_config_argn}")
set(CMAKE_DISABLE_FIND_PACKAGE_harfbuzz "${_sunshine_disable_find_package_harfbuzz}")
unset(_sunshine_disable_find_package_harfbuzz)
unset(_sunshine_find_library_suffixes)
unset(_sunshine_import_library_suffix)
unset(_sunshine_module_path)
unset(_sunshine_pkg_config_argn)
unset(_sunshine_qt_core_type)
endif()
endif()

# common dependencies
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
35 changes: 34 additions & 1 deletion cmake/packaging/macos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@ else()
BUNDLE DESTINATION .
COMPONENT Runtime)

if(SUNSHINE_ENABLE_TRAY)
# Import Qt in this directory so its deployment commands and targets are visible here.
set(_sunshine_module_path "${CMAKE_MODULE_PATH}")
find_package(Qt6 REQUIRED COMPONENTS Core)
set(CMAKE_MODULE_PATH "${_sunshine_module_path}")
unset(_sunshine_module_path)

qt6_generate_deploy_script(
TARGET sunshine
OUTPUT_SCRIPT SUNSHINE_QT_DEPLOY_SCRIPT
CONTENT "
qt6_deploy_runtime_dependencies(
EXECUTABLE \"$<TARGET_FILE_NAME:sunshine>.app\"
NO_APP_STORE_COMPLIANCE
NO_TRANSLATIONS
DEPLOY_TOOL_OPTIONS -no-codesign
)")
install(SCRIPT "${SUNSHINE_QT_DEPLOY_SCRIPT}" COMPONENT Runtime)
endif()

install(FILES "${APPLE_PLIST_FILE}"
DESTINATION "${MAC_BUNDLE_CONTENTS}"
COMPONENT Runtime)
Expand All @@ -44,6 +64,18 @@ else()
message(STATUS \"Running fixup_bundle for: \${_app}\")
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS TRUE)

# Resolve @rpath items that Qt already deployed into the app bundle.
function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var)
if(\"\${item}\" MATCHES \"^@rpath/(.+)$\")
set(_embedded_item \"\${_app}/Contents/Frameworks/\${CMAKE_MATCH_1}\")
if(EXISTS \"\${_embedded_item}\")
set(\${resolved_item_var} \"\${_embedded_item}\" PARENT_SCOPE)
set(\${resolved_var} TRUE PARENT_SCOPE)
endif()
endif()
endfunction()

fixup_bundle(\"\${_app}\" \"\" \"\")

# Remove Finder/resource-fork metadata that breaks codesign.
Expand All @@ -61,12 +93,13 @@ else()

# SHOULD_SIGN is set only when publish_release is true or when manually building
if(\"\$ENV{SHOULD_SIGN}\" STREQUAL \"true\")
# Sign anything inside Contents/Frameworks
# Sign bundled frameworks and plugins before signing the app itself.
set(_fw_dir \"\${_app}/Contents/Frameworks\")
if(EXISTS \"\${_fw_dir}\")
file(GLOB_RECURSE _sign_items
\"\${_fw_dir}/*.framework\"
\"\${_fw_dir}/*.dylib\"
\"\${_app}/Contents/PlugIns/*.dylib\"
)

foreach(item IN LISTS _sign_items)
Expand Down
5 changes: 5 additions & 0 deletions cmake/prep/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF)

option(SUNSHINE_ENABLE_TRAY "Enable system tray icon." ON)

if(WIN32)
option(SUNSHINE_USE_STATIC_QT
"Require static Qt libraries and their static third-party dependencies." OFF)
endif()

option(SUNSHINE_SYSTEM_VULKAN_HEADERS "Use system installation of vulkan-headers rather than the submodule." OFF)
option(SUNSHINE_SYSTEM_WAYLAND_PROTOCOLS "Use system installation of wayland-protocols rather than the submodule." OFF)

Expand Down
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
14 changes: 13 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/llvm19 \
devel/ninja \
devel/pkgconf \
Expand Down Expand Up @@ -102,6 +101,8 @@ dependencies=(
"openssl@3"
"opus"
"pkg-config"
"qtbase"
"qtsvg"
)
brew install "${dependencies[@]}"
```
Expand Down Expand Up @@ -130,6 +131,8 @@ dependencies=(
"ninja"
"npm9"
"pkgconfig"
"qt6-qtbase"
"qt6-qtsvg"
)
sudo port install "${dependencies[@]}"
```
Expand Down Expand Up @@ -174,6 +177,7 @@ dependencies=(
"mingw-w64-${TOOLCHAIN}-openssl"
"mingw-w64-${TOOLCHAIN}-opus"
"mingw-w64-${TOOLCHAIN}-toolchain"
"mingw-w64-${TOOLCHAIN}-qt6-static"
)
if [[ "${MSYSTEM}" == "UCRT64" ]]; then
dependencies+=(
Expand All @@ -185,6 +189,14 @@ fi
pacman -S "${dependencies[@]}"
```

The static Qt package is installed under a separate prefix. Add the following options when configuring a Windows
build so Sunshine and Qt's third-party dependencies are linked statically:

```bash
-DCMAKE_PREFIX_PATH="${MINGW_PREFIX}/qt6-static" \
-DSUNSHINE_USE_STATIC_QT=ON
```

To create a WiX installer, you also need to install [.NET](https://dotnet.microsoft.com/download).

For ARM64: To build frontend, you also need to install [Node.JS](https://nodejs.org/en/download)
Expand Down
1 change: 0 additions & 1 deletion packaging/linux/Arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ depends=(
'libdrm'
'libevdev'
'libmfx'
'libnotify'
'libpipewire'
'libpulse'
'libva'
Expand Down
2 changes: 0 additions & 2 deletions packaging/linux/copr/Sunshine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ BuildRequires: libcap-devel
BuildRequires: libcurl-devel
BuildRequires: libdrm-devel
BuildRequires: libevdev-devel
BuildRequires: libnotify-devel >= 0.8.0
BuildRequires: libva-devel
BuildRequires: libX11-devel
BuildRequires: libxcb-devel
Expand Down Expand Up @@ -152,7 +151,6 @@ BuildRequires: libqt6-qtsvg-devel
%global cuda_dir %{_builddir}/cuda

# Common runtime requirements
Requires: libnotify >= 0.8.0
Requires: miniupnpc >= 2.2.4
Requires: which >= 2.21

Expand Down
5 changes: 2 additions & 3 deletions packaging/sunshine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class Sunshine < Formula
depends_on "miniupnpc"
depends_on "openssl@3"
depends_on "opus"
depends_on "qtbase"
depends_on "qtsvg"

on_sonoma do
depends_on xcode: ["16.2", :build] # required for jthreads on macos-14
Expand All @@ -78,7 +80,6 @@ class Sunshine < Formula
depends_on "libcap"
depends_on "libdrm"
depends_on "libice"
depends_on "libnotify"
depends_on "libsm"
depends_on "libva"
depends_on "libx11"
Expand All @@ -95,8 +96,6 @@ class Sunshine < Formula
depends_on "pango"
depends_on "pipewire"
depends_on "pulseaudio"
depends_on "qtbase"
depends_on "qtsvg"
depends_on "shaderc"
depends_on "systemd"
depends_on "vulkan-loader"
Expand Down
3 changes: 0 additions & 3 deletions scripts/linux_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ function add_arch_deps() {
'libdrm'
'libevdev'
'libmfx'
'libnotify'
'libpulse'
'libva'
'libx11'
Expand Down Expand Up @@ -343,7 +342,6 @@ function add_debian_based_deps() {
"libevdev-dev"
"libgbm-dev"
"libminiupnpc-dev"
"libnotify-dev"
"libnuma-dev"
"libopus-dev"
"libpipewire-0.3-dev"
Expand Down Expand Up @@ -448,7 +446,6 @@ function add_fedora_deps() {
"libcurl-devel"
"libdrm-devel"
"libevdev-devel"
"libnotify-devel"
"libX11-devel" # X11
"libxcb-devel" # X11
"libXcursor-devel" # X11
Expand Down
2 changes: 2 additions & 0 deletions scripts/macos_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ required_formulas=(
"openssl@3"
"opus"
"llvm"
"qtbase"
"qtsvg"
)

function _usage() {
Expand Down
2 changes: 1 addition & 1 deletion third-party/tray
Submodule tray updated 47 files
+28 −12 .github/workflows/ci.yml
+2 −2 .github/workflows/publish-screenshots.yml
+0 −4 .gitmodules
+7 −0 .run/docs.run.xml
+6 −0 .sonarcloud.properties
+0 −0 AGENTS.md
+65 −76 CMakeLists.txt
+86 −30 README.md
+0 −55 cmake/FindLibNotify.cmake
+3 −2 docs/Doxyfile
+ docs/images/screenshot_linux.png
+ docs/images/screenshot_macos.png
+ docs/images/screenshot_windows.png
+ docs/images/tray_menu_left_click_linux.png
+ docs/images/tray_menu_left_click_macos.png
+ docs/images/tray_menu_left_click_windows.png
+ docs/images/tray_notification_svg_icon_linux.png
+ docs/images/tray_notification_svg_icon_windows.png
+ icons/icon.ico
+ icons/icon.png
+ icons/icon2.ico
+ icons/icon2.png
+6 −0 icons/icon2.svg
+8 −0 sonar-project.properties
+146 −51 src/QtTrayMenu.cpp
+31 −4 src/QtTrayMenu.h
+159 −0 src/WindowsAppearance.cpp
+70 −0 src/WindowsAppearance.h
+5 −10 src/example.c
+19 −23 src/tray.h
+0 −185 src/tray_darwin.m
+0 −327 src/tray_linux.cpp
+249 −0 src/tray_qt.cpp
+0 −375 src/tray_windows.c
+13 −3 tests/CMakeLists.txt
+45 −132 tests/conftest.cpp
+79 −0 tests/notification_utils.cpp
+9 −0 tests/notification_utils.h
+64 −18 tests/screenshot_utils.cpp
+218 −250 tests/unit/test_tray.cpp
+0 −275 tests/unit/test_tray_linux.cpp
+375 −0 tests/unit/test_tray_qt.cpp
+0 −20 tests/utils.cpp
+0 −10 tests/utils.h
+0 −1 third-party/googletest
+1 −1 third-party/lizardbyte-common
+4 −0 tray.svg
Loading