mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-11-18 02:09:49 +00:00
Add config option SUNSHINE_MACOS_PACKAGE
- Refactor UNIX/APPLE packaging
This commit is contained in:
parent
6b64149591
commit
802e5c79fa
@ -151,6 +151,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")
|
set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_FLAGS "-Wno-unknown-pragmas -Wno-misleading-indentation -Wno-class-memaccess")
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
add_compile_definitions(SUNSHINE_PLATFORM="macos")
|
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(/opt/local/lib)
|
||||||
link_directories(/usr/local/lib)
|
link_directories(/usr/local/lib)
|
||||||
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
|
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
|
||||||
@ -560,57 +563,62 @@ 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_DESCRIPTION "CLI tool that allows you to enable/disable the Sunshine service.")
|
||||||
set(CPACK_COMPONENT_SUNSHINESVC_GROUP "Tools")
|
set(CPACK_COMPONENT_SUNSHINESVC_GROUP "Tools")
|
||||||
endif()
|
endif()
|
||||||
if(UNIX)
|
if(APPLE)
|
||||||
# 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}")
|
|
||||||
endif()
|
|
||||||
if(APPLE) # TODO: test
|
|
||||||
|
|
||||||
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}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_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
|
# TODO: bundle doesn't produce a valid .app use cpack -G DragNDrop
|
||||||
set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
|
set(CPACK_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
|
||||||
set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}")
|
set(CPACK_BUNDLE_PLIST "${APPLE_PLIST_FILE}")
|
||||||
set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns")
|
set(CPACK_BUNDLE_ICON "${PROJECT_SOURCE_DIR}/sunshine.icns")
|
||||||
# set(CPACK_BUNDLE_STARTUP_COMMAND "${INSTALL_RUNTIME_DIR}/sunshine")
|
# set(CPACK_BUNDLE_STARTUP_COMMAND "${INSTALL_RUNTIME_DIR}/sunshine")
|
||||||
endif()
|
endif()
|
||||||
if(UNIX AND NOT APPLE)
|
if(APPLE AND SUNSHINE_MACOS_PACKAGE) # TODO
|
||||||
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
set(prefix "${CMAKE_PROJECT_NAME}.app/Contents")
|
||||||
|
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")
|
||||||
|
|
||||||
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.rules" DESTINATION "/etc/udev/rules.d")
|
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()
|
||||||
|
|
||||||
install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
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
|
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
||||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
|
||||||
"${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
|
if(APPLE)
|
||||||
set(CPACK_DEB_COMPONENT_INSTALL ON)
|
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
||||||
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")
|
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
|
||||||
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")
|
else()
|
||||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # This should automatically figure out dependencies, doesn't work with the current config
|
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.rules" DESTINATION "/etc/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()
|
endif()
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
Loading…
Reference in New Issue
Block a user