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
357 changes: 224 additions & 133 deletions .github/workflows/CI.yml

Large diffs are not rendered by default.

90 changes: 52 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ project(Sunshine VERSION 0.14.0
HOMEPAGE_URL "https://sunshinestream.github.io"
)

set(PROJECT_LONG_DESCRIPTION "Sunshine is a self hosted, low latency, cloud gaming solution with support for AMD, \
Intel, and Nvidia GPUs. It is an open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield. \
Connect to Sunshine from any Moonlight client, available for nearly any device imaginable.")

option(SUNSHINE_CONFIGURE_APPIMAGE "Configure files required for AppImage." OFF)
option(SUNSHINE_CONFIGURE_AUR "Configure files required for AUR." OFF)
option(SUNSHINE_CONFIGURE_FLATPAK "Configure files required for Flatpak." OFF)
option(SUNSHINE_CONFIGURE_PORTFILE "Configure MacOS Portfile." OFF)
option(SUNSHINE_CONFIGURE_PORTFILE "Configure macOS Portfile." OFF)
option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF)

if(${SUNSHINE_CONFIGURE_APPIMAGE})
Expand Down Expand Up @@ -150,6 +154,9 @@ if(WIN32)
set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess")
elseif(APPLE)
add_compile_definitions(SUNSHINE_PLATFORM="macos")

option(SUNSHINE_MACOS_PACKAGE "Should only be used when creating a MACOS package/dmg." OFF)

link_directories(/opt/local/lib)
link_directories(/usr/local/lib)
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
Expand Down Expand Up @@ -559,57 +566,64 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h
set(CPACK_COMPONENT_SUNSHINESVC_DESCRIPTION "CLI tool that allows you to enable/disable the Sunshine service.")
set(CPACK_COMPONENT_SUNSHINESVC_GROUP "Tools")
endif()
if(UNIX)
# Installation destination dir
set(CPACK_SET_DESTDIR true)
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local/sunshine")
endif()

install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")

install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
if(APPLE)
# TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop
set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}")
set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns")
# set(CPACK_BUNDLE_STARTUP_COMMAND "${INSTALL_RUNTIME_DIR}/sunshine")
endif()
if(APPLE) # TODO: test

if(APPLE AND SUNSHINE_MACOS_PACKAGE) # TODO
set(prefix "${CMAKE_PROJECT_NAME}.app/Contents")
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")

install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")

install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")

install(TARGETS sunshine
BUNDLE DESTINATION . COMPONENT Runtime
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT Runtime)
elseif(UNIX)
# Installation destination dir
set(CPACK_SET_DESTDIR true)
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local/sunshine")
endif()

# TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop
set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}")
set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns")
# set(CPACK_BUNDLE_STARTUP_COMMAND "${INSTALL_RUNTIME_DIR}/sunshine")
endif()
if(UNIX AND NOT APPLE)
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")

install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules" DESTINATION "${CMAKE_INSTALL_LIBDIR}/udev/rules.d")
if(APPLE)
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")

install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user")

# Pre and post install
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst;${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/conffiles")
set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst")

# Dependencies
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2")
set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.1, libavdevice >= 4.3, boost-thread >= 1.67.0, boost-filesystem >= 1.67.0, boost-log >= 1.67.0, pulseaudio-libs >= 10.0, libopusenc >= 0.2.1, libxcb >= 1.13, libXtst >= 1.2.3, libevdev >= 1.5.6, libdrm >= 2.4.97, libcap >= 2.22")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # This should automatically figure out dependencies, doesn't work with the current config
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/misc/uninstall_pkg.sh" DESTINATION "${SUNSHINE_ASSETS_DIR}")
else()
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")

install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules" DESTINATION "${CMAKE_INSTALL_LIBDIR}/udev/rules.d")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user")

# Pre and post install
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst"
"${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst"
"${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/conffiles")
set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/preinst")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/postinst")

# Dependencies
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0 | libboost-thread1.74.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0 | libboost-filesystem1.74.0, libboost-log1.67.0 | libboost-log1.71.0 | libboost-log1.74.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2")
set(CPACK_RPM_PACKAGE_REQUIRES "openssl >= 1.1, libavdevice >= 4.3, boost-thread >= 1.67.0, boost-filesystem >= 1.67.0, boost-log >= 1.67.0, pulseaudio-libs >= 10.0, libopusenc >= 0.2.1, libxcb >= 1.13, libXtst >= 1.2.3, libevdev >= 1.5.6, libdrm >= 2.4.97, libcap >= 2.22")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # This should automatically figure out dependencies, doesn't work with the current config
endif()
endif()

include(CPack)
15 changes: 9 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ SunshineStream has the full documentation hosted on `Read the Docs <http://sunsh

About
-----
Sunshine is a Game stream host for Moonlight. It is an open source version of GeForce Experience (GFE).
Sunshine is a Game stream host for Moonlight.
Sunshine is a self hosted, low latency, cloud gaming solution with support for AMD, Intel, and Nvidia gpus.
It is an open source implementation of NVIDIA's GameStream, as used by the NVIDIA Shield.
Connect to Sunshine from any Moonlight client, available for nearly any device imaginable.

These are the advantages of Sunshine over GFE.
These are the advantages of Sunshine over GeForce Experience.

- FOSS (Free and Open Source Software)
- Multi-platform

- Linux (deb, rpm, and AppImage packages)
- MacOS (Portfile)
- Windows (portable binary)
- Linux
- macOS
- Windows

- Pair over web ui
- Supports AMD and Nvidia GPUs for encoding
- Supports AMD, Intel, and Nvidia GPUs for encoding
- Supports software encoding
- Supports streaming to multiple clients
- Web UI for configuration
Expand Down
22 changes: 11 additions & 11 deletions docs/source/about/advanced_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ location by modifying the configuration file.
Linux-aur /usr/share/sunshine/config/
Linux-deb /usr/local/sunshine/config/
Linux-rpm /usr/local/sunshine/config/
MacOS /usr/local/sunshine/config/
macOS /usr/local/sunshine/config/
Windows ./config/
========= ===========

Expand Down Expand Up @@ -227,7 +227,7 @@ Description
To be supported by Sunshine, it needs to have at the very minimum:
``VAProfileH264High : VAEntrypointEncSlice``

.. Todo:: MacOS
.. Todo:: macOS

Windows
.. code-block:: batch
Expand All @@ -243,7 +243,7 @@ Examples

adapter_name = /dev/dri/renderD128

.. Todo:: MacOS
.. Todo:: macOS

Windows
.. code-block:: text
Expand All @@ -267,7 +267,7 @@ Description

You need to use the value before the colon in the output, e.g. ``0``.

.. Todo:: MacOS
.. Todo:: macOS

Windows
.. code-block:: batch
Expand All @@ -283,7 +283,7 @@ Examples

output_name = 0

.. Todo:: MacOS
.. Todo:: macOS

Windows
.. code-block:: text
Expand Down Expand Up @@ -378,8 +378,8 @@ Description
# in some causes you'd need to use the `Sink` device, if `Source` doesn't work, so try:
pactl info | grep Sink

MacOS
Sunshine can only access microphones on MacOS due to system limitations. To stream system audio use
macOS
Sunshine can only access microphones on macOS due to system limitations. To stream system audio use
`Soundflower <https://github.com/mattingalls/Soundflower>`_ or
`BlackHole <https://github.com/ExistentialAudio/BlackHole>`_.

Expand All @@ -397,7 +397,7 @@ Examples

audio_sink = alsa_output.pci-0000_09_00.3.analog-stereo

MacOS
macOS
.. code-block:: text

audio_sink = BlackHole 2ch
Expand Down Expand Up @@ -995,7 +995,7 @@ vt_software
Description
Force Video Toolbox to use software encoding.

.. Note:: This option only applies when using MacOS.
.. Note:: This option only applies when using macOS.

**Choices**

Expand Down Expand Up @@ -1025,7 +1025,7 @@ vt_realtime
Description
Realtime encoding.

.. Note:: This option only applies when using MacOS.
.. Note:: This option only applies when using macOS.

.. Warning:: Disabling realtime encoding might result in a delayed frame encoding or frame drop.

Expand All @@ -1043,7 +1043,7 @@ vt_coder
Description
The entropy encoding to use.

.. Note:: This option only applies when using MacOS.
.. Note:: This option only applies when using macOS.

**Choices**

Expand Down
9 changes: 6 additions & 3 deletions docs/source/about/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Binaries
Binaries of Sunshine are created for each release. They are available for Linux, and Windows.
Binaries can be found in the `latest release`_.

.. Todo:: Create binary package(s) for MacOS. See `here <https://github.com/SunshineStream/Sunshine/issues/61>`_.

.. Tip:: Some third party packages also exist. See
:ref:`Third Party Packages <about/third_party_packages:third party packages>`.

Expand Down Expand Up @@ -107,11 +105,16 @@ RPM Package

.. Tip:: You can double click the rpm file to see details about the package and begin installation.

MacOS
macOS
-----
.. image:: https://img.shields.io/github/issues/sunshinestream/sunshine/os:macos?logo=github&style=for-the-badge
:alt: GitHub issues by-label

pkg
.. Warning:: The `pkg` does not include runtime dependencies and should be considered experimental.

#. Download the ``sunshine.pkg`` file and install it as normal.

Portfile
#. Install `MacPorts <https://www.macports.org>`_
#. Update the Macports sources.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/about/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Usage
list of applications that are started just before running a stream. This is the directory within the GitHub
repo.

.. Attention:: Application list is not fully supported on MacOS
.. Attention:: Application list is not fully supported on macOS

#. In Moonlight, you may need to add the PC manually.
#. When Moonlight request you insert the correct pin on sunshine:
Expand Down Expand Up @@ -138,7 +138,7 @@ Sunshine needs access to `uinput` to create mouse and gamepad events.

sudo reboot now

MacOS
macOS
^^^^^
Sunshine can only access microphones on macOS due to system limitations. To stream system audio use
`Soundflower <https://github.com/mattingalls/Soundflower>`_ or
Expand Down
2 changes: 1 addition & 1 deletion docs/source/building/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Compile
See the section specific to your OS.

- :ref:`Linux <building/linux:linux>`
- :ref:`MacOS <building/macos:macos>`
- :ref:`macOS <building/macos:macos>`
- :ref:`Windows <building/windows:windows>`

Remote Build
Expand Down
6 changes: 3 additions & 3 deletions docs/source/building/macos.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/building/macos.rst

MacOS
macOS
=====

Requirements
------------
MacOS Big Sur and Xcode 12.5+
macOS Big Sur and Xcode 12.5+

Use either `MacPorts <https://www.macports.org>`_ or `Homebrew <https://brew.sh>`_

Expand Down Expand Up @@ -35,7 +35,7 @@ Build
cmake ..
make -j ${nproc}

cpack -G DragNDrop # optionally, create a MacOS dmg package
cpack -G DragNDrop # optionally, create a macOS dmg package

If cmake fails complaining to find Boost, try to set the path explicitly.

Expand Down
17 changes: 16 additions & 1 deletion docs/source/troubleshooting/macos.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:github_url: https://github.com/SunshineStream/Sunshine/tree/nightly/docs/source/troubleshooting/macos.rst

MacOS
macOS
=====
If you get this error:

Expand All @@ -12,3 +12,18 @@ If you get this error:
.. code-block:: bash

launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

Uninstall:

- pkg

.. code-block:: bash

sudo chmod +x /opt/local/etc/sunshine/assets/uninstall_pkg.sh
sudo /opt/local/etc/sunshine/assets/uninstall_pkg.sh

- Portfile

.. code-block:: bash

sudo port uninstall Sunshine
Loading