1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Elias Steurer 2022-07-15 13:08:23 +02:00
commit 29ca12fc6e
4 changed files with 336 additions and 320 deletions

View File

@ -14,17 +14,20 @@ elseif(UNIX AND NOT APPLE)
set(VCPKG_ARCH "x64-linux") set(VCPKG_ARCH "x64-linux")
elseif(APPLE) elseif(APPLE)
# CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host. # CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
# Universal builds are not available with vcpkg,
# but the prebuild Qt binaries are. CMake also handles
# https://github.com/microsoft/vcpkg/discussions/19454
# This means we must compile twice and then merge the binaries with lipo
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64) if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
set(VCPKG_ARCH "x64-osx") set(VCPKG_ARCH "x64-osx")
set(CMAKE_OSX_ARCHITECTURES "x86_64")
set(VCPKG_TARGET_ARCHITECTURE x86_64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL arm) elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL arm)
set(VCPKG_ARCH "arm64-osx") set(VCPKG_ARCH "arm64-osx")
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(VCPKG_TARGET_ARCHITECTURE arm64)
endif() endif()
# Universal builds are not available with vcpkg,
# but the prebuild Qt binaries are.
# https://github.com/microsoft/vcpkg/discussions/19454
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
set(VCPKG_TARGET_ARCHITECTURE x86_64 arm64)
message(STATUS "[PROJECT] CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}") message(STATUS "[PROJECT] CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
endif() endif()

View File

@ -43,7 +43,6 @@ set(HEADER
inc/public/ScreenPlayUtil/AutoPropertyHelpers.h inc/public/ScreenPlayUtil/AutoPropertyHelpers.h
inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h
inc/public/ScreenPlayUtil/contenttypes.h inc/public/ScreenPlayUtil/contenttypes.h
#inc/public/ScreenPlayUtil/EnumClassHelper.h
inc/public/ScreenPlayUtil/HelpersCommon.h inc/public/ScreenPlayUtil/HelpersCommon.h
inc/public/ScreenPlayUtil/httpfileserver.h inc/public/ScreenPlayUtil/httpfileserver.h
inc/public/ScreenPlayUtil/ListPropertyHelper.h inc/public/ScreenPlayUtil/ListPropertyHelper.h

View File

@ -46,7 +46,8 @@ MacWindow::MacWindow(
workingDir.cdUp(); workingDir.cdUp();
workingDir.cdUp(); workingDir.cdUp();
// OSX Development workaround: // OSX Development workaround:
// // This folder needs then to be copied into the .app/Contents/MacOS/
// for the deploy version.
m_window.engine()->addImportPath(workingDir.path()+"/qml"); m_window.engine()->addImportPath(workingDir.path()+"/qml");
#endif #endif

View File

@ -7,12 +7,14 @@ import shutil
import argparse import argparse
import time import time
import zipfile import zipfile
from shutil import copytree
from pathlib import Path from pathlib import Path
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
from datetime import datetime from datetime import datetime
SCREENPLAY_VERSION = "0.15.0-RC1" SCREENPLAY_VERSION = "0.15.0-RC1"
def zipdir(path, ziph): def zipdir(path, ziph):
# ziph is zipfile handle # ziph is zipfile handle
for root, dirs, files in os.walk(path): for root, dirs, files in os.walk(path):
@ -77,15 +79,16 @@ def run(cmd, cwd=Path.cwd()):
def build( def build(
qt_version, qt_version: str,
qt_ifw_version, qt_ifw_version: str,
build_steam, build_steam: str,
build_tests, build_tests: str,
build_release, build_release: str,
create_installer, create_installer: str,
build_type, build_type: str,
sign_build, sign_build: str,
use_aqt use_aqt: bool,
build_architecture: str
): ):
# Make sure the script is always started from the same folder # Make sure the script is always started from the same folder
@ -104,16 +107,15 @@ def build(
f"aqt path does not exist at {aqt_path}. Please make sure you have installed aqt.") f"aqt path does not exist at {aqt_path}. Please make sure you have installed aqt.")
exit(2) exit(2)
deploy_command = "" deploy_command: str = ""
executable_file_ending="" executable_file_ending: str = ""
qt_path = "" qt_path: str = ""
aqt_install_qt_packages = "" aqt_install_qt_packages: str = ""
aqt_install_tool_packages = "" aqt_install_tool_packages: str = ""
cmake_target_triplet = "" cmake_target_triplet: str = ""
file_endings = [".ninja_deps", ".ninja", ".ninja_log", ".lib", ".a", ".exp", file_endings = [".ninja_deps", ".ninja", ".ninja_log", ".lib", ".a", ".exp",
".manifest", ".cmake", ".cbp", "CMakeCache.txt"] ".manifest", ".cmake", ".cbp", "CMakeCache.txt"]
if platform.system() == "Windows": if platform.system() == "Windows":
cmake_target_triplet = "x64-windows" cmake_target_triplet = "x64-windows"
windows_msvc = "msvc2019_64" windows_msvc = "msvc2019_64"
@ -130,7 +132,7 @@ def build(
aqt_install_tool_packages = "windows desktop tools_ifw" aqt_install_tool_packages = "windows desktop tools_ifw"
elif platform.system() == "Darwin": elif platform.system() == "Darwin":
if(platform.processor() == "arm"): if(build_architecture == "arm64"):
cmake_target_triplet = "arm64-osx" cmake_target_triplet = "arm64-osx"
else: else:
cmake_target_triplet = "x64-osx" cmake_target_triplet = "x64-osx"
@ -159,7 +161,6 @@ def build(
raise NotImplementedError( raise NotImplementedError(
"Unsupported platform, ScreenPlay only supports Windows, macOS and Linux.") "Unsupported platform, ScreenPlay only supports Windows, macOS and Linux.")
# Default to QtMaintainance installation. # Default to QtMaintainance installation.
if use_aqt: if use_aqt:
print(f"qt_path: {qt_path}.") print(f"qt_path: {qt_path}.")
@ -177,7 +178,14 @@ def build(
print( print(
f"Starting build with type {build_type}. Qt Version: {qt_version}. Root path: {root_path}") f"Starting build with type {build_type}. Qt Version: {qt_version}. Root path: {root_path}")
CMAKE_OSX_ARCHITECTURES: str = ""
# The entire parameter should be optional. We need this to explicity build
# x84 and arm version seperat, only because we cannot compile two at once with vcpkg
if build_architecture:
CMAKE_OSX_ARCHITECTURES = f"-DCMAKE_OSX_ARCHITECTURES={build_architecture}"
cmake_configure_command = f'cmake ../ \ cmake_configure_command = f'cmake ../ \
{CMAKE_OSX_ARCHITECTURES} \
-DCMAKE_PREFIX_PATH={qt_path} \ -DCMAKE_PREFIX_PATH={qt_path} \
-DCMAKE_BUILD_TYPE={build_type} \ -DCMAKE_BUILD_TYPE={build_type} \
-DVCPKG_TARGET_TRIPLET={cmake_target_triplet} \ -DVCPKG_TARGET_TRIPLET={cmake_target_triplet} \
@ -264,7 +272,7 @@ def build(
print("Not executing deploy commands due to missing dependencies.") print("Not executing deploy commands due to missing dependencies.")
# Post-build # Post-build
if platform.system() == "Darwin" and sign_build: if platform.system() == "Darwin" and sign_build == "ON":
run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --entitlements \"../../ScreenPlay/entitlements.plist\" --deep \"ScreenPlay.app/\"", cwd=bin_dir) run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --entitlements \"../../ScreenPlay/entitlements.plist\" --deep \"ScreenPlay.app/\"", cwd=bin_dir)
run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWallpaper.app/\"", cwd=bin_dir) run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlayWallpaper.app/\"", cwd=bin_dir)
@ -282,6 +290,12 @@ def build(
run("spctl --assess --verbose \"ScreenPlayWallpaper.app/\"", cwd=bin_dir) run("spctl --assess --verbose \"ScreenPlayWallpaper.app/\"", cwd=bin_dir)
run("spctl --assess --verbose \"ScreenPlayWidget.app/\"", cwd=bin_dir) run("spctl --assess --verbose \"ScreenPlayWidget.app/\"", cwd=bin_dir)
# Copy qml dir into all .app/Contents/MacOS/
if platform.system() == "Darwin":
copytree(Path.joinpath(bin_dir, "qml"), Path.joinpath(bin_dir, "ScreenPlay.app/Contents/MacOS/qml"))
copytree(Path.joinpath(bin_dir, "qml"), Path.joinpath(bin_dir, "ScreenPlayWallpaper.app/Contents/MacOS/qml"))
copytree(Path.joinpath(bin_dir, "qml"), Path.joinpath(bin_dir, "ScreenPlayWidget.app/Contents/MacOS/qml"))
# 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.system() == "Windows": if platform.system() == "Windows":
@ -304,7 +318,7 @@ def build(
print("Running cpack at: ", os.getcwd()) print("Running cpack at: ", os.getcwd())
run("cpack", cwd=build_folder) run("cpack", cwd=build_folder)
# We also need to sign the installer in osx: # We also need to sign the installer in osx:
if platform.system() == "Darwin" and sign_build: if platform.system() == "Darwin" and sign_build == "ON":
run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlay-Installer.dmg/ScreenPlay-Installer.app/Contents/MacOS/ScreenPlay-Installer\"", cwd=build_folder) run("codesign --deep -f -s \"Developer ID Application: Elias Steurer (V887LHYKRH)\" --timestamp --options \"runtime\" -f --deep \"ScreenPlay-Installer.dmg/ScreenPlay-Installer.app/Contents/MacOS/ScreenPlay-Installer\"", cwd=build_folder)
run("codesign --verify --verbose=4 \"ScreenPlay-Installer.dmg/ScreenPlay-Installer.app/Contents/MacOS/ScreenPlay-Installer\"", cwd=build_folder) run("codesign --verify --verbose=4 \"ScreenPlay-Installer.dmg/ScreenPlay-Installer.app/Contents/MacOS/ScreenPlay-Installer\"", cwd=build_folder)
run("xcnotary notarize ScreenPlay-Installer.dmg/ScreenPlay-Installer.app -d kelteseth@gmail.com -k ScreenPlay", cwd=build_folder) run("xcnotary notarize ScreenPlay-Installer.dmg/ScreenPlay-Installer.app -d kelteseth@gmail.com -k ScreenPlay", cwd=build_folder)
@ -351,6 +365,8 @@ if __name__ == "__main__":
help="Create a installer.") help="Create a installer.")
parser.add_argument('-release', action="store_true", dest="build_release", parser.add_argument('-release', action="store_true", dest="build_release",
help="Create a release version of ScreenPlay for sharing with the world. This is not about debug/release build, but the c++ define SCREENPLAY_RELEASE.") help="Create a release version of ScreenPlay for sharing with the world. This is not about debug/release build, but the c++ define SCREENPLAY_RELEASE.")
parser.add_argument('-architecture', action="store", dest="build_architecture",
help="Sets the build architecture. Used to build x86 and ARM osx versions. Currently only works with x86_64 and arm64")
args = parser.parse_args() args = parser.parse_args()
qt_version = "6.3.0" qt_version = "6.3.0"
@ -366,10 +382,6 @@ if __name__ == "__main__":
qt_ifw_version = args.qt_installer_version_overwrite qt_ifw_version = args.qt_installer_version_overwrite
print("Using Qt installer framework version {qt_ifw_version}") print("Using Qt installer framework version {qt_ifw_version}")
if args.build_steam and not args.build_release:
print("Steam Builds must have release option enabled via -release")
exit(4)
if not args.build_type: if not args.build_type:
print("Build type argument is missing (release, debug). E.g: python build.py -type release -steam") print("Build type argument is missing (release, debug). E.g: python build.py -type release -steam")
print( print(
@ -406,5 +418,6 @@ if __name__ == "__main__":
create_installer, create_installer,
build_type, build_type,
sign_build, sign_build,
args.use_aqt args.use_aqt,
args.build_architecture
) )