From eb4d230e3818bef7290fb12911de1f0d3a98d565 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 12 Nov 2020 11:27:34 +0100 Subject: cmake build: Create DebugInfo component with separate debug info When building with RelWithDebInfo. The CMake code is adapted from corresponding (internal) functions from Qt 6. Also let the scripts create an additional *-debug.7z with the debug info. Task-number: QTCREATORBUG-24916 Change-Id: Ibc3c8c0013718b9c5e868136e5ce01e1e99f84c4 Reviewed-by: Cristian Adam --- scripts/build.py | 18 +++++++++++++++--- scripts/build_plugin.py | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/build.py b/scripts/build.py index 5360903371..5a0ad99607 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -103,7 +103,9 @@ def get_arguments(): action='append', dest='config_args', default=[]) parser.add_argument('--zip-infix', help='Adds an infix to generated zip files, use e.g. for a build number.', default='') - return parser.parse_args() + args = parser.parse_args() + args.with_debug_info = args.build_type == 'RelWithDebInfo' + return args def build_qtcreator(args, paths): if not os.path.exists(paths.build): @@ -175,6 +177,10 @@ def build_qtcreator(args, paths): common.check_print_call(['cmake', '--install', '.', '--prefix', paths.dev_install, '--component', 'Devel'], paths.build) + if args.with_debug_info: + common.check_print_call(['cmake', '--install', '.', '--prefix', paths.debug_install, + '--component', 'DebugInfo'], + paths.build) if not args.no_docs: common.check_print_call(['cmake', '--install', '.', '--prefix', paths.install, '--component', 'qch_docs'], @@ -245,6 +251,11 @@ def package_qtcreator(args, paths): os.path.join(paths.result, 'qtcreator' + args.zip_infix + '_dev.7z'), '*'], paths.dev_install) + if args.with_debug_info: + common.check_print_call(['7z', 'a', '-mmt2', + os.path.join(paths.result, 'qtcreator' + args.zip_infix + '-debug.7z'), + '*'], + paths.debug_install) if common.is_windows_platform(): common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, 'wininterrupt' + args.zip_infix + '.7z'), @@ -271,8 +282,8 @@ def package_qtcreator(args, paths): def get_paths(args): Paths = collections.namedtuple('Paths', ['qt', 'src', 'build', - 'install', 'dev_install', 'wininterrupt_install', - 'qtcreatorcdbext_install', 'result', + 'install', 'dev_install', 'debug_install', + 'wininterrupt_install', 'qtcreatorcdbext_install', 'result', 'elfutils', 'llvm']) build_path = os.path.abspath(args.build) install_path = os.path.join(build_path, 'install') @@ -281,6 +292,7 @@ def get_paths(args): build=os.path.join(build_path, 'build'), install=os.path.join(install_path, 'qt-creator'), dev_install=os.path.join(install_path, 'qt-creator-dev'), + debug_install=os.path.join(install_path, 'qt-creator-debug'), wininterrupt_install=os.path.join(install_path, 'wininterrupt'), qtcreatorcdbext_install=os.path.join(install_path, 'qtcreatorcdbext'), result=build_path, diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index a8d40424a9..c1b12a97f9 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -59,7 +59,9 @@ def get_arguments(): action='store_true', default=False) parser.add_argument('--build-type', help='Build type to pass to CMake (defaults to RelWithDebInfo)', default='RelWithDebInfo') - return parser.parse_args() + args = parser.parse_args() + args.with_debug_info = args.build_type == 'RelWithDebInfo' + return args def build(args, paths): if not os.path.exists(paths.build): @@ -117,6 +119,10 @@ def build(args, paths): common.check_print_call(['cmake', '--install', '.', '--prefix', paths.dev_install, '--component', 'Devel'], paths.build) + if args.with_debug_info: + common.check_print_call(['cmake', '--install', '.', '--prefix', paths.debug_install, + '--component', 'DebugInfo'], + paths.build) def package(args, paths): if not os.path.exists(paths.result): @@ -127,11 +133,15 @@ def package(args, paths): common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, args.name + '_dev.7z'), '*'], paths.dev_install) + if args.with_debug_info: + common.check_print_call(['7z', 'a', '-mmt2', + os.path.join(paths.result, args.name + '-debug.7z'), '*'], + paths.debug_install) def get_paths(args): Paths = collections.namedtuple('Paths', ['qt', 'src', 'build', 'qt_creator', - 'install', 'dev_install', 'result']) + 'install', 'dev_install', 'debug_install', 'result']) build_path = os.path.abspath(args.build) install_path = os.path.join(build_path, 'install') result_path = os.path.abspath(args.output_path) if args.output_path else build_path @@ -141,6 +151,7 @@ def get_paths(args): qt_creator=os.path.abspath(args.qtc_path), install=os.path.join(install_path, args.name), dev_install=os.path.join(install_path, args.name + '-dev'), + debug_install=os.path.join(install_path, args.name + '-debug'), result=result_path) def main(): -- cgit v1.2.3