mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-02 16:49:47 +02:00
Add macos fixes
This commit is contained in:
parent
5658bb9981
commit
2852659e58
@ -79,3 +79,47 @@ add_subdirectory(ScreenPlayUtil)
|
||||
if(WIN32)
|
||||
add_subdirectory(ScreenPlaySysInfo)
|
||||
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()
|
||||
|
@ -85,16 +85,29 @@ endif()
|
||||
add_executable(${PROJECT_NAME} ${src} ${headers} ${resources} ${qml})
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
|
||||
#set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# Icon
|
||||
target_sources(${PROJECT_NAME} PRIVATE ScreenPlay.rc)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry)
|
||||
|
||||
# Disable console window on Windows
|
||||
# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
|
||||
|
||||
# Copy ffmpeg. If the ffmpeg files are missing, start the install_dependencies_XXX for your system!
|
||||
file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/*")
|
||||
foreach(filename ${files})
|
||||
configure_file(${filename} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
|
||||
endforeach()
|
||||
|
||||
configure_file(${VCPKG_INSTALLED_PATH}/tools/sentry-native/crashpad_handler.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts)
|
||||
configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY)
|
||||
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}")
|
||||
@ -113,28 +126,8 @@ target_link_libraries(
|
||||
benchmark::benchmark_main
|
||||
doctest::doctest)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry)
|
||||
endif()
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${QT_TELEMTRY_INCLUDE})
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts)
|
||||
configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY)
|
||||
|
||||
# Copy ffmpeg. If the ffmpeg files are missing, start the install_dependencies_XXX for your system!
|
||||
if(WIN32)
|
||||
|
||||
file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/*")
|
||||
foreach(filename ${files})
|
||||
configure_file(${filename} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
|
||||
endforeach()
|
||||
|
||||
configure_file(${VCPKG_INSTALLED_PATH}/tools/sentry-native/crashpad_handler.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
|
||||
elseif(APPLE)
|
||||
# cmake-format: off
|
||||
# Auto ffmpeg download missing for osx
|
||||
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffmpeg ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
|
||||
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
|
||||
# cmake-format: on
|
||||
endif()
|
||||
|
@ -175,13 +175,16 @@ void Settings::setupWidgetAndWindowPaths()
|
||||
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->setWallpaperExecutablePath(QUrl(workingDir.path() + "/ScreenPlayWallpaper" + ScreenPlayUtil::executableEnding()));
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(Q_OS_OSX)
|
||||
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());
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
|
@ -38,11 +38,9 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
|
||||
#set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core Qt5::WebEngine ScreenPlaySDK ScreenPlayUtil)
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework Cocoa")
|
||||
endif()
|
||||
|
@ -15,6 +15,7 @@ MacWindow::MacWindow(
|
||||
qFatal("Could not parse volume");
|
||||
}
|
||||
setVolume(volumeParsed);
|
||||
setFillMode(fillmode);
|
||||
|
||||
// Ether for one Screen or for all
|
||||
if ((QApplication::screens().length() == activeScreensList.length()) && (activeScreensList.length() != 1)) {
|
||||
@ -28,15 +29,12 @@ MacWindow::MacWindow(
|
||||
//setupWallpaperForMultipleScreens(activeScreensList);
|
||||
}
|
||||
|
||||
qmlRegisterSingletonInstance<MacWindow>("ScreenPlayWallpaper", 1, 0, "Wallpaper", this);
|
||||
|
||||
// WARNING: Setting Window flags must be called *here*!
|
||||
Qt::WindowFlags flags = m_window.flags();
|
||||
m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::Desktop);
|
||||
|
||||
m_window.setResizeMode(QQuickView::ResizeMode::SizeRootObjectToView);
|
||||
m_window.rootContext()->setContextProperty("window", this);
|
||||
// Instead of setting "renderType: Text.NativeRendering" every time
|
||||
|
||||
// we can set it here once :)
|
||||
m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
|
||||
m_window.setSource(QUrl("qrc:/Wallpaper.qml"));
|
||||
|
||||
|
@ -28,7 +28,7 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
|
||||
#set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick Qt5::Gui Qt5::Widgets Qt5::Core ScreenPlaySDK)
|
||||
|
Loading…
Reference in New Issue
Block a user