feat: basic OSX .app generation

added default brew link libraries path
This commit is contained in:
ABeltramo 2022-04-23 15:13:27 +01:00
parent 2ea414d1d4
commit ffdcf0fea8
No known key found for this signature in database
GPG Key ID: 47465B9E2C4FE0C2
2 changed files with 26 additions and 14 deletions

View File

@ -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)
@ -452,21 +452,35 @@ target_compile_options(sunshine PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COM
####
# Add all assets dependencies
install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/web" DESTINATION ".")
install(FILES "${SUNSHINE_ASSETS_DIR}/sunshine.conf" DESTINATION ".")
if(WIN32) # TODO: test
install(TARGETS sunshine RUNTIME DESTINATION ".")
install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/web" DESTINATION ".")
install(FILES "${SUNSHINE_ASSETS_DIR}/sunshine.conf" DESTINATION ".")
install(FILES "${SUNSHINE_ASSETS_DIR}/apps_windows.json" DESTINATION ".")
install(DIRECTORY "${SUNSHINE_ASSETS_DIR}/shaders/directx" DESTINATION "shaders")
endif()
if(APPLE) # TODO: test
install(TARGETS sunshine RUNTIME DESTINATION ".")
install(FILES "${SUNSHINE_ASSETS_DIR}/apps_mac.json" DESTINATION ".")
# TODO: info.plist ??
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 ".")
install(FILES "${SUNSHINE_ASSETS_DIR}/sunshine.conf" DESTINATION ".")
install(FILES "${SUNSHINE_ASSETS_DIR}/apps_linux.json" DESTINATION ".")
install(FILES "${SUNSHINE_ASSETS_DIR}/85-sunshine-rules.rules" DESTINATION "/etc/udev/rules.d")
install(TARGETS sunshine RUNTIME DESTINATION "/usr/bin")
@ -499,10 +513,8 @@ set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${VERSION}_${CPACK_DEBIAN_PAC
set(CPACK_STRIP_FILES YES)
# Installation destination dir
if(NOT WIN32)
set(CPACK_SET_DESTDIR true)
endif()
if(UNIX AND NOT APPLE)
set(CPACK_SET_DESTDIR true)
set(CMAKE_INSTALL_PREFIX "/etc/sunshine")
endif()

BIN
sunshine.icns Normal file

Binary file not shown.