Skip to content

Commit

Permalink
Add support for Qt 6.1+
Browse files Browse the repository at this point in the history
Qt 6.1 moved the location of some binaries from QT_HOST_BINS to
QT_HOST_LIBEXECS as noted in the changelog:

c515ee178f Move build tools to libexec instead of the bin dir
- Tools that are called by the build system and are unlikely to be
called by the user are now installed to the libexec directory.

https://code.qt.io/cgit/qt/qtreleasenotes.git/tree/qt/6.1.0/release-note.txt

It's possible to help the 'qt' module find the tools by adding Qt's
libexec directory to the PATH environment variable, but this manual
workaround is not ideal.

To compensate, meson now needs to look for moc, rcc, uic, etc. in
QT_HOST_LIBEXECS as well as QT_HOST_BINS.

Co-authored-by: Stefan Hajnoczi <stefanha@jammr.net>
  • Loading branch information
2 people authored and eli-schwartz committed Apr 13, 2022
1 parent 589600c commit a606ce2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mesonbuild/dependencies/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def get_qmake_host_bins(qvars: T.Dict[str, str]) -> str:
return qvars['QT_INSTALL_BINS']


def get_qmake_host_libexecs(qvars: T.Dict[str, str]) -> T.Optional[str]:
if 'QT_HOST_LIBEXECS' in qvars:
return qvars['QT_HOST_LIBEXECS']
return qvars.get('QT_INSTALL_LIBEXECS')


def _get_modules_lib_suffix(version: str, info: 'MachineInfo', is_debug: bool) -> str:
"""Get the module suffix based on platform and debug type."""
suffix = ''
Expand Down Expand Up @@ -118,6 +124,7 @@ class _QtBase:
link_args: T.List[str]
clib_compiler: 'Compiler'
env: 'Environment'
libexecdir: T.Optional[str] = None

def __init__(self, name: str, kwargs: T.Dict[str, T.Any]):
self.qtname = name.capitalize()
Expand Down Expand Up @@ -277,6 +284,7 @@ def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
libdir = qvars['QT_INSTALL_LIBS']
# Used by qt.compilers_detect()
self.bindir = get_qmake_host_bins(qvars)
self.libexecdir = get_qmake_host_libexecs(qvars)

# Use the buildtype by default, but look at the b_vscrt option if the
# compiler supports it.
Expand Down Expand Up @@ -353,6 +361,7 @@ def _framework_detect(self, qvars: T.Dict[str, str], modules: T.List[str], kwarg
self.is_found = True
# Used by self.compilers_detect()
self.bindir = get_qmake_host_bins(qvars)
self.libexecdir = get_qmake_host_libexecs(qvars)

def log_info(self) -> str:
return 'qmake'
Expand Down
2 changes: 2 additions & 0 deletions mesonbuild/modules/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def gen_bins() -> T.Generator[T.Tuple[str, str], None, None]:
for b in self.tools:
if qt_dep.bindir:
yield os.path.join(qt_dep.bindir, b), b
if qt_dep.libexecdir:
yield os.path.join(qt_dep.libexecdir, b), b
# prefer the <tool>-qt<version> of the tool to the plain one, as we
# don't know what the unsuffixed one points to without calling it.
yield f'{b}-qt{qt_dep.qtver}', b
Expand Down

0 comments on commit a606ce2

Please sign in to comment.