1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Add copy step

This commit is contained in:
Elias Steurer 2021-03-13 16:17:56 +01:00
parent 0e97e805d2
commit 5dcf6a83fd
6 changed files with 53 additions and 57 deletions

View File

@ -81,46 +81,12 @@ if(WIN32)
add_subdirectory(ScreenPlaySysInfo) add_subdirectory(ScreenPlaySysInfo)
endif() endif()
#if(APPLE)
#add_custom_target(CopyDependencies DEPENDS ScreenPlay)
#add_custom_command(TARGET CopyDependencies POST_BUILD
# COMMAND "ScreenPlayWallpaper" -E copy_directory
# "$<TARGET_FILE:ScreenPlayWallpaper>"
# "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/$<TARGET_FILE_NAME:ScreenPlayWallpaper>/"
# COMMENT "Copying into ScreenPlay.app bundle")
#endif()
if(APPLE)
# To Create a package, one can run "cpack -G DragNDrop CPackConfig.cmake" on Mac OS X
# ~/Qt/Tools/CMake/CMake.app/Contents/bin/cpack
# where CPackConfig.cmake is created by including CPack
# And then there's ways to customize this as well
set(CPACK_BINARY_DRAGNDROP ON)
set(CPACK_PACKAGE_NAME "ScreenPlay")
set(CPACK_PACKAGE_VENDOR "ScreenPlay")
set(CPACK_GENERATOR "DragNDrop")#;TGZ;productbuild
set(CPACK_DMG_FORMAT "UDBZ")
set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
set(CPACK_SYSTEM_NAME "OSX")
set(EXECUTABLE "${PROJECT_NAME}.app")
install(TARGETS ScreenPlay
RUNTIME
DESTINATION bin
COMPONENT applications)
install(TARGETS ScreenPlayWallpaper
RUNTIME
DESTINATION bin
COMPONENT applications)
install(TARGETS ScreenPlayWidget
RUNTIME
DESTINATION bin
COMPONENT applications)
# This must always be last!
include(CPack)
endif()

View File

@ -131,4 +131,18 @@ target_link_libraries(
target_include_directories(${PROJECT_NAME} PRIVATE ${QT_TELEMTRY_INCLUDE}) target_include_directories(${PROJECT_NAME} PRIVATE ${QT_TELEMTRY_INCLUDE})
if(APPLE)
# Creates a ScreenPlay.app
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}
MACOSX_BUNDLE TRUE
MACOSX_RPATH TRUE
MACOSX_FRAMEWORK_IDENTIFIER screen-play.app
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@loader_path/Libraries"
RESOURCE "${RESOURCE_FILES}"
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME TRUE
XCODE_ATTRIBUTE_EXECUTABLE_NAME ${PROJECT_NAME}
)
endif()

View File

@ -174,18 +174,8 @@ void Settings::setupWidgetAndWindowPaths()
{ {
QDir workingDir(QGuiApplication::applicationDirPath()); QDir workingDir(QGuiApplication::applicationDirPath());
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
#endif
m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget" + ScreenPlayUtil::executableEnding())); m_globalVariables->setWidgetExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWidget" + ScreenPlayUtil::executableEnding()));
m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + ScreenPlayUtil::executableEnding())); m_globalVariables->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + ScreenPlayUtil::executableEnding()));
#if defined(Q_OS_OSX)
// MACOS bundle
//m_globalVariables->setWidgetExecutablePath(QUrl::fromUserInput(workingDir.path() + "ScreenPlayWidget.app/Contents/MacOS/ScreenPlayWidget").toLocalFile());
//m_globalVariables->setWallpaperExecutablePath(QUrl::fromUserInput(workingDir.path() + "ScreenPlayWallpaper.app/Contents/MacOS/ScreenPlayWallpaper").toLocalFile());
#endif
} }
/*! /*!

View File

@ -40,8 +40,18 @@ file(MAKE_DIRECTORY ${DESTDIR})
configure_file(qmldir ${DESTDIR} COPYONLY) configure_file(qmldir ${DESTDIR} COPYONLY)
# Copies ScreenPlayShader.* into qt qml plugins folder if(APPLE)
add_custom_command( add_custom_command(TARGET ${PROJECT_NAME}
TARGET ${PROJECT_NAME} POST_BUILD
POST_BUILD COMMENT "Copying into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlayShader> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlayShader>) COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/$<TARGET_FILE_NAME:${PROJECT_NAME}>
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/$<TARGET_FILE_NAME:${PROJECT_NAME}>)
else()
# Copies ScreenPlayShader.* into qt qml plugins folder
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:ScreenPlayShader>
${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlayShader>)
endif()

View File

@ -44,3 +44,11 @@ endif()
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine ScreenPlaySDK ScreenPlayUtil) target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine ScreenPlaySDK ScreenPlayUtil)
if(APPLE)
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMENT "Copying into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${PROJECT_NAME}
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/${PROJECT_NAME})
endif()

View File

@ -32,3 +32,11 @@ if(APPLE)
endif() endif()
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core ScreenPlaySDK) target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core ScreenPlaySDK)
if(APPLE)
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMENT "Copying into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/${PROJECT_NAME}
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/${PROJECT_NAME})
endif()