Consolidate some options for build.py and build_plugin.py

Change-Id: Ic745231ed68296f8052e3b0897893ee8fce53b16
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Eike Ziller
2020-10-27 11:52:24 +01:00
parent bf2276ebde
commit 3476b8aa67
2 changed files with 11 additions and 4 deletions

View File

@@ -91,6 +91,8 @@ def get_arguments():
action='store_true', default=False)
parser.add_argument('--with-tests', help='Enable building of tests',
action='store_true', default=False)
parser.add_argument('--add-path', help='Prepends a CMAKE_PREFIX_PATH to the build',
action='append', dest='prefix_paths', default=[])
parser.add_argument('--add-make-arg', help='Passes the argument to the make tool.',
action='append', dest='make_args', default=[])
parser.add_argument('--add-config', help=('Adds the argument to the CMake configuration call. '
@@ -103,7 +105,7 @@ def get_arguments():
def build_qtcreator(args, paths):
if not os.path.exists(paths.build):
os.makedirs(paths.build)
prefix_paths = [paths.qt]
prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt]
if paths.llvm:
prefix_paths += [paths.llvm]
if paths.elfutils:

View File

@@ -46,8 +46,10 @@ def get_arguments():
help='Path to Qt Creator installation including development package',
required=True)
parser.add_argument('--output-path', help='Output path for resulting 7zip files')
parser.add_argument('--add-path', help='Adds a CMAKE_PREFIX_PATH to the build',
parser.add_argument('--add-path', help='Prepends a CMAKE_PREFIX_PATH to the build',
action='append', dest='prefix_paths', default=[])
parser.add_argument('--add-make-arg', help='Passes the argument to the make tool.',
action='append', dest='make_args', default=[])
parser.add_argument('--add-config', help=('Adds the argument to the CMake configuration call. '
'Use "--add-config=-DSOMEVAR=SOMEVALUE" if the argument begins with a dash.'),
action='append', dest='config_args', default=[])
@@ -63,7 +65,7 @@ def build(args, paths):
os.makedirs(paths.build)
if not os.path.exists(paths.result):
os.makedirs(paths.result)
prefix_paths = [paths.qt, paths.qt_creator] + [os.path.abspath(fp) for fp in args.prefix_paths]
prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt]
build_type = 'Debug' if args.debug else 'Release'
cmake_args = ['cmake',
'-DCMAKE_PREFIX_PATH=' + ';'.join(prefix_paths),
@@ -92,7 +94,10 @@ def build(args, paths):
cmake_args += args.config_args
common.check_print_call(cmake_args + [paths.src], paths.build)
common.check_print_call(['cmake', '--build', '.'], paths.build)
build_args = ['cmake', '--build', '.']
if args.make_args:
build_args += ['--'] + args.make_args
common.check_print_call(build_args, paths.build)
if args.with_docs:
common.check_print_call(['cmake', '--build', '.', '--target', 'docs'], paths.build)
common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--strip'],