mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-22 10:42:29 +01:00
Refactor build &ci script to use aqt
Refactor gitlab-ci to inherit base Add defines.py that stores variables like versions Bump Qt version to 6.3.2
This commit is contained in:
parent
09ba827c52
commit
bda6716d3a
@ -2,23 +2,26 @@ stages:
|
||||
- build
|
||||
- check
|
||||
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
QT_VERSION: 6.3.1
|
||||
PYTHON_VERSION: 3.10.1
|
||||
.base_windows_build:
|
||||
before_script:
|
||||
- python -m pip install -U pip wheel
|
||||
- python -m pip install -r Tools/requirements.txt
|
||||
- python Tools/setup.py
|
||||
|
||||
.base_unix_build:
|
||||
before_script:
|
||||
- pip3 install -U pip
|
||||
- pip3 install -r Tools/requirements.txt
|
||||
- python3 Tools/setup.py
|
||||
|
||||
standalone:windows:
|
||||
stage: build
|
||||
extends:
|
||||
- .base_windows_build
|
||||
tags:
|
||||
- windows10
|
||||
script:
|
||||
- python -m pip install -U pip wheel
|
||||
- python -m pip install -U aqtinstall
|
||||
- python -m aqt install-qt -O ../aqt windows desktop $QT_VERSION win64_msvc2019_64 -m all
|
||||
- python -m aqt install-tool -O ../aqt windows desktop tools_ifw
|
||||
- cd Tools
|
||||
- python setup.py
|
||||
- python build.py -type release -use-aqt -installer -deploy
|
||||
- python Tools/build.py -type release -use-aqt -installer -deploy-version
|
||||
artifacts:
|
||||
expire_in: "2 weeks"
|
||||
paths:
|
||||
@ -27,18 +30,14 @@ standalone:windows:
|
||||
|
||||
standalone:osx:
|
||||
stage: build
|
||||
extends:
|
||||
- .base_unix_build
|
||||
tags:
|
||||
- osx
|
||||
script:
|
||||
- pip3 install -U pip
|
||||
- pip3 install aqtinstall
|
||||
- python3 -m aqt install-qt -O ../aqt mac desktop $QT_VERSION clang_64 -m all
|
||||
- python3 -m aqt install-tool -O ../aqt mac desktop tools_ifw
|
||||
- cd Tools
|
||||
- python3 setup.py
|
||||
- python3 build.py -type release -use-aqt -deploy -architecture x64
|
||||
- python3 build.py -type release -use-aqt -deploy -architecture arm64
|
||||
- python3 macos_lipo.py
|
||||
- python3 Tools/build.py -type release -use-aqt -deploy-version -architecture x64
|
||||
- python3 Tools/build.py -type release -use-aqt -deploy-version -architecture arm64
|
||||
- python3 Tools/macos_lipo.py
|
||||
artifacts:
|
||||
expire_in: "2 weeks"
|
||||
paths:
|
||||
@ -46,16 +45,12 @@ standalone:osx:
|
||||
|
||||
steam:windows:
|
||||
stage: build
|
||||
extends:
|
||||
- .base_windows_build
|
||||
tags:
|
||||
- windows10
|
||||
script:
|
||||
- python -m pip install -U pip wheel
|
||||
- python -m pip install -U aqtinstall
|
||||
- python -m aqt install-qt -O ../aqt windows desktop $QT_VERSION win64_msvc2019_64 -m all
|
||||
- python -m aqt install-tool -O ../aqt windows desktop tools_ifw
|
||||
- cd Tools
|
||||
- python setup.py
|
||||
- python build.py -type release -steam -use-aqt -deploy
|
||||
- python Tools/build.py -type release -steam -use-aqt -deploy-version
|
||||
artifacts:
|
||||
expire_in: "2 weeks"
|
||||
paths:
|
||||
@ -63,18 +58,14 @@ steam:windows:
|
||||
|
||||
steam:osx:
|
||||
stage: build
|
||||
extends:
|
||||
- .base_unix_build
|
||||
tags:
|
||||
- osx
|
||||
script:
|
||||
- pip3 install -U pip
|
||||
- pip3 install aqtinstall
|
||||
- python3 -m aqt install-qt -O ../aqt mac desktop $QT_VERSION clang_64 -m all
|
||||
- python3 -m aqt install-tool -O ../aqt mac desktop tools_ifw
|
||||
- cd Tools
|
||||
- python3 setup.py
|
||||
- python3 build.py -type release -steam -use-aqt -deploy -architecture x64
|
||||
- python3 build.py -type release -steam -use-aqt -deploy -architecture arm64
|
||||
- python3 macos_lipo.py
|
||||
- python3 Tools/build.py -type release -steam -use-aqt -deploy-version -architecture x64
|
||||
- python3 Tools/build.py -type release -steam -use-aqt -deploy-version -architecture arm64
|
||||
- python3 Tools/macos_lipo.py
|
||||
artifacts:
|
||||
expire_in: "2 weeks"
|
||||
paths:
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "ScreenPlay/screenplaymanager.h"
|
||||
#include <QScopeGuard>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
|
||||
namespace ScreenPlay {
|
||||
|
||||
/*!
|
||||
|
@ -36,7 +36,8 @@ Rectangle {
|
||||
break
|
||||
case InstalledType.HTMLWallpaper:
|
||||
loader.setSource(
|
||||
"qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", {
|
||||
"qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml",
|
||||
{
|
||||
"url": Qt.resolvedUrl(
|
||||
Wallpaper.projectSourceFileAbsolute)
|
||||
})
|
||||
@ -47,16 +48,18 @@ Rectangle {
|
||||
break
|
||||
case InstalledType.WebsiteWallpaper:
|
||||
loader.setSource(
|
||||
"qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", {
|
||||
"qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml",
|
||||
{
|
||||
"url": Wallpaper.projectSourceFileAbsolute
|
||||
})
|
||||
fadeIn()
|
||||
break
|
||||
case InstalledType.GifWallpaper:
|
||||
loader.setSource("qrc:/qml/ScreenPlayWallpaper/qml/GifWallpaper.qml", {
|
||||
"source": Qt.resolvedUrl(
|
||||
Wallpaper.projectSourceFileAbsolute)
|
||||
})
|
||||
loader.setSource(
|
||||
"qrc:/qml/ScreenPlayWallpaper/qml/GifWallpaper.qml", {
|
||||
"source": Qt.resolvedUrl(
|
||||
Wallpaper.projectSourceFileAbsolute)
|
||||
})
|
||||
fadeIn()
|
||||
break
|
||||
}
|
||||
@ -297,7 +300,8 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "projectSourceFileAbsolute " + Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
|
||||
text: "projectSourceFileAbsolute " + Qt.resolvedUrl(
|
||||
Wallpaper.projectSourceFileAbsolute)
|
||||
font.pointSize: 14
|
||||
}
|
||||
|
||||
@ -346,10 +350,13 @@ Rectangle {
|
||||
text: "imgCover.status " + imgCover.status
|
||||
font.pointSize: 14
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import shutil
|
||||
import argparse
|
||||
import time
|
||||
import zipfile
|
||||
import defines
|
||||
from typing import Tuple
|
||||
from shutil import copytree
|
||||
from pathlib import Path
|
||||
@ -117,8 +118,7 @@ def execute(
|
||||
def setup(build_config: BuildConfig, build_result: BuildResult) -> Tuple[BuildConfig, BuildResult]:
|
||||
|
||||
if build_config.use_aqt:
|
||||
build_config.aqt_path = Path(
|
||||
f"{build_config.root_path}/../aqt/").resolve()
|
||||
build_config.aqt_path = defines.AQT_PATH
|
||||
|
||||
if not Path(build_config.aqt_path).exists():
|
||||
print(
|
||||
@ -386,15 +386,15 @@ if __name__ == "__main__":
|
||||
help="Build tests.")
|
||||
parser.add_argument('-installer', action="store_true", dest="create_installer",
|
||||
help="Create a installer.")
|
||||
parser.add_argument('-deploy', action="store_true", dest="build_deploy",
|
||||
parser.add_argument('-deploy-version', action="store_true", dest="build_deploy",
|
||||
help="Create a deploy version of ScreenPlay for sharing with the world. A not deploy version is for local development only!")
|
||||
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.1"
|
||||
screenplay_version = "0.15.0-RC1"
|
||||
qt_ifw_version = "4.4" # Not yet used.
|
||||
qt_version = defines.QT_VERSION
|
||||
screenplay_version = defines.SCREENPLAY_VERSION
|
||||
qt_ifw_version = defines.QT_IFW_VERSION # Not yet used.
|
||||
qt_version_overwrite: str
|
||||
use_aqt = False
|
||||
|
||||
@ -407,10 +407,10 @@ if __name__ == "__main__":
|
||||
print("Using Qt installer framework version {qt_ifw_version}")
|
||||
|
||||
if not args.build_type:
|
||||
print("Build type argument is missing (release, debug). E.g: python build_config.py -type release -steam")
|
||||
print(
|
||||
f"Defaulting to Qt version: {qt_version}. This can be overwritten via -qt-version 6.5.0")
|
||||
parser.print_help()
|
||||
print("\n\nBuild type argument is missing (release, debug). E.g: python build.py -type release -steam\n\n")
|
||||
exit(1)
|
||||
|
||||
build_type = args.build_type
|
||||
|
||||
build_steam = "OFF"
|
||||
|
@ -9,6 +9,7 @@ from pathlib import Path
|
||||
from macos_lipo import run_lipo, check_fat_binary
|
||||
import platform
|
||||
import paramiko
|
||||
import defines
|
||||
from util import sftp_exists
|
||||
|
||||
if __name__ == "__main__":
|
||||
@ -27,9 +28,9 @@ if __name__ == "__main__":
|
||||
build_result = build.BuildResult()
|
||||
|
||||
build_config = build.BuildConfig()
|
||||
build_config.screenplay_version = "0.15.0-RC2"
|
||||
build_config.qt_version = "6.3.1"
|
||||
build_config.qt_ifw_version = "4.4"
|
||||
build_config.screenplay_version = defines.SCREENPLAY_VERSION
|
||||
build_config.qt_version = defines.QT_VERSION
|
||||
build_config.qt_ifw_version = defines.QT_IFW_VERSION
|
||||
build_config.build_steam = "ON"
|
||||
build_config.build_tests = "OFF"
|
||||
build_config.build_deploy = "ON"
|
||||
|
8
Tools/defines.py
Normal file
8
Tools/defines.py
Normal file
@ -0,0 +1,8 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
VCPKG_VERSION = "e2667a41fc2fc578474e9521d7eb90b769569c83" # Master 07.10.2022
|
||||
QT_VERSION = "6.3.2"
|
||||
QT_IFW_VERSION = "4.4"
|
||||
SCREENPLAY_VERSION = "0.15.0-RC1"
|
||||
AQT_PATH = Path("C:/aqt") if sys.platform == "win32" else Path("~/aqt")
|
@ -2,3 +2,4 @@ pyunpack
|
||||
py7zr
|
||||
cmake-format
|
||||
paramiko
|
||||
aqtinstall
|
115
Tools/setup.py
115
Tools/setup.py
@ -4,14 +4,15 @@ from install_requirements import install_requirements
|
||||
|
||||
install_requirements()
|
||||
|
||||
import argparse
|
||||
import shutil
|
||||
from platform import system
|
||||
from pathlib import Path
|
||||
from execute_util import execute
|
||||
import download_ffmpeg
|
||||
|
||||
vcpkg_version = "98f8d00e89fb6a8019c2045cfa1edbe9d92d3405" # Master 09.07.2022
|
||||
import defines
|
||||
import argparse
|
||||
import sys
|
||||
import util
|
||||
import datetime
|
||||
|
||||
class commands_list():
|
||||
def __init__(self):
|
||||
@ -41,42 +42,68 @@ class commands_list():
|
||||
# Function call
|
||||
command["command"]()
|
||||
|
||||
if __name__ == "__main__":
|
||||
def download(aqt_path: Path, qt_platform: Path):
|
||||
|
||||
# aqt list-qt windows desktop --modules 6.2.0 win64_msvc2019_64
|
||||
qt_packages = "qt3d qt5compat qtimageformats qtmultimedia qtshadertools qtquick3d qtwebengine qtwebsockets qtwebview qtpositioning"
|
||||
print(f"Downloading: {qt_packages} to {aqt_path}")
|
||||
execute(f"python -m aqt install-qt -O {aqt_path} windows desktop {defines.QT_VERSION} {qt_platform} -m {qt_packages}")
|
||||
|
||||
# Tools can only be installed one at the time:
|
||||
# see: aqt list-tool windows desktop
|
||||
tools = ["tools_ifw", "tools_qtcreator", "tools_ninja" ,"tools_cmake"]
|
||||
for tool in tools:
|
||||
execute(f"python -m aqt install-tool -O {aqt_path} windows desktop {tool}")
|
||||
|
||||
def setup_qt():
|
||||
|
||||
aqt_path = defines.AQT_PATH
|
||||
|
||||
print(f"Setup Qt via aqt at {aqt_path}")
|
||||
|
||||
if system() == "Windows":
|
||||
qt_platform = "win64_msvc2019_64"
|
||||
elif system() == "Darwin":
|
||||
qt_platform = "clang_64"
|
||||
elif system() == "Linux":
|
||||
qt_platform = "gcc_64"
|
||||
|
||||
|
||||
qt_base_path = aqt_path.joinpath(defines.QT_VERSION).resolve()
|
||||
qt_path = qt_base_path.joinpath(qt_platform).resolve()
|
||||
|
||||
if not qt_path.exists():
|
||||
download(aqt_path, qt_platform)
|
||||
else:
|
||||
# Betas & RCs are technically the same version. So limit download to x days
|
||||
days = 30
|
||||
folder_creation_date: datetime = datetime.datetime.fromtimestamp(qt_base_path.stat().st_mtime, tz=datetime.timezone.utc)
|
||||
now: datetime = datetime.datetime.now(tz=datetime.timezone.utc)
|
||||
two_weeks_ago: datetime = now - datetime.timedelta(days=days)
|
||||
if(folder_creation_date < two_weeks_ago):
|
||||
print(f"qt version at `{qt_base_path}` older than {days} days ({folder_creation_date}), redownload!")
|
||||
download(aqt_path, qt_platform)
|
||||
else:
|
||||
print(f"Qt {defines.QT_VERSION} is up to date and ready ")
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Install ScreenPlay dependencies.')
|
||||
parser.add_argument(
|
||||
'--path', help='Manually set the vcpkg path. The path must be an absolute path \
|
||||
without the ScreenPlay-vcpkg folder (E.g. py .\setup.py --path "D:/Backup/Code/Qt/")')
|
||||
description='Build and Package ScreenPlay')
|
||||
parser.add_argument('-skip-aqt', action="store_true", dest="skip_aqt",
|
||||
help="Downloads QtCreator and needed binaries \Windows: C:\aqt\nLinux & macOS:~/aqt/.")
|
||||
args = parser.parse_args()
|
||||
|
||||
# ScreenPlay source and ScreenPlay-vcpkg have to be on the same file system hierarchy
|
||||
project_source_parent_path = ""
|
||||
project_source_path = Path.cwd().resolve()
|
||||
if project_source_path.name == "Tools":
|
||||
project_source_path = project_source_path.parent
|
||||
|
||||
if args.path is not None:
|
||||
project_source_parent_path = Path(args.path).resolve()
|
||||
else:
|
||||
print("No --path provided, using default path.")
|
||||
project_source_parent_path = project_source_path.parent
|
||||
|
||||
print("project_source_parent_path: {}".format(project_source_parent_path))
|
||||
print("project_source_path: {}".format(project_source_path))
|
||||
|
||||
vcpkg_path = project_source_parent_path.joinpath("ScreenPlay-vcpkg")
|
||||
print("vcpkg_path: ", vcpkg_path)
|
||||
print("Build vcpkg ", vcpkg_version)
|
||||
|
||||
vcpkg_triplet = ""
|
||||
vcpkg_command = ""
|
||||
platform_command = commands_list()
|
||||
root_path = Path(util.cd_repo_root_path())
|
||||
project_source_parent_path = root_path.joinpath("../").resolve()
|
||||
vcpkg_path = project_source_parent_path.joinpath("ScreenPlay-vcpkg").resolve()
|
||||
vcpkg_packages_list = [
|
||||
"openssl",
|
||||
"curl",
|
||||
"cpp-httplib",
|
||||
"libarchive"
|
||||
]
|
||||
if not args.skip_aqt:
|
||||
setup_qt()
|
||||
|
||||
download_ffmpeg.execute()
|
||||
|
||||
@ -84,12 +111,14 @@ without the ScreenPlay-vcpkg folder (E.g. py .\setup.py --path "D:/Backup/Code/Q
|
||||
vcpkg_command = "vcpkg.exe"
|
||||
vcpkg_packages_list.append("infoware[d3d]")
|
||||
vcpkg_packages_list.append("sentry-native")
|
||||
platform_command = commands_list()
|
||||
platform_command.add("bootstrap-vcpkg.bat", vcpkg_path, False)
|
||||
vcpkg_triplet = ["x64-windows"]
|
||||
elif system() == "Darwin":
|
||||
vcpkg_command = "./vcpkg"
|
||||
#vcpkg_packages_list.append("infoware[opencl]") does not work with arm
|
||||
vcpkg_packages_list.append("curl") # Hidden dependency from sentry
|
||||
platform_command = commands_list()
|
||||
platform_command.add("chmod +x bootstrap-vcpkg.sh", vcpkg_path)
|
||||
platform_command.add("./bootstrap-vcpkg.sh", vcpkg_path, False)
|
||||
platform_command.add("chmod +x vcpkg", vcpkg_path)
|
||||
@ -97,6 +126,7 @@ without the ScreenPlay-vcpkg folder (E.g. py .\setup.py --path "D:/Backup/Code/Q
|
||||
elif system() == "Linux":
|
||||
vcpkg_command = "./vcpkg"
|
||||
#vcpkg_packages_list.append("infoware[opengl]")
|
||||
platform_command = commands_list()
|
||||
platform_command.add("chmod +x bootstrap-vcpkg.sh", vcpkg_path)
|
||||
platform_command.add("./bootstrap-vcpkg.sh", vcpkg_path, False)
|
||||
platform_command.add("chmod +x vcpkg", vcpkg_path)
|
||||
@ -104,15 +134,18 @@ without the ScreenPlay-vcpkg folder (E.g. py .\setup.py --path "D:/Backup/Code/Q
|
||||
else:
|
||||
raise NotImplementedError("Unknown system: {}".format(system()))
|
||||
|
||||
print(f"Clone into {vcpkg_path}")
|
||||
execute("git clone https://github.com/microsoft/vcpkg.git ScreenPlay-vcpkg", project_source_parent_path, True)
|
||||
execute("git fetch", vcpkg_path)
|
||||
execute("git checkout {}".format(defines.VCPKG_VERSION), vcpkg_path)
|
||||
execute(f"{vcpkg_command} remove --outdated --recurse", vcpkg_path, False)
|
||||
|
||||
# Setup vcpkg via boostrap script first
|
||||
platform_command.execute_commands() # Execute platform specific commands.
|
||||
|
||||
for triplet in vcpkg_triplet:
|
||||
execute("git clone https://github.com/microsoft/vcpkg.git ScreenPlay-vcpkg", project_source_parent_path, True)
|
||||
execute("git fetch", vcpkg_path)
|
||||
execute("git checkout {}".format(vcpkg_version), vcpkg_path)
|
||||
platform_command.execute_commands() # Execute platform specific commands.
|
||||
vcpkg_packages = " ".join(vcpkg_packages_list)
|
||||
execute("{} remove --outdated --recurse".format(vcpkg_command), vcpkg_path, False)
|
||||
execute("{} update".format(vcpkg_command), vcpkg_path, False)
|
||||
execute("{} upgrade --no-dry-run".format(vcpkg_command),
|
||||
vcpkg_path, False)
|
||||
execute("{} install {} --triplet {} --recurse".format(vcpkg_command,
|
||||
vcpkg_packages, triplet), vcpkg_path, False)
|
||||
execute(f"{vcpkg_command} install {vcpkg_packages} --triplet {triplet} --recurse", vcpkg_path, False)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue
Block a user