1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Elias Steurer 2021-12-23 13:41:19 +01:00
commit c2459bf4de
5 changed files with 36 additions and 40 deletions

View File

@ -209,11 +209,8 @@ void App::init()
} }
qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this); qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this);
QGuiApplication::instance()->addLibraryPath(QGuiApplication::instance()->applicationDirPath());
#ifdef Q_OS_MACOS
// Needed for macos .app files
m_mainWindowEngine->addPluginPath(QGuiApplication::instance()->applicationDirPath());
#endif
m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/ScreenPlay/main.qml"))); m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/ScreenPlay/main.qml")));
// Must be called last to display a error message on startup by the qml engine // Must be called last to display a error message on startup by the qml engine

View File

@ -64,7 +64,6 @@
#include <memory> #include <memory>
#include <sentry.h> #include <sentry.h>
class ScreenPlayWorkshopPlugin;
namespace ScreenPlay { namespace ScreenPlay {
@ -217,7 +216,6 @@ public slots:
} }
private: private:
QPluginLoader m_workshopPlugin;
QNetworkAccessManager m_networkAccessManager; QNetworkAccessManager m_networkAccessManager;
QElapsedTimer m_continuousIntegrationMetricsTimer; QElapsedTimer m_continuousIntegrationMetricsTimer;
std::unique_ptr<QQmlApplicationEngine> m_mainWindowEngine; std::unique_ptr<QQmlApplicationEngine> m_mainWindowEngine;

View File

@ -71,6 +71,7 @@ target_link_libraries(
if(APPLE) if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework Cocoa") target_link_libraries(${PROJECT_NAME} PRIVATE "-framework Cocoa")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${PROJECT_NAME}.app/Contents/MacOS/)
add_custom_command( add_custom_command(
TARGET ${PROJECT_NAME} TARGET ${PROJECT_NAME}
POST_BUILD POST_BUILD

View File

@ -42,6 +42,7 @@ if(WIN32)
set(STEAM_BIN "${STEAM_LIB_PATH}/win64/steam_api64.dll") set(STEAM_BIN "${STEAM_LIB_PATH}/win64/steam_api64.dll")
elseif(APPLE) elseif(APPLE)
set(WORKSHOP_PLUGIN_DIR ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/Workshop) set(WORKSHOP_PLUGIN_DIR ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/Workshop)
set(MACOS_FRAMEWORKS_DIR ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/Frameworks/)
set(STEAM_LIB "${STEAM_LIB_PATH}/osx/libsteam_api.dylib") set(STEAM_LIB "${STEAM_LIB_PATH}/osx/libsteam_api.dylib")
set(STEAM_BIN ${STEAM_LIB}) set(STEAM_BIN ${STEAM_LIB})
elseif(UNIX) elseif(UNIX)
@ -50,37 +51,34 @@ elseif(UNIX)
set(STEAM_BIN ${STEAM_LIB}) set(STEAM_BIN ${STEAM_LIB})
endif() endif()
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADER})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick ${STEAM_LIB} ScreenPlayUtil SteamSDK)
qt_add_qml_module( qt_add_qml_module(
${PROJECT_NAME} ${PROJECT_NAME}
OUTPUT_DIRECTORY ${WORKSHOP_PLUGIN_DIR} OUTPUT_DIRECTORY
${WORKSHOP_PLUGIN_DIR}
URI "Workshop" URI "Workshop"
SOURCES ${SOURCES} ${HEADER} SOURCES ${SOURCES} ${HEADER}
VERSION 1.0) VERSION 1.0)
if(APPLE)
if(${SCREENPLAY_STEAM})
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMENT "Copying steam_appid.txt into ScreenPlay.app bundle. This is for development only!"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/)
add_custom_command( if(${SCREENPLAY_STEAM})
TARGET ${PROJECT_NAME} if(APPLE)
POST_BUILD file(MAKE_DIRECTORY ${WORKSHOP_PLUGIN_DIR})
COMMENT "Copying libsteam_api.dylib into ScreenPlay.app bundle." file(MAKE_DIRECTORY ${MACOS_FRAMEWORKS_DIR})
COMMAND ${CMAKE_COMMAND} -E copy ${STEAM_LIB}
${WORKSHOP_PLUGIN_DIR}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/ COPYONLY)
endif() configure_file(${STEAM_BIN} ${WORKSHOP_PLUGIN_DIR} COPYONLY)
else()
if(${SCREENPLAY_STEAM}) set_target_properties(${PROJECT_NAME} PROPERTIES
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${CMAKE_BINARY_DIR}/bin/steam_appid.txt COPYONLY) LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/Workshop)
configure_file(${STEAM_BIN} ${CMAKE_BINARY_DIR}/bin/ COPYONLY) else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${CMAKE_BINARY_DIR}/bin/steam_appid.txt COPYONLY)
configure_file(${STEAM_BIN} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
endif() endif()
endif() endif()
# Needed by the automatic generated target missing includes # Needed by the automatic generated target missing includes
# https://github.com/qt/qtdeclarative/blob/7a7064e14f094e843e1ee832cc927e86f887621a/src/qml/Qt6QmlMacros.cmake#L2042 # https://github.com/qt/qtdeclarative/blob/7a7064e14f094e843e1ee832cc927e86f887621a/src/qml/Qt6QmlMacros.cmake#L2042
target_include_directories(${PROJECT_NAME} PUBLIC src/) target_include_directories(${PROJECT_NAME} PUBLIC src/)

View File

@ -23,6 +23,8 @@ def vs_env_dict():
return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2) return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2)
# Based on https://stackoverflow.com/questions/7207309/how-to-run-functions-in-parallel # Based on https://stackoverflow.com/questions/7207309/how-to-run-functions-in-parallel
def run_io_tasks_in_parallel(tasks): def run_io_tasks_in_parallel(tasks):
with ThreadPoolExecutor() as executor: with ThreadPoolExecutor() as executor:
running_tasks = [executor.submit(task) for task in tasks] running_tasks = [executor.submit(task) for task in tasks]
@ -30,13 +32,12 @@ def run_io_tasks_in_parallel(tasks):
running_task.result() running_task.result()
# MAIN # MAIN
parser = argparse.ArgumentParser(description='Build and Package ScreenPlay') parser = argparse.ArgumentParser(description='Build and Package ScreenPlay')
parser.add_argument('-t', action="store", dest="build_type", parser.add_argument('-t', action="store", dest="build_type",
help="Build type. This is either debug or release.") help="Build type. This is either debug or release.")
parser.add_argument('-sign', action="store", dest="sign_build", parser.add_argument('-sign', action="store", dest="sign_build",
help="Enable if you want to sign the apps. This is macos only for now.") help="Enable if you want to sign the apps. This is macos only for now.")
parser.add_argument('-steam', action="store", dest="steam_build", parser.add_argument('-steam', action="store", dest="steam_build",
help="Enable if you want to build the Steam workshop plugin.") help="Enable if you want to build the Steam workshop plugin.")
args = parser.parse_args() args = parser.parse_args()
@ -48,8 +49,7 @@ if not args.build_type:
qt_version = "6.2.1" qt_version = "6.2.1"
steam_build = "OFF" steam_build = "OFF"
if args.steam_build: if args.steam_build:
if args.steam_build: steam_build = "ON"
steam_build = "ON"
print("Starting build with type %s. Qt Version: %s" % print("Starting build with type %s. Qt Version: %s" %
(args.build_type, qt_version)) (args.build_type, qt_version))
@ -75,7 +75,7 @@ if platform == "win32":
cmake_prefix_path = "c:/Qt/" + qt_version + "/" + windows_msvc cmake_prefix_path = "c:/Qt/" + qt_version + "/" + windows_msvc
cmake_target_triplet = "x64-windows" cmake_target_triplet = "x64-windows"
elif platform == "darwin": elif platform == "darwin":
cmake_prefix_path = "~/Qt/" + qt_version + "/clang_64" cmake_prefix_path = "~/Qt/" + qt_version + "/macos"
deploy_command = "{prefix_path}/bin/macdeployqt {app}.app -qmldir=../../{app}/qml -executable={app}.app/Contents/MacOS/{app}" deploy_command = "{prefix_path}/bin/macdeployqt {app}.app -qmldir=../../{app}/qml -executable={app}.app/Contents/MacOS/{app}"
cmake_target_triplet = "x64-osx" cmake_target_triplet = "x64-osx"
elif platform == "linux": elif platform == "linux":
@ -91,7 +91,8 @@ cmake_toolchain_file = (
"'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'").format(root_path=root_path) "'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'").format(root_path=root_path)
print("cmake_toolchain_file: %s " % cmake_toolchain_file) print("cmake_toolchain_file: %s " % cmake_toolchain_file)
build_folder = root_path + "/build-" + cmake_target_triplet + "-" + args.build_type build_folder = root_path + "/build-" + \
cmake_target_triplet + "-" + args.build_type
if os.path.isdir(build_folder): if os.path.isdir(build_folder):
print("Remove previous build folder: " + build_folder) print("Remove previous build folder: " + build_folder)
@ -140,9 +141,6 @@ execute(deploy_command.format(
executable_file_ending=executable_file_ending)) executable_file_ending=executable_file_ending))
if platform == "darwin" and args.sign_build: if platform == "darwin" and args.sign_build:
print("Remove workshop build folder (macos only).")
shutil.rmtree(build_folder + "/bin/workshop")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --entitlements \"../../ScreenPlay/entitlements.plist\" --deep \"ScreenPlay.app/\"") execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --entitlements \"../../ScreenPlay/entitlements.plist\" --deep \"ScreenPlay.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWallpaper.app/\"") execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWallpaper.app/\"")
execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWidget.app/\"") execute("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWidget.app/\"")
@ -152,9 +150,12 @@ if platform == "darwin" and args.sign_build:
execute("codesign --verify --verbose=4 \"ScreenPlayWidget.app/\"") execute("codesign --verify --verbose=4 \"ScreenPlayWidget.app/\"")
run_io_tasks_in_parallel([ run_io_tasks_in_parallel([
lambda: execute("xcnotary notarize ScreenPlay.app -d kelteseth@gmail.com -k ScreenPlay"), lambda: execute(
lambda: execute("xcnotary notarize ScreenPlayWallpaper.app -d kelteseth@gmail.com -k ScreenPlay"), "xcnotary notarize ScreenPlay.app -d kelteseth@gmail.com -k ScreenPlay"),
lambda: execute("xcnotary notarize ScreenPlayWidget.app -d kelteseth@gmail.com -k ScreenPlay") lambda: execute(
"xcnotary notarize ScreenPlayWallpaper.app -d kelteseth@gmail.com -k ScreenPlay"),
lambda: execute(
"xcnotary notarize ScreenPlayWidget.app -d kelteseth@gmail.com -k ScreenPlay")
]) ])
execute("spctl --assess --verbose \"ScreenPlay.app/\"") execute("spctl --assess --verbose \"ScreenPlay.app/\"")
@ -164,7 +165,8 @@ if platform == "darwin" and args.sign_build:
# Some dlls like openssl do no longer get copied automatically. # Some dlls like openssl do no longer get copied automatically.
# Lets just copy all of them into bin. # Lets just copy all of them into bin.
if platform == "win32": if platform == "win32":
vcpkg_bin_path = os.path.abspath(("{root_path}/../ScreenPlay-vcpkg/installed/x64-windows/bin").format(root_path=root_path)) vcpkg_bin_path = os.path.abspath(
("{root_path}/../ScreenPlay-vcpkg/installed/x64-windows/bin").format(root_path=root_path))
print(vcpkg_bin_path) print(vcpkg_bin_path)
for basename in os.listdir(vcpkg_bin_path): for basename in os.listdir(vcpkg_bin_path):
if basename.endswith('.dll'): if basename.endswith('.dll'):