Skip to content

Commit

Permalink
Handle Qt6/non-desktop installation patching (#210)
Browse files Browse the repository at this point in the history
* Do not check qmake for android

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Refactoring patching

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: test android_armv7 in 6.0.1

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Patching qt6 android qmake script

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Patching qt6 android qmake script(wip)

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: test android/qt6 on github actions

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Add combination for Qt6 and update README

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Azure: Fix test cases

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Azure: Fix Qt6 test case

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Fix windows case

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Fix windows case

Add debug print

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Fix prefix path for patching

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Improvve log messages for patching

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Check android installation

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Check android installation

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Check android installation

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Updater: update logging message

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Updater: Fix qmake detection on windows

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: run qmake.bat on windows

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: run Qt6 qmake.bat on windows

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: run Qt6 qmake.bat on windows

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Azure: fix mirror test

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: Azure: test Qt6 with Ubuntu 20.04

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
  • Loading branch information
miurahr authored Feb 11, 2021
1 parent ca63ddd commit 060a112
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 106 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/test-install-qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ jobs:
strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
py: [3.6, 3.8]
qtver: [5.9.9, 5.12.8, 5.15.1]
py: [3.6, 3.9]
qtver: [5.9.9, 5.12.8, 5.15.2]
include:
- os: ubuntu-20.04
py: 3.8
qtver: 6.0.0
py: 3.9
qtver: 6.0.1
- os: windows-latest
py: 3.9
qtver: 6.0.1
exclude:
- os: windows-latest
py: 3.6
qtver: 5.15.1
qtver: 5.15.2
steps:
- uses: actions/checkout@v1
with:
Expand Down Expand Up @@ -47,6 +50,8 @@ jobs:
args = [qtver, "windows", "desktop", "win64_msvc2019_64"]
elif qtver.startswith('5.14'):
args = [qtver, "windows", "desktop", "win64_msvc2017_64"]
elif qtver.startswith('6'):
args = [qtver, "windows", "desktop", "win64_mingw81"]
else:
args = [qtver, "windows", "desktop", "win64_msvc2015_64"]
elif platform == "macOS-latest":
Expand All @@ -55,14 +60,28 @@ jobs:
args = [qtver, "linux", "desktop", "gcc_64"]
command_line.extend(args)
command_line.extend(["--archives", "qtbase", "icu", "qt"])
print("Execute: {}".format(command_line))
try:
res = subprocess.run(command_line, timeout=timeout, check=True)
except subprocess.CalledProcessError as cpe:
exit(cpe.returncode)
assert res.returncode == 0
if qtver.startswith('6'):
if platform == 'ubuntu-20.04':
command_line = ["python", "-m", "aqt", "install", qtver, "linux", "android", "android_armv7"]
elif platform == "macOS-latest":
command_line = ["python", "-m", "aqt", "install", qtver, "mac", "ios", "ios"]
else:
command_line = ["python", "-m", "aqt", "install", qtver, "windows", "android", "android_armv7"]
try:
res = subprocess.run(command_line, timeout=timeout, check=True)
except subprocess.CalledProcessError as cpe:
exit(cpe.returncode)
assert res.returncode == 0
shell: python
- name: Test qmake -query
run: |
import os
import pathlib
from subprocess import CalledProcessError, PIPE, run
platform = "${{ matrix.os }}"
Expand All @@ -72,6 +91,8 @@ jobs:
arch_dir = 'msvc2019_64'
elif qtver.startswith('5.14'):
arch_dir = 'msvc2017_64'
elif qtver.startswith('6'):
arch_dir = 'mingw81_64'
else:
arch_dir = 'msvc2015_64'
elif platform == "macOS-latest":
Expand All @@ -88,4 +109,19 @@ jobs:
if line.startswith(b'QT_INSTALL_PREFIX'):
result = line[18:].decode('UTF-8')
assert qt_prefix_path.samefile(result)
print('PREFIX {}'.format(result))
if qtver.startswith('6'):
if platform == "windows-latest" and qtver.startswith('6'):
qmake = os.path.join(qtver, 'android_armv7', 'bin', 'qmake.bat')
else:
qmake = os.path.join(qtver, 'android_armv7', 'bin', 'qmake')
try:
res = run([qmake, "-query"], timeout=15, check=True, stdout=PIPE)
except CalledProcessError as cpe:
exit(cpe.returncode)
assert res.returncode == 0
for line in res.stdout.splitlines():
if line.startswith(b'QT_INSTALL_PREFIX'):
result = line[18:].decode('UTF-8')
print('PREFIX {}'.format(result))
shell: python
20 changes: 18 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ You can also call with ``python -m aqt`` syntax as well as command script ``aqt`
* `win64_mingw53`, `win32_mingw53`,
* `win64_msvc2019_winrt_x64`, `win64_msvc2019_winrt_x86`, `win64_msvc2019_winrt_armv7`
* `win64_msvc2017_winrt_x64`, `win64_msvc2017_winrt_x86`, `win64_msvc2017_winrt_armv7`
* For android and Qt 5.13 or below, choose one of: `android_x86_64`, `android_arm64_v8a`, `android_x86`,
* For android and Qt 6 or Qt 5.13 and below, choose one of: `android_x86_64`, `android_arm64_v8a`, `android_x86`,
`android_armv7`
* You can specify external 7zip command path instead of built-in extractor.
* When specifying `all` for extra modules option `-m` all extra modules are installed.
Expand Down Expand Up @@ -139,6 +139,13 @@ Example: Installing Android (armv7) Qt 5.10.2:
aqt install 5.10.2 linux android android_armv7
Example: Installing Android Qt 5.15.2:
.. code-block:: bash
aqt install 5.15.2 linux android android
Example: Install examples, doc and source:
.. code-block:: bash
Expand All @@ -148,7 +155,7 @@ Example: Install examples, doc and source:
C:\ aqt src 5.15.0 windows desktop
Example: Install Web Assembly
Example: Install Web Assembly for Qt5
.. code-block:: bash
Expand Down Expand Up @@ -178,6 +185,15 @@ Example: Install MinGW on Windows
c:\ set PATH=C:\Qt\Tools\mingw810_64\bin
Example: Install Qt6 for android
.. code-block:: bash
aqt install -O qt 6.1.0 linux desktop
aqt install -O qt 6.1.0 linux android android_armv7
qt/6.1.0/android_armv7/bin/qmake -query
Example: Show help message
.. code-block:: bash
Expand Down
6 changes: 3 additions & 3 deletions aqt/combinations.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
{"os_name": "windows", "target": "desktop", "arch": "win32_mingw81"},
{"os_name": "windows", "target": "desktop", "arch": "win64_mingw73"},
{"os_name": "windows", "target": "desktop", "arch": "win32_mingw73"},
{"os_name": "windows", "target": "desktop", "arch": "win64_mingw53"},
{"os_name": "windows", "target": "desktop", "arch": "win32_mingw53"},
{"os_name": "windows", "target": "winrt", "arch": "win64_msvc2019_winrt_x64"},
{"os_name": "windows", "target": "winrt", "arch": "win64_msvc2019_winrt_x86"},
Expand Down Expand Up @@ -99,7 +98,8 @@
"qtquick3d", "qtquicktimeline", "qtscript", "qtvirtualkeyboard", "qtwebengine", "qtwebglplugin"]},
{"qt_version": "5.15", "modules": ["qtcharts", "qtlottie", "qtnetworkauth", "qtpurchasing", "qtdatavis3d",
"qtquick3d", "qtquicktimeline", "qtscript", "qtvirtualkeyboard", "qtwebengine", "qtwebglplugin"]},
{"qt_version": "6.0", "modules": ["qtnetworkauth"]}
{"qt_version": "6.0", "modules": ["qtwaylandcompositor"]},
{"qt_version": "6.1", "modules": ["qtwaylandcompositor"]}
], "versions": [
"5.5", "5.6", "5.7", "5.8",
"5.9", "5.9.1", "5.9.2", "5.9.3", "5.9.4", "5.9.5", "5.9.6", "5.9.7", "5.9.8", "5.9.9",
Expand All @@ -108,5 +108,5 @@
"5.13.0", "5.13.1", "5.13.2",
"5.14.0", "5.14.1", "5.14.2",
"5.15.0", "5.15.1", "5.15.2",
"6.0.0"
"6.0.0", "6.0.1", "6.1.0"
]}]
54 changes: 11 additions & 43 deletions aqt/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,15 @@ def _check_tools_arg_combination(self, os_name, tool_name, arch):
return False

def _check_qt_arg_combination(self, qt_version, os_name, target, arch):
if qt_version.startswith('5.15.0') and os_name == 'windows' and target == 'desktop':
if arch in ['win64_msvc2017_64', 'win32_msvc2017', 'win64_mingw73', 'win32_mingw73']:
if os_name == 'windows' and target == 'desktop':
# check frequent mistakes
if qt_version.startswith('5.15.') or qt_version.startswith('6.'):
if arch in ['win64_msvc2017_64', 'win32_msvc2017', 'win64_mingw73', 'win32_mingw73']:
return False
elif qt_version.startswith('5.9.') or qt_version.startswith('5.10.') or qt_version.startswith('5.11.'):
if arch in ['win64_mingw73', 'win32_mingw73', 'win64_mingw81', 'win32_mingw81']:
return False
elif arch in ['win64_msvc2019_64', 'win32_msvc2019', 'win64_mingw81', 'win32_mingw81']:
return False
for c in self.settings.qt_combinations:
if c['os_name'] == os_name and c['target'] == target and c['arch'] == arch:
Expand Down Expand Up @@ -228,7 +235,7 @@ def run_install(self, args):
target_config = qt_archives.get_target_config()
self.call_installer(qt_archives, output_dir, sevenzip)
if not nopatch:
finisher(target_config, base_dir, self.logger)
Updater.update(target_config, base_dir, self.logger)
self.logger.info("Finished installation")
self.logger.info("Time elasped: {time:.8f} second".format(time=time.perf_counter() - start_time))

Expand Down Expand Up @@ -396,6 +403,7 @@ def _create_parser(self):
"\nwindows/desktop: win64_msvc2019_64, win32_msvc2019"
"\n win64_msvc2017_64, win32_msvc2017"
"\n win64_msvc2015_64, win32_msvc2015"
"\n win64_mingw81, win32_mingw81"
"\n win64_mingw73, win32_mingw73"
"\n win32_mingw53"
"\n wasm_32"
Expand Down Expand Up @@ -523,43 +531,3 @@ def installer(qt_archive, base_dir, command, response_timeout=30):
raise cpe
os.unlink(archive)
logger.info("Finished installation of {} in {}".format(archive, time.perf_counter() - start_time))


def finisher(target, base_dir, logger):
"""
Make Qt configuration files, qt.conf and qtconfig.pri.
Call updater to update pkgconfig and patch Qt5Core and qmake
"""
qt_version = target.version
arch = target.arch
if arch is None:
arch_dir = ''
elif arch.startswith('win64_mingw'):
arch_dir = arch[6:] + '_64'
elif arch.startswith('win32_mingw'):
arch_dir = arch[6:] + '_32'
elif arch.startswith('win'):
arch_dir = arch[6:]
else:
arch_dir = arch
try:
# prepare qt.conf
with open(os.path.join(base_dir, qt_version, arch_dir, 'bin', 'qt.conf'), 'w') as f:
f.write("[Paths]\n")
f.write("Prefix=..\n")
# update qtconfig.pri only as OpenSource
with open(os.path.join(base_dir, qt_version, arch_dir, 'mkspecs', 'qconfig.pri'), 'r+') as f:
lines = f.readlines()
f.seek(0)
f.truncate()
for line in lines:
if line.startswith('QT_EDITION ='):
line = 'QT_EDITION = OpenSource\n'
if line.startswith('QT_LICHECK ='):
line = 'QT_LICHECK =\n'
f.write(line)
except IOError as e:
raise e
prefix = pathlib.Path(base_dir) / target.version / target.arch
updater = Updater(prefix, logger)
updater.qtpatch(target)
Loading

0 comments on commit 060a112

Please sign in to comment.