update for Qt6

remove jom
change to 64bit visual studio
use cmake/ninja
update examples
replace zip with xz
add option to archive pdbs
This commit is contained in:
Shawn Hoffman
2022-04-02 16:07:59 -07:00
parent 2f470a1495
commit b37aa70a28
11 changed files with 214 additions and 343 deletions

5
.gitignore vendored
View File

@@ -2,7 +2,10 @@
__pycache__
# Ignore directories created by the utility / build process
dist
jom
archives
qt-everywhere-*
*.build
CMakeFiles/
bin/
config.opt*
config.tests/

View File

@@ -1,125 +0,0 @@
release: 5.15.0
platform: win32-msvc
name: dolphin.amd64
compiler:
name: visual_studio
version: 2019
edition: Community
vcvarsall: amd64
configure:
nomake:
- examples
- tests
skip:
- qt3d
- qtactiveqt
- qtandroidextras
- qtcharts
- qtconnectivity
- qtdatavis3d
- qtdoc
- qtgamepad
- qtgraphicaleffects
- qtlocation
- qtlottie
- qtmacextras
- qtmultimedia
- qtnetworkauth
- qtpurchasing
- qtquick3d
- qtquickcontrols
- qtquicktimeline
- qtremoteobjects
- qtscript
- qtscxml
- qtsensors
- qtserialbus
- qtserialport
- qtspeech
- qtsvg
- qtwayland
- qtwebchannel
- qtwebengine
- qtwebsockets
- qtwebview
- qtx11extras
- qtxmlpatterns
feature:
bearermanagement: false
concurrent: false
dbus: false
imageformat_bmp: false
qml-devtools: false
qml-worker-script: false
quick-particles: false
quick-path: false
sql-odbc: false
sql-sqlite: false
tiff: false
vulkan: false
webp: false
postprocess:
delete:
- bin/assistant.exe
- bin/designer.exe
- bin/linguist.exe
- bin/Qt5PrintSupport.dll
- bin/Qt5PrintSupportd.dll
- bin/Qt5QmlModels.dll
- bin/Qt5QmlModelsd.dll
- bin/Qt5QuickTest.dll
- bin/Qt5QuickTestd.dll
- bin/Qt5Sql.dll
- bin/Qt5Sqld.dll
- bin/Qt5Test.dll
- bin/Qt5Testd.dll
- bin/Qt5Xml.dll
- bin/Qt5Xmld.dll
- doc
- include/QtDesigner
- include/QtDesignerComponents
- include/QtPrintSupport
- include/QtQmlDebug
- include/QtQmlModels
- include/QtQuickTest
- include/QtSql
- include/QtTest
- include/Qt5Xml
- lib/Qt5Designer.lib
- lib/Qt5Designerd.lib
- lib/Qt5DesignerComponents.lib
- lib/Qt5DesignerComponentsd.lib
- lib/Qt5PrintSupport.lib
- lib/Qt5PrintSupportd.lib
- lib/Qt5QmlDebug.lib
- lib/Qt5QmlDebugd.lib
- lib/Qt5QmlModels.lib
- lib/Qt5QmlModelsd.lib
- lib/Qt5QuickTest.lib
- lib/Qt5QuickTestd.lib
- lib/Qt5Sql.lib
- lib/Qt5Sqld.lib
- lib/Qt5Test.lib
- lib/Qt5Testd.lib
- lib/Qt5Xml.lib
- lib/Qt5Xmld.lib
- lib/cmake/Qt5Designer
- lib/cmake/Qt5DesignerComponents
- lib/cmake/Qt5PrintSupport
- lib/cmake/Qt5QmlDebug
- lib/cmake/Qt5QmlModels
- lib/cmake/Qt5QuickTest
- lib/cmake/Qt5Sql
- lib/cmake/Qt5Test
- lib/cmake/Qt5Xml
- phrasebooks
- plugins/printsupport
- plugins/qmltooling
- qml/QtTest
- translations
delete_regex:
- .*\.prl
- .*\.pdb

View File

@@ -1,129 +1,82 @@
release: 5.15.0
cross: true
hostbindir: ..\dist\dolphin.amd64_5.15.0\bin
platform: win32-arm64-msvc2017
release: 6.2.4
host_path: ..\dist\dolphin.x64_6.2.4
platform: win32-arm64-msvc
name: dolphin.arm64
compiler:
name: visual_studio
version: 2019
version: 2022
edition: Community
cross: true
vcvarsall: x64_arm64
configure:
additional_parameters: -opengl es2 -angle
additional_parameters: -c++std c++20 -debug-and-release -force-debug-info -ltcg -no-opengl
nomake:
- examples
- tests
skip:
- qt3d
- qt5compat
- qtactiveqt
- qtandroidextras
- qtcharts
- qtcoap
- qtconnectivity
- qtdatavis3d
- qtdeclarative
- qtdoc
- qtgamepad
- qtgraphicaleffects
- qtlocation
- qtlottie
- qtmacextras
- qtmqtt
- qtmultimedia
- qtnetworkauth
- qtpurchasing
- qtopcua
- qtpositioning
- qtquick3d
- qtquickcontrols
- qtquicktimeline
- qtremoteobjects
- qtscript
- qtscxml
- qtsensors
- qtserialbus
- qtserialport
- qtspeech
- qtshadertools
- qtsvg
- qttools
- qttranslations
- qtvirtualkeyboard
- qtwayland
- qtwebchannel
- qtwebengine
- qtwebsockets
- qtwebview
- qtx11extras
- qtxmlpatterns
feature:
bearermanagement: false
concurrent: false
dbus: false
imageformat_bmp: false
qml-devtools: false
qml-worker-script: false
quick-particles: false
quick-path: false
sql-odbc: false
sql-sqlite: false
network: false
printsupport: false
qmake: false
sql: false
testlib: false
textmarkdownreader: false
textmarkdownwriter: false
textodfwriter: false
tiff: false
vulkan: false
webp: false
postprocess:
delete:
- bin/assistant.exe
- bin/designer.exe
- bin/linguist.exe
- bin/Qt5PrintSupport.dll
- bin/Qt5PrintSupportd.dll
- bin/Qt5QmlModels.dll
- bin/Qt5QmlModelsd.dll
- bin/Qt5QuickTest.dll
- bin/Qt5QuickTestd.dll
- bin/Qt5Sql.dll
- bin/Qt5Sqld.dll
- bin/Qt5Test.dll
- bin/Qt5Testd.dll
- bin/Qt5Xml.dll
- bin/Qt5Xmld.dll
- doc
- include/QtDesigner
- include/QtDesignerComponents
- include/QtPrintSupport
- include/QtQmlDebug
- include/QtQmlModels
- include/QtQuickTest
- include/QtSql
- include/QtTest
- include/Qt5Xml
- lib/Qt5Designer.lib
- lib/Qt5Designerd.lib
- lib/Qt5DesignerComponents.lib
- lib/Qt5DesignerComponentsd.lib
- lib/Qt5PrintSupport.lib
- lib/Qt5PrintSupportd.lib
- lib/Qt5QmlDebug.lib
- lib/Qt5QmlDebugd.lib
- lib/Qt5QmlModels.lib
- lib/Qt5QmlModelsd.lib
- lib/Qt5QuickTest.lib
- lib/Qt5QuickTestd.lib
- lib/Qt5Sql.lib
- lib/Qt5Sqld.lib
- lib/Qt5Test.lib
- lib/Qt5Testd.lib
- lib/Qt5Xml.lib
- lib/Qt5Xmld.lib
- lib/cmake/Qt5Designer
- lib/cmake/Qt5DesignerComponents
- lib/cmake/Qt5PrintSupport
- lib/cmake/Qt5QmlDebug
- lib/cmake/Qt5QmlModels
- lib/cmake/Qt5QuickTest
- lib/cmake/Qt5Sql
- lib/cmake/Qt5Test
- lib/cmake/Qt5Xml
- phrasebooks
- plugins/printsupport
- plugins/qmltooling
- qml/QtTest
- translations
- include/QtXml
- lib/cmake/Qt6Xml
- mkspecs
- modules/Xml.json
delete_regex:
- bin\\android.*
- bin\\Qt6Xml.*
- bin\\.*\.bat
- bin\\.*\.cmake
- bin\\.*\.conf
- bin\\.*\.pl
- lib\\metatypes\\qt6xml_.*\.json
- lib\\Qt6Xml.*
- .*\.prl
- .*\.pdb
archive_pdbs: true

81
examples/dolphin-x64.yml Normal file
View File

@@ -0,0 +1,81 @@
release: 6.2.4
platform: win32-msvc
name: dolphin.x64
compiler:
name: visual_studio
version: 2022
edition: Community
vcvarsall: x64
configure:
additional_parameters: -c++std c++20 -debug-and-release -force-debug-info -ltcg -no-opengl
nomake:
- examples
- tests
skip:
- qt3d
- qt5compat
- qtactiveqt
- qtcharts
- qtcoap
- qtconnectivity
- qtdatavis3d
- qtdeclarative
- qtdoc
- qtlottie
- qtmqtt
- qtmultimedia
- qtnetworkauth
- qtopcua
- qtpositioning
- qtquick3d
- qtquicktimeline
- qtremoteobjects
- qtscxml
- qtsensors
- qtserialbus
- qtserialport
- qtshadertools
- qtsvg
- qttools
- qttranslations
- qtvirtualkeyboard
- qtwayland
- qtwebchannel
- qtwebengine
- qtwebsockets
- qtwebview
feature:
concurrent: false
dbus: false
imageformat_bmp: false
network: false
printsupport: false
qmake: false
sql: false
testlib: false
textmarkdownreader: false
textmarkdownwriter: false
textodfwriter: false
tiff: false
webp: false
postprocess:
delete:
- doc
- include/QtXml
- lib/cmake/Qt6Xml
- mkspecs
- modules/Xml.json
delete_regex:
# needed if the outputs are to be used as cross compile host tools
#- bin\\android.*
- bin\\Qt6Xml.*
- bin\\.*\.bat
- bin\\.*\.cmake
- bin\\.*\.pl
- lib\\metatypes\\qt6xml_.*\.json
- lib\\Qt6Xml.*
- .*\.prl
archive_pdbs: true

View File

@@ -29,8 +29,6 @@ WINBUILD_PATH = os.path.join(DATA_PATH, "winbuild.bat")
# Settings
REPO_BASE_URL = "https://download.qt.io/"
REPO_SRC_PATH = "{0}/official_releases/qt/{1}/{2}/single/qt-everywhere-src-{2}.zip"
REPO_JOM_PATH = "{0}/official_releases/jom/jom.zip"
REPO_SRC_PATH = "{0}/official_releases/qt/{1}/{2}/single/qt-everywhere-src-{2}.tar.xz"
USE_CACHE = True
USE_JOM = True
USE_CACHE = True

View File

@@ -19,7 +19,7 @@
import argparse
import os
import zipfile
from pathlib import Path
import yaml
@@ -27,49 +27,25 @@ import qsc
from qsc.download import download_release, download_file
from qsc.extract import extract_release
from qsc.postprocess import postprocess_dir
from qsc.requirements import check_requirements, is_jom_present
from qsc.requirements import check_requirements
def parse_args():
parser = argparse.ArgumentParser(description="QSC builds your own custom Qt")
parser.add_argument("--cache", dest="use_cache", action="store_true")
parser.add_argument("--no-cache", dest="use_cache", action="store_false")
parser.add_argument("--jom", dest="use_jom", action="store_true")
parser.add_argument("--no-jom", dest="use_jom", action="store_false")
parser.add_argument("--continue", dest="do_continue", action="store_true")
parser.add_argument("--mirror", dest="mirror", default="https://download.qt.io/")
parser.add_argument("manifest")
parser.set_defaults(use_cache=True, use_jom=True, do_continue=False)
parser.set_defaults(use_cache=True, do_continue=False)
args = parser.parse_args()
qsc.USE_CACHE = args.use_cache
qsc.USE_JOM = args.use_jom
qsc.REPO_BASE_URL = args.mirror
return args
def install_jom():
if os.path.isfile(os.path.join("jom", "jom.exe")):
return
if not os.path.isdir("jom"):
os.mkdir("jom")
os.chdir("jom")
url = qsc.REPO_JOM_PATH.format(qsc.REPO_BASE_URL)
download_path = "jom.zip"
download_file(url, download_path)
with zipfile.ZipFile(download_path, "r") as f:
f.extract("jom.exe")
os.remove("jom.zip")
os.chdir("..")
if __name__ == "__main__":
args = parse_args()
@@ -78,38 +54,32 @@ if __name__ == "__main__":
if not check_requirements():
print("Not all requirements for building Qt are in PATH. Can't continue.")
exit(1)
basedir = os.getcwd()
config = yaml.load(open(args.manifest, "r"), Loader=yaml.BaseLoader)
release = config["release"]
build_dir = release+"_"+config["name"]+".build"
compiler = config["compiler"]
download_release(release)
extract_release(release)
if qsc.USE_JOM and qsc.is_windows():
if not is_jom_present():
print("Jom not present, using own...")
install_jom()
os.putenv("PATH", os.environ["PATH"]+";"+os.path.join(os.getcwd(), "jom"))
if os.path.isdir(build_dir):
if not args.do_continue:
print("Build directory already exists - aborting (specify --continue to ignore)")
exit(1)
else:
os.mkdir(build_dir)
os.chdir(build_dir)
if compiler["name"] == "visual_studio":
if not qsc.is_windows():
print("Only supported on Windows!")
exit(1)
os.putenv("VS_VERSION", compiler["version"])
os.putenv("VS_EDITION", compiler["edition"])
os.putenv("VCVARSALL", compiler.get("vcvarsall", ""))
@@ -117,41 +87,34 @@ if __name__ == "__main__":
else:
print("Unknown compiler '{}'".format(compiler.name))
exit(1)
output_path = os.path.join(basedir, "dist", config["name"]+"_"+release)
os.makedirs(output_path, exist_ok=True)
os.putenv("RELEASE", release)
os.putenv("OUTNAME", output_path)
platform = ""
# Platform
if config.get("cross", False) == "true":
hostbindir = os.path.abspath(config["hostbindir"])
platform = "-xplatform "+config["platform"]+ " -external-hostbindir "+hostbindir
elif config.get("platform", False):
platform = "-platform "+config["platform"]
os.putenv("QT_PLATFORM", platform)
os.putenv("USE_JOM", str(int(qsc.USE_JOM and compiler["name"] == "visual_studio")))
# Platform
platform = config.get("platform")
if platform is not None:
os.putenv("QT_PLATFORM", "-platform "+platform)
host_path = config.get("host_path")
if host_path is not None:
host_path = "-qt-host-path " + str(Path(host_path).resolve())
os.putenv("QT_HOST_PATH", host_path)
# Config options
configure = config["configure"]
configure_options = ""
# Use mp if we're not using jom
if not args.use_jom and compiler["name"] == "visual_studio":
configure_options += " -mp"
if configure:
# -nomake
for entry in configure.get("nomake", []):
configure_options += " -nomake "+entry
# -skip
for entry in configure.get("skip", []):
configure_options += " -skip "+entry
@@ -163,20 +126,20 @@ if __name__ == "__main__":
configure_options += " -feature-" + entry
else:
configure_options += " -no-feature-" + entry
# additional options
# additional options
if configure.get("additional_parameters", False):
configure_options += " "+configure["additional_parameters"]
os.putenv("QT_CONFIGURE_OPTIONS", configure_options)
if qsc.is_windows():
os.system(qsc.WINBUILD_PATH)
else:
print("Not supported yet, sorry :/")
exit(1)
# Post process output
postprocess_dir(output_path, config.get("postprocess", {}))
print("Done. Result in {}".format(output_path))

View File

@@ -17,11 +17,11 @@ REM along with this program. If not, see <http://www.gnu.org/licenses/>.
IF "%USE_VS%"=="1" (
if "%VCVARSALL%"=="" (
call "%PROGRAMFILES(x86)%\Microsoft Visual Studio\%VS_VERSION%\%VS_EDITION%\Common7\Tools\VsDevCmd.bat"
) else (
call "%PROGRAMFILES(x86)%\Microsoft Visual Studio\%VS_VERSION%\%VS_EDITION%\VC\Auxiliary\Build\vcvarsall.bat" %VCVARSALL%
)
if "%VCVARSALL%"=="" (
call "%PROGRAMFILES%\Microsoft Visual Studio\%VS_VERSION%\%VS_EDITION%\Common7\Tools\VsDevCmd.bat"
) else (
call "%PROGRAMFILES%\Microsoft Visual Studio\%VS_VERSION%\%VS_EDITION%\VC\Auxiliary\Build\vcvarsall.bat" %VCVARSALL%
)
)
@@ -31,7 +31,8 @@ call ..\qt-everywhere-src-%RELEASE%\configure.bat ^
-nomake examples -nomake tests ^
%QT_CONFIGURE_OPTIONS% ^
-prefix %OUTNAME% ^
%QT_PLATFORM%
%QT_PLATFORM% ^
%QT_HOST_PATH%
IF NOT "%ERRORLEVEL%"=="0" (
echo An error occured while configuring! Exit code is %ERRORLEVEL%
@@ -41,11 +42,7 @@ IF NOT "%ERRORLEVEL%"=="0" (
:compile
title Compiling...
echo Compiling...
IF "%USE_JOM%"=="1" (
jom
) ELSE (
nmake
)
cmake --build . --parallel
IF NOT "%ERRORLEVEL%"=="0" (
echo An error occured while compiling! Exit code is %ERRORLEVEL%
@@ -55,13 +52,9 @@ IF NOT "%ERRORLEVEL%"=="0" (
:install
title Installing...
echo Installing...
if "%USE_JOM%"=="1" (
jom install
) ELSE (
nmake install
)
ninja install
IF NOT "%ERRORLEVEL%"=="0" (
echo An error occured while installing! Exit code is %ERRORLEVEL%
exit 1
)
)

View File

@@ -17,7 +17,7 @@
"""All the download related stuff goes here"""
import os
from pathlib import Path
import qsc
import requests
import shutil
@@ -31,20 +31,19 @@ def download_file(url, path):
with open(path, "wb") as file:
shutil.copyfileobj(request.raw, file)
def download_release(release):
def download_release(release):
url = source_url(release)
download_path = os.path.join("archives", "qt-everywhere-src-{}.zip".format(release))
archive_dir = Path("archives")
download_path = archive_dir / f"qt-everywhere-src-{release}.tar.xz"
print("Downloading Qt {}...".format(release), end="", flush=True)
if not os.path.isdir("archives"):
os.mkdir("archives")
if qsc.USE_CACHE and os.path.isfile(download_path):
print(f"Downloading Qt {release}...", end="", flush=True)
archive_dir.mkdir(exist_ok=True)
if qsc.USE_CACHE and download_path.is_file():
print("Cached")
return
download_file(url, download_path)
print("Done")
download_file(url, download_path)
print("Done")

View File

@@ -17,23 +17,23 @@
"""Extracting archives and stuff"""
import os
import zipfile
from pathlib import Path
import tarfile
import qsc
def extract_release(release):
name = "qt-everywhere-src-{}".format(release)
name = f"qt-everywhere-src-{release}"
archive_path = Path("archives") / (name + ".tar.xz")
zip_path = os.path.join("archives", name+".zip")
print("Extracting...", end="", flush=True)
if qsc.USE_CACHE and os.path.isdir(name):
if qsc.USE_CACHE and Path(name).is_dir():
print("Cached")
return
with zipfile.ZipFile(zip_path, "r") as zip:
zip.extractall(".")
with tarfile.open(archive_path) as f:
f.extractall(".")
print("Done")

View File

@@ -20,6 +20,7 @@ import os
from pathlib import Path
import shutil
import re
import tarfile
def postprocess_dir(basedir, config):
@@ -33,24 +34,32 @@ def postprocess_dir(basedir, config):
delete = delete.replace("/", os.sep)
if delete in entries:
print("Deleting {}...".format(delete))
entries.remove(delete)
if os.path.isdir(delete):
shutil.rmtree(delete)
elif os.path.isfile(delete):
os.remove(delete)
# delete_regex
for delete_regex in config.get("delete_regex", []):
for e in entries:
if not os.path.exists(e):
continue
if re.fullmatch(delete_regex, e):
print("Deleting {} based on regex '{}'...".format(e, delete_regex))
if os.path.isdir(e):
shutil.rmtree(e)
elif os.path.isfile(e):
os.remove(e)
if config.get('archive_pdbs', False):
with tarfile.open('pdbs.tar.xz', 'w:xz') as archive:
print('archiving pdbs...')
for path in Path(".").rglob("*.pdb"):
print(path)
archive.add(path)
path.unlink()

View File

@@ -21,41 +21,38 @@ import qsc
def is_in_path(program):
path_folders = os.getenv("PATH").split(os.pathsep)
if qsc.is_windows():
program += ".exe"
for folder in path_folders:
path = os.path.join(folder, program)
if os.path.isfile(path):
return True
return False
def is_jom_present():
return is_in_path("jom")
return False
def check_requirements():
print("Requirements:\n")
print("Perl - ", end="")
success = True
if not is_in_path("perl"):
print("Not found")
success = False
else:
print("Ok")
print("Python (Optional) - ", end="")
if not is_in_path("python"):
print("Found")
else:
print("Ok")
print("")
return success