Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.1k
WIP: Moving to cpack in order to unify installers across all platforms#139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c4977b52ea414dffdcf0fe2bef75cc2d9824e4a5c8af342c86858f9c5eb3e7cdc4393a31f7faa2a693856e2bb05File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -58,7 +58,7 @@ if(WIN32) | ||
| INPUT "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled.zip" | ||
| DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/pre-compiled) | ||
| set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") | ||
| if(NOT DEFINED SUNSHINE_PREPARED_BINARIES) | ||
| set(SUNSHINE_PREPARED_BINARIES "${CMAKE_CURRENT_BINARY_DIR}/pre-compiled/windows") | ||
| endif() | ||
| @@ -127,8 +127,8 @@ if(WIN32) | ||
| elseif(APPLE) | ||
| add_compile_definitions(SUNSHINE_PLATFORM="macos") | ||
| list(APPEND SUNSHINE_DEFINITIONS APPS_JSON="apps_mac.json") | ||
| link_directories(/opt/homebrew/lib/) # Default brew lib location | ||
| link_directories(/opt/local/lib) | ||
| link_directories(/usr/local/lib) | ||
| ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK) | ||
| find_package(FFmpeg REQUIRED) | ||
| @@ -296,14 +296,14 @@ else() | ||
| third-party/glad/include/KHR/khrplatform.h | ||
| third-party/glad/include/glad/gl.h | ||
| third-party/glad/include/glad/egl.h) | ||
| list(APPEND PLATFORM_LIBRARIES | ||
| dl | ||
| evdev | ||
| pulse | ||
| pulse-simple | ||
| ) | ||
| include_directories( | ||
| /usr/include/libevdev-1.0 | ||
| third-party/nv-codec-headers/include | ||
| @@ -312,8 +312,6 @@ else() | ||
| if(NOT DEFINED SUNSHINE_EXECUTABLE_PATH) | ||
| set(SUNSHINE_EXECUTABLE_PATH "sunshine") | ||
| endif() | ||
| configure_file(gen-deb.in gen-deb @ONLY) | ||
| configure_file(gen-rpm.in gen-rpm @ONLY) | ||
| configure_file(sunshine.desktop.in sunshine.desktop @ONLY) | ||
| configure_file(sunshine.service.in sunshine.service @ONLY) | ||
| endif() | ||
| @@ -448,3 +446,120 @@ foreach(flag IN LISTS SUNSHINE_COMPILE_OPTIONS) | ||
| endforeach() | ||
| target_compile_options(sunshine PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>) | ||
| ############# | ||
| # CPACK | ||
| #### | ||
| # Common options | ||
| set(CPACK_PACKAGE_NAME "SunshineStream") | ||
| set(CPACK_PACKAGE_VENDOR "CMake.org") | ||
| set(CPACK_PACKAGE_CONTACT "https://github.com/SunshineStream/Sunshine") | ||
| set(CPACK_DEBIAN_PACKAGE_MAINTAINER "https://github.com/SunshineStream/Sunshine") | ||
| set(CPACK_PACKAGE_DESCRIPTION "Gamestream host for Moonlight") | ||
| set(CPACK_PACKAGE_HOMEPAGE_URL "https://sunshinestream.github.io") | ||
| set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE) | ||
| set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/sunshine.png) | ||
| set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") | ||
| set(CPACK_STRIP_FILES YES) | ||
| # Platform specific options | ||
| if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.html | ||
| install(TARGETS sunshine RUNTIME DESTINATION "." COMPONENT application) | ||
| # Adding tools | ||
| install(TARGETS dxgi-info RUNTIME DESTINATION "tools" COMPONENT dxgi) | ||
| install(TARGETS audio-info RUNTIME DESTINATION "tools" COMPONENT audio) | ||
| install(TARGETS sunshinesvc RUNTIME DESTINATION "tools" COMPONENT sunshinesvc) | ||
| install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/web" DESTINATION "${SUNSHINE_CONFIG_DIR}" COMPONENT web) | ||
| install(FILES "${SUNSHINE_ASSETS_DIR}/apps_windows.json" DESTINATION "${SUNSHINE_CONFIG_DIR}" COMPONENT assets) | ||
| install(FILES "${SUNSHINE_ASSETS_DIR}/sunshine.conf" DESTINATION "${SUNSHINE_CONFIG_DIR}" COMPONENT assets) | ||
| install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/shaders/directx" DESTINATION "${SUNSHINE_CONFIG_DIR}/shaders" COMPONENT assets) | ||
| set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\sunshine.ico") | ||
| set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT__DIR}\\\\${PROJECT_EXE}") | ||
| set(CPACK_PACKAGE_INSTALL_DIRECTORY "Sunshine") # The name of the directory that will be created in C:/Program files/ | ||
| string(APPEND CPACK_NSIS_DEFINES "\n RequestExecutionLevel admin") # TODO: Not sure if this is needed but it took me a while to figure out where to put this option so I'm leaving it here | ||
| # Sets permissions on the installed folder so that we can write in it | ||
| SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS | ||
| "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} | ||
| ExecWait 'icacls \\\"$INSTDIR\\\" /grant:r Users:\\\(OI\\\)\\\(CI\\\)\\\(F\\\)' | ||
| ") | ||
| # Adding an option for the start menu and PATH | ||
| set(CPACK_NSIS_MODIFY_PATH "OFF") # TODO: it asks to add it to the PATH but then it seems I can't just run it from powershell | ||
| set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") | ||
| set(CPACK_NSIS_MUI_FINISHPAGE_RUN "${PROJECT_NAME}.exe") | ||
| set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT_NAME}.exe") # This will be shown on the installed apps Windows settings | ||
| set(CPACK_NSIS_CREATE_ICONS "CreateShortCut '\$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME}.lnk' '\$INSTDIR\\\\${PROJECT_NAME}.exe'") | ||
| # Checking for previous installed versions | ||
| # set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") # TODO: doesn't work on my machine when Sunshine is already installed | ||
| # Setting components groups and dependencies | ||
| set(CPACK_COMPONENT_APPLICATION_DISPLAY_NAME "Sunshine") | ||
| set(CPACK_COMPONENT_WEB_DISPLAY_NAME "Web interface") | ||
| set(CPACK_COMPONENT_ASSETS_DISPLAY_NAME "Extra assets files") | ||
| set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") | ||
| set(CPACK_COMPONENT_APPLICATION_GROUP "Runtime") | ||
| set(CPACK_COMPONENT_WEB_GROUP "Runtime") | ||
| set(CPACK_COMPONENT_ASSETS_GROUP "Runtime") | ||
| set(CPACK_COMPONENT_DXGI_DISPLAY_NAME "dxgi-info.exe") | ||
| set(CPACK_COMPONENT_AUDIO_DISPLAY_NAME "audio-info.exe") | ||
| set(CPACK_COMPONENT_SUNSHINESVC_DISPLAY_NAME "sunshinesvc.exe") | ||
| set(CPACK_COMPONENT_DXGI_GROUP "Extra Tools") | ||
| set(CPACK_COMPONENT_AUDIO_GROUP "Extra Tools") | ||
| set(CPACK_COMPONENT_SUNSHINESVC_GROUP "Extra Tools") | ||
| set(CPACK_COMPONENT_APPLICATION_DEPENDS web assets) | ||
| endif() | ||
| if(APPLE) # TODO: test | ||
| set(prefix "${CMAKE_PROJECT_NAME}.app/Contents") | ||
| set(INSTALL_RUNTIME_DIR "${prefix}/MacOS") | ||
| install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/web" DESTINATION "${INSTALL_RUNTIME_DIR}") | ||
| install(FILES "${SUNSHINE_ASSETS_DIR}/sunshine.conf" DESTINATION "${INSTALL_RUNTIME_DIR}") | ||
| install(TARGETS sunshine | ||
| BUNDLE DESTINATION . COMPONENT Runtime | ||
| RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT Runtime) | ||
| # TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop | ||
| # set(CPACK_BUNDLE_NAME "Sunshine") | ||
| # set(CPACK_BUNDLE_PLIST "${SUNSHINE_ASSETS_DIR}/info.plist") | ||
| # set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns") | ||
| endif() | ||
| if(UNIX AND NOT APPLE) | ||
| install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/web" DESTINATION "${SUNSHINE_CONFIG_DIR}") | ||
| install(FILES "${SUNSHINE_ASSETS_DIR}/sunshine.conf" DESTINATION "${SUNSHINE_CONFIG_DIR}") | ||
| install(FILES "${SUNSHINE_ASSETS_DIR}/apps_linux.json" DESTINATION "${SUNSHINE_CONFIG_DIR}") | ||
| install(FILES "${SUNSHINE_ASSETS_DIR}/85-sunshine-rules.rules" DESTINATION "/etc/udev/rules.d") | ||
| install(TARGETS sunshine RUNTIME DESTINATION "/usr/bin") | ||
| install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "/usr/lib/systemd/user") | ||
| install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/shaders/opengl" DESTINATION "${SUNSHINE_CONFIG_DIR}/shaders") | ||
| # Pre and post install | ||
| set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA | ||
| "${SUNSHINE_ASSETS_DIR}/linux-deb/preinst;${SUNSHINE_ASSETS_DIR}/linux-deb/postinst;${SUNSHINE_ASSETS_DIR}/linux-deb/conffiles") | ||
| set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${SUNSHINE_ASSETS_DIR}/linux-deb/preinst") | ||
| set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${SUNSHINE_ASSETS_DIR}/linux-deb/postinst") | ||
ReenigneArcher marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # Dependencies | ||
| set(CPACK_DEB_COMPONENT_INSTALL ON) | ||
| set(CPACK_DEBIAN_PACKAGE_DEPENDS "libssl1.1, 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 "libssl==1.1, libavdevice>=58, libboost-thread>=1.67.0, libboost-filesystem>=1.67.0, libboost-log>=1.67.0, libpulse>=0, libopus>=0, libxcb-shm>=0, libxcb-xfixes>=0, libxtst>=0, libevdev>=2.0, libdrm>=2.0, libcap>=2.0") | ||
| set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # This should automatically figure out dependencies, doesn't work with the current config | ||
| # Installation destination dir | ||
| set(CPACK_SET_DESTDIR true) | ||
| set(CMAKE_INSTALL_PREFIX "/etc/sunshine") | ||
| endif() | ||
| include(CPack) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add new line at end of files | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /etc/sunshine/sunshine.conf | ||
ReenigneArcher marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /etc/sunshine/apps_linux.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/bin/sh | ||
| export GROUP_INPUT=input | ||
| if [ -f /etc/group ]; then | ||
| if ! grep -q $GROUP_INPUT /etc/group; then | ||
| echo "Creating group $GROUP_INPUT" | ||
| groupadd $GROUP_INPUT | ||
| fi | ||
| else | ||
| echo "Warning: /etc/group not found" | ||
| fi | ||
| if [ -f /etc/sunshine/sunshine.conf.old ]; then | ||
| echo "Restoring old sunshine.conf" | ||
| mv /etc/sunshine/sunshine.conf.old /etc/sunshine/sunshine.conf | ||
| fi | ||
| if [ -f /etc/sunshine/apps_linux.json.old ]; then | ||
| echo "Restoring old apps_linux.json" | ||
| mv /etc/sunshine/apps_linux.json.old /etc/sunshine/apps_linux.json | ||
| fi | ||
| # Update permissions on config files for Web Manager | ||
| if [ -f /etc/sunshine/apps_linux.json ]; then | ||
| echo "chmod 666 /etc/sunshine/apps_linux.json" | ||
| chmod 666 /etc/sunshine/apps_linux.json | ||
| fi | ||
| if [ -f /etc/sunshine/sunshine.conf ]; then | ||
| echo "chmod 666 /etc/sunshine/sunshine.conf" | ||
| chmod 666 /etc/sunshine/sunshine.conf | ||
| fi | ||
| # Ensure Sunshine can grab images from KMS | ||
| path_to_setcap=$(which setcap) | ||
| if [ -x "$path_to_setcap" ] ; then | ||
| echo "$path_to_setcap cap_sys_admin+p /usr/bin/sunshine" | ||
| $path_to_setcap cap_sys_admin+p $(readlink -f /usr/bin/sunshine) | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/sh | ||
| #Store backup for old config files to prevent it from being overwritten | ||
| if [ -f /etc/sunshine/sunshine.conf ]; then | ||
| cp /etc/sunshine/sunshine.conf /etc/sunshine/sunshine.conf.old | ||
| fi | ||
| if [ -f /etc/sunshine/apps_linux.json ]; then | ||
| cp /etc/sunshine/apps_linux.json /etc/sunshine/apps_linux.json.old | ||
| fi |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this needs to change to prevent this (same with start menu entry).