mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:20:46 +00:00
fix(linux): migrate to qt tray (#4907)
Co-authored-by: Kishi <41839133+Kishi85@users.noreply.github.com>
This commit is contained in:
@@ -62,7 +62,6 @@ set(SUNSHINE_TARGET_FILES
|
||||
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Rtsp.h"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/RtspParser.c"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Video.h"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/tray/src/tray.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/upnp.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/upnp.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/cbs.cpp"
|
||||
@@ -159,3 +158,11 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
${Boost_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${PLATFORM_LIBRARIES})
|
||||
|
||||
# tray icon
|
||||
if(SUNSHINE_ENABLE_TRAY)
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES tray::tray)
|
||||
else()
|
||||
set(SUNSHINE_TRAY 0)
|
||||
message(STATUS "Tray icon disabled")
|
||||
endif()
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
if(FREEBSD)
|
||||
add_compile_definitions(SUNSHINE_PLATFORM="freebsd")
|
||||
# FreeBSD installs packages to /usr/local/lib, which is not in the default linker search path.
|
||||
# link_directories() is directory-scoped and propagates to all subdirectories (including tests/),
|
||||
# so all targets (sunshine, test_sunshine) can resolve libraries found via pkg_check_modules.
|
||||
link_directories(/usr/local/lib)
|
||||
else()
|
||||
add_compile_definitions(SUNSHINE_PLATFORM="linux")
|
||||
endif()
|
||||
@@ -293,37 +297,6 @@ if(NOT ${CUDA_FOUND}
|
||||
message(FATAL_ERROR "Couldn't find either cuda, (libdrm and libcap), libva, kwin, pipewire, portal, wayland or x11")
|
||||
endif()
|
||||
|
||||
# tray icon
|
||||
if(${SUNSHINE_ENABLE_TRAY})
|
||||
pkg_check_modules(APPINDICATOR ayatana-appindicator3-0.1)
|
||||
if(APPINDICATOR_FOUND)
|
||||
list(APPEND SUNSHINE_DEFINITIONS TRAY_AYATANA_APPINDICATOR=1)
|
||||
else()
|
||||
pkg_check_modules(APPINDICATOR appindicator3-0.1)
|
||||
if(APPINDICATOR_FOUND)
|
||||
list(APPEND SUNSHINE_DEFINITIONS TRAY_LEGACY_APPINDICATOR=1)
|
||||
endif ()
|
||||
endif()
|
||||
pkg_check_modules(LIBNOTIFY libnotify)
|
||||
if(NOT APPINDICATOR_FOUND OR NOT LIBNOTIFY_FOUND)
|
||||
message(STATUS "APPINDICATOR_FOUND: ${APPINDICATOR_FOUND}")
|
||||
message(STATUS "LIBNOTIFY_FOUND: ${LIBNOTIFY_FOUND}")
|
||||
message(FATAL_ERROR "Couldn't find either appindicator or libnotify")
|
||||
else()
|
||||
include_directories(SYSTEM ${APPINDICATOR_INCLUDE_DIRS} ${LIBNOTIFY_INCLUDE_DIRS})
|
||||
link_directories(${APPINDICATOR_LIBRARY_DIRS} ${LIBNOTIFY_LIBRARY_DIRS})
|
||||
|
||||
list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_linux.c")
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES ${APPINDICATOR_LIBRARIES} ${LIBNOTIFY_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set(SUNSHINE_TRAY_PREFIX "${PROJECT_FQDN}")
|
||||
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY_PREFIX="${SUNSHINE_TRAY_PREFIX}")
|
||||
else()
|
||||
set(SUNSHINE_TRAY 0)
|
||||
message(STATUS "Tray icon disabled")
|
||||
endif()
|
||||
|
||||
# These need to be set before adding the inputtino subdirectory in order for them to be picked up
|
||||
set(LIBEVDEV_CUSTOM_INCLUDE_DIR "${EVDEV_INCLUDE_DIR}")
|
||||
set(LIBEVDEV_CUSTOM_LIBRARY "${EVDEV_LIBRARY}")
|
||||
|
||||
@@ -58,10 +58,3 @@ set(PLATFORM_TARGET_FILES
|
||||
"${CMAKE_SOURCE_DIR}/third-party/TPCircularBuffer/TPCircularBuffer.c"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/TPCircularBuffer/TPCircularBuffer.h"
|
||||
${APPLE_PLIST_FILE})
|
||||
|
||||
if(SUNSHINE_ENABLE_TRAY)
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
${COCOA})
|
||||
list(APPEND PLATFORM_TARGET_FILES
|
||||
"${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_darwin.m")
|
||||
endif()
|
||||
|
||||
@@ -105,8 +105,3 @@ list(PREPEND PLATFORM_LIBRARIES
|
||||
ws2_32
|
||||
wsock32
|
||||
)
|
||||
|
||||
if(SUNSHINE_ENABLE_TRAY)
|
||||
list(APPEND PLATFORM_TARGET_FILES
|
||||
"${CMAKE_SOURCE_DIR}/third-party/tray/src/tray_windows.c")
|
||||
endif()
|
||||
|
||||
@@ -19,6 +19,10 @@ add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/Simple-Web-Server")
|
||||
# libdisplaydevice
|
||||
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/libdisplaydevice")
|
||||
|
||||
if(SUNSHINE_ENABLE_TRAY)
|
||||
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/tray")
|
||||
endif()
|
||||
|
||||
# common dependencies
|
||||
include("${CMAKE_MODULE_PATH}/dependencies/nlohmann_json.cmake")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
+42
-18
@@ -138,33 +138,57 @@ set(CPACK_RPM_PACKAGE_AUTOREQ ON)
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps"
|
||||
RENAME "${PROJECT_FQDN}.svg")
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}/web/images"
|
||||
RENAME "logo-sunshine.svg")
|
||||
|
||||
# tray icon
|
||||
if(${SUNSHINE_TRAY} STREQUAL 1)
|
||||
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
|
||||
RENAME "${PROJECT_FQDN}-tray.svg")
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-playing.svg"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
|
||||
RENAME "${PROJECT_FQDN}-playing.svg")
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-pausing.svg"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
|
||||
RENAME "${PROJECT_FQDN}-pausing.svg")
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/web/public/images/sunshine-locked.svg"
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status"
|
||||
RENAME "${PROJECT_FQDN}-locked.svg")
|
||||
# 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}, \
|
||||
libayatana-appindicator3-1, \
|
||||
libnotify4")
|
||||
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
|
||||
libnotify4"
|
||||
)
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "\
|
||||
${CPACK_RPM_PACKAGE_REQUIRES}, \
|
||||
libappindicator-gtk3 >= 12.10.0")
|
||||
${CPACK_RPM_PACKAGE_REQUIRES}, \
|
||||
libnotify >= 0.8.0"
|
||||
)
|
||||
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
|
||||
devel/libayatana-appindicator
|
||||
devel/libnotify
|
||||
)
|
||||
if(TRAY_QT_VERSION EQUAL 6)
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
|
||||
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
|
||||
libqt6widgets6, \
|
||||
libqt6svg6"
|
||||
)
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "\
|
||||
${CPACK_RPM_PACKAGE_REQUIRES}, \
|
||||
qt6-qtbase, \
|
||||
qt6-qtsvg"
|
||||
)
|
||||
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
|
||||
x11-toolkits/qt6-widgets
|
||||
graphics/qt6-svg
|
||||
)
|
||||
else()
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
|
||||
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
|
||||
libqt5widgets5, \
|
||||
libqt5svg5"
|
||||
)
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "\
|
||||
${CPACK_RPM_PACKAGE_REQUIRES}, \
|
||||
qt5-qtbase, \
|
||||
qt5-qtsvg"
|
||||
)
|
||||
list(APPEND CPACK_FREEBSD_PACKAGE_DEPS
|
||||
x11-toolkits/qt5-widgets
|
||||
graphics/qt5-svg
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# desktop file
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# linux specific target definitions
|
||||
|
||||
# Using newer c++ compilers / features on older distros causes runtime dyn link errors
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
-static-libgcc
|
||||
-static-libstdc++
|
||||
)
|
||||
if(NOT FREEBSD)
|
||||
# Using newer c++ compilers / features on older distros causes runtime dyn link errors
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
-static-libgcc
|
||||
-static-libstdc++
|
||||
)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user