diff options
| author | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-05-22 15:54:07 +0530 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-05-23 18:24:08 -0400 |
| commit | 22df45a31981874310a78dde0df59a6a7c5ebb29 (patch) | |
| tree | ec0c1a685b3f012a2ff32381c31bc3d858ee1073 /mesonbuild/programs.py | |
| parent | 1f71911ae4d6c061a3704dbf17430656f874f5b8 (diff) | |
| download | meson-22df45a31981874310a78dde0df59a6a7c5ebb29.tar.gz | |
qt: Allow specifying separate tools for qt4/5/6
Currently you can only use one of qt4, qt5, qt6 in a single project
when using a machine file because the config-tool lookup for qt only
looks at `qmake` in the machine files, instead of looking up the
binary names directly.
Allow specifying `qmake` `qmake4` `qmake5` and `qmake6`.
This is necessary for gstreamer, which can build separate qt5 and qt6
plugins that are distributed as static libraries, so the user can pick
which one to use.
Diffstat (limited to 'mesonbuild/programs.py')
| -rw-r--r-- | mesonbuild/programs.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/mesonbuild/programs.py b/mesonbuild/programs.py index 4b6669897..9bf1844c9 100644 --- a/mesonbuild/programs.py +++ b/mesonbuild/programs.py @@ -26,7 +26,7 @@ from pathlib import Path from . import mesonlib from . import mlog -from .mesonlib import MachineChoice +from .mesonlib import MachineChoice, OrderedSet if T.TYPE_CHECKING: from .environment import Environment @@ -355,15 +355,18 @@ def find_external_program(env: 'Environment', for_machine: MachineChoice, name: display_name: str, default_names: T.List[str], allow_default_for_cross: bool = True) -> T.Generator['ExternalProgram', None, None]: """Find an external program, checking the cross file plus any default options.""" + potential_names = OrderedSet(default_names) + potential_names.add(name) # Lookup in cross or machine file. - potential_cmd = env.lookup_binary_entry(for_machine, name) - if potential_cmd is not None: - mlog.debug(f'{display_name} binary for {for_machine} specified from cross file, native file, ' - f'or env var as {potential_cmd}') - yield ExternalProgram.from_entry(name, potential_cmd) - # We never fallback if the user-specified option is no good, so - # stop returning options. - return + for potential_name in potential_names: + potential_cmd = env.lookup_binary_entry(for_machine, potential_name) + if potential_cmd is not None: + mlog.debug(f'{display_name} binary for {for_machine} specified from cross file, native file, ' + f'or env var as {potential_cmd}') + yield ExternalProgram.from_entry(potential_name, potential_cmd) + # We never fallback if the user-specified option is no good, so + # stop returning options. + return mlog.debug(f'{display_name} binary missing from cross or native file, or env var undefined.') # Fallback on hard-coded defaults, if a default binary is allowed for use # with cross targets, or if this is not a cross target |
