From 3476b8aa67b5c03a41e6a6bd3823f8e07581bf0d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 27 Oct 2020 11:52:24 +0100 Subject: [PATCH] Consolidate some options for build.py and build_plugin.py Change-Id: Ic745231ed68296f8052e3b0897893ee8fce53b16 Reviewed-by: Eike Ziller --- scripts/build.py | 4 +++- scripts/build_plugin.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/build.py b/scripts/build.py index 6fd8d976b28..2ffb35dda15 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -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: diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index 9df8c64f747..811713a969d 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -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'],