diff options
author | Eike Ziller <eike.ziller@qt.io> | 2021-04-09 15:13:16 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2021-04-12 09:38:06 +0000 |
commit | 89acd38b408e95ad2087058307c71dad6aa057c4 (patch) | |
tree | 6e7096bf62c7535f91aff1e8d00b29f83d4e2e51 | |
parent | 005f0a31274fa20ddf1ed68165175daa013718e1 (diff) |
macOS: Adapt build_plugin.py for possibly branded application bundle
Change-Id: I0d9860db78c2f617f5e8631064b271c0207f01de
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rwxr-xr-x | scripts/build_plugin.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index c70d605128..7ba55ef38d 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -32,6 +32,7 @@ from __future__ import print_function import argparse import collections +import glob import os import common @@ -63,20 +64,24 @@ def get_arguments(): args.with_debug_info = args.build_type == 'RelWithDebInfo' return args +def qtcreator_prefix_path(qt_creator_path): + # on macOS the prefix path must be inside the app bundle, but we want to allow + # simpler values for --qtc-path, so search in some variants of that + candidates = [qt_creator_path, os.path.join(qt_creator_path, 'Contents', 'Resources')] + candidates += [os.path.join(path, 'Contents', 'Resources') + for path in glob.glob(os.path.join(qt_creator_path, '*.app'))] + for path in candidates: + if os.path.exists(os.path.join(path, 'lib', 'cmake')): + return [path] + return [qt_creator_path] + def build(args, paths): if not os.path.exists(paths.build): os.makedirs(paths.build) if not os.path.exists(paths.result): os.makedirs(paths.result) - prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt] - if common.is_mac_platform(): - # --qtc-path may be - # "/path/Qt Creator.app/Contents/Resources", - # "/path/Qt Creator.app", or - # "/path", - # so add some variants to the prefix path - prefix_paths += [os.path.join(paths.qt_creator, 'Contents', 'Resources'), - os.path.join(paths.qt_creator, 'Qt Creator.app', 'Contents', 'Resources')] + prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt] + prefix_paths += qtcreator_prefix_path(paths.qt_creator) prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = ['cmake', |