1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-25 04:02:50 +01:00

Add basic .dmg bundle support

This commit is contained in:
Elias Steurer 2023-02-09 16:35:08 +01:00
parent c9556f08d2
commit 8b10e5989f
5 changed files with 43 additions and 14 deletions

View File

@ -35,6 +35,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
option(OSX_BUNDLE "Enable distribution macOS bundle" OFF)
# This is needed for OSX: Because we bundle ScreenPlay and ScreenPlayWallpaper into .app they both need other QML dependencies like
# ScreenPlayUtil. The fastest way is to use a shared QML module path for development and add this path to the qml engines import pah. For
# the SCREENPLAY_DEPLOY we copy them into the matching dirs via the build.py
@ -113,6 +115,7 @@ if(UNIX AND NOT APPLE)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FetchContentThirdParty.cmake)
add_subdirectory(CMake)
add_subdirectory(ScreenPlay)
add_subdirectory(ScreenPlaySDK)
@ -138,7 +141,7 @@ if(WIN32)
add_subdirectory(ScreenPlaySysInfo)
endif()
if(${SCREENPLAY_INSTALLER})
if(${SCREENPLAY_INSTALLER} AND NOT APPLE)
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateIFWInstaller.cmake)
endif()

View File

@ -320,7 +320,7 @@ if(${SCREENPLAY_TESTS})
endif()
endif()
if(APPLE)
if(APPLE AND NOT OSX_BUNDLE)
set_source_files_properties(
${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/Resources/translations")
else()
@ -371,7 +371,31 @@ if(WIN32)
endif()
if(APPLE)
if(APPLE AND OSX_BUNDLE)
# Set the installation destination
install(TARGETS "ScreenPlay" DESTINATION /Applications)
include(InstallRequiredSystemLibraries)
set(CPACK_GENERATOR "Bundle")
set(CPACK_BINARY_DRAGNDROP ON)
set(CPACK_BUNDLE_NAME "ScreenPlay")
set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/icons/app.ico")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/icons/app.ico")
set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist")
set(CPACK_BUNDLE_APPLE_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/entitlements.plist")
set(CPACK_PACKAGE_FILE_NAME "ScreenPlay-0.15")
include(CPack)
# Install all files from /bin
install(
DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
COMPONENT ScreenPlay
DESTINATION "./")
endif()
if(APPLE AND NOT OSX_BUNDLE)
# Creates a ScreenPlay.app
set_target_properties(
${PROJECT_NAME}

View File

@ -92,15 +92,17 @@ endif()
if(APPLE)
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework Cocoa")
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/index.html
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/)
set_target_properties(${PROJECT_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/"
)
if(NOT OSX_BUNDLE)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/index.html
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/)
set_target_properties(${PROJECT_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/"
)
endif()
endif()
if(WIN32)

View File

@ -76,7 +76,7 @@ if(WIN32)
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
endif()
if(APPLE)
if(APPLE AND NOT OSX_BUNDLE)
set_target_properties(${PROJECT_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/"

View File

@ -122,7 +122,7 @@ qt_add_qml_module(
${RESOURCES})
if(${SCREENPLAY_STEAM})
if(APPLE)
if(APPLE AND NOT OSX_BUNDLE)
set(MACOS_FRAMEWORKS_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ScreenPlay.app/Contents/MacOS/)
file(MAKE_DIRECTORY ${MACOS_FRAMEWORKS_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${MACOS_FRAMEWORKS_DIR} COPYONLY)