1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-02 00:29:48 +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")
elseif(APPLE)
# 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)
set(VCPKG_ARCH "x64-osx")
set(CMAKE_OSX_ARCHITECTURES "x86_64")
set(VCPKG_TARGET_ARCHITECTURE x86_64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL arm)
set(VCPKG_ARCH "arm64-osx")
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(VCPKG_TARGET_ARCHITECTURE arm64)
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}")
endif()

View File

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

View File

@ -46,7 +46,8 @@ MacWindow::MacWindow(
workingDir.cdUp();
workingDir.cdUp();
// 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");
#endif

View File

@ -7,12 +7,14 @@ import shutil
import argparse
import time
import zipfile
from shutil import copytree
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
SCREENPLAY_VERSION = "0.15.0-RC1"
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
@ -77,15 +79,16 @@ def run(cmd, cwd=Path.cwd()):
def build(
qt_version,
qt_ifw_version,
build_steam,
build_tests,
build_release,
create_installer,
build_type,
sign_build,
use_aqt
qt_version: str,
qt_ifw_version: str,
build_steam: str,
build_tests: str,
build_release: str,
create_installer: str,
build_type: str,
sign_build: str,
use_aqt: bool,
build_architecture: str
):
# Make sure the script is always started from the same folder
@ -95,7 +98,7 @@ def build(
print(f"Change root directory to: {root_path}")
os.chdir(root_path)
aqt_path=""
aqt_path = ""
if use_aqt:
aqt_path = Path(f"{root_path}/../aqt/").resolve()
@ -104,16 +107,15 @@ def build(
f"aqt path does not exist at {aqt_path}. Please make sure you have installed aqt.")
exit(2)
deploy_command = ""
executable_file_ending=""
qt_path = ""
aqt_install_qt_packages = ""
aqt_install_tool_packages = ""
cmake_target_triplet = ""
deploy_command: str = ""
executable_file_ending: str = ""
qt_path: str = ""
aqt_install_qt_packages: str = ""
aqt_install_tool_packages: str = ""
cmake_target_triplet: str = ""
file_endings = [".ninja_deps", ".ninja", ".ninja_log", ".lib", ".a", ".exp",
".manifest", ".cmake", ".cbp", "CMakeCache.txt"]
if platform.system() == "Windows":
cmake_target_triplet = "x64-windows"
windows_msvc = "msvc2019_64"
@ -130,7 +132,7 @@ def build(
aqt_install_tool_packages = "windows desktop tools_ifw"
elif platform.system() == "Darwin":
if(platform.processor() == "arm"):
if(build_architecture == "arm64"):
cmake_target_triplet = "arm64-osx"
else:
cmake_target_triplet = "x64-osx"
@ -159,7 +161,6 @@ def build(
raise NotImplementedError(
"Unsupported platform, ScreenPlay only supports Windows, macOS and Linux.")
# Default to QtMaintainance installation.
if use_aqt:
print(f"qt_path: {qt_path}.")
@ -172,12 +173,19 @@ def build(
# Prepare
cmake_toolchain_file = f"'{root_path}/../ScreenPlay-vcpkg/scripts/buildsystems/vcpkg.cmake'"
ifw_root_path=f"{qt_path}\\Tools\\QtInstallerFramework\\{qt_ifw_version}"
ifw_root_path = f"{qt_path}\\Tools\\QtInstallerFramework\\{qt_ifw_version}"
print(f"cmake_toolchain_file: {cmake_toolchain_file}")
print(
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_OSX_ARCHITECTURES} \
-DCMAKE_PREFIX_PATH={qt_path} \
-DCMAKE_BUILD_TYPE={build_type} \
-DVCPKG_TARGET_TRIPLET={cmake_target_triplet} \
@ -264,7 +272,7 @@ def build(
print("Not executing deploy commands due to missing dependencies.")
# 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 --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 \"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.
# Lets just copy all of them into bin.
if platform.system() == "Windows":
@ -304,7 +318,7 @@ def build(
print("Running cpack at: ", os.getcwd())
run("cpack", cwd=build_folder)
# 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 --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)
@ -351,6 +365,8 @@ if __name__ == "__main__":
help="Create a installer.")
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.")
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()
qt_version = "6.3.0"
@ -366,10 +382,6 @@ if __name__ == "__main__":
qt_ifw_version = args.qt_installer_version_overwrite
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:
print("Build type argument is missing (release, debug). E.g: python build.py -type release -steam")
print(
@ -393,7 +405,7 @@ if __name__ == "__main__":
if args.create_installer:
create_installer = "ON"
sign_build ="OFF"
sign_build = "OFF"
if args.sign_build:
sign_build = "ON"
@ -406,5 +418,6 @@ if __name__ == "__main__":
create_installer,
build_type,
sign_build,
args.use_aqt
args.use_aqt,
args.build_architecture
)