aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoerg Kreuzberger <j.kreuzberger@procitec.de>2021-10-05 07:40:58 +0200
committerCristian Adam <cristian.adam@qt.io>2021-11-05 09:03:41 +0000
commitefdaeaba43fdf55282298d78202f814238e4f59a (patch)
tree716c0c9af781e4b9bc080dc86762cbe14cc26464 /scripts
parent9e8b8380800655705d7f516a541a448091ff2b56 (diff)
Add option to build QtCreator with sanitizer
Fixes: QTCREATORBUG-26318 Change-Id: I44589b5bb39958eda2329b444e4857e8f61823bf Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.py7
-rwxr-xr-xscripts/build_plugin.py6
2 files changed, 13 insertions, 0 deletions
diff --git a/scripts/build.py b/scripts/build.py
index 776914175c..91ccd5bae1 100755
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -109,6 +109,9 @@ def get_arguments():
parser.add_argument('--zip-threads', help='Sets number of threads to use for 7z. Use "+" for turning threads on '
'without a specific number of threads. This is directly passed to the "-mmt" option of 7z.',
default='2')
+ parser.add_argument('--add-sanitize-flags', help="Sets flags for sanitizer compilation flags used in Debug builds",
+ action='append', dest='sanitize_flags', default=[] )
+
args = parser.parse_args()
args.with_debug_info = args.build_type == 'RelWithDebInfo'
@@ -185,6 +188,10 @@ def build_qtcreator(args, paths):
'-DIDE_REVISION_STR=' + ide_revision[:10],
'-DIDE_REVISION_URL=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id=' + ide_revision]
+ if not args.build_type.lower() == 'release' and args.sanitize_flags:
+ cmake_args += ['-DWITH_SANITIZE=ON',
+ '-DSANITIZE_FLAGS=' + ",".join(args.sanitize_flags)]
+
cmake_args += args.config_args
common.check_print_call(cmake_args + [paths.src], paths.build)
diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py
index 7ba55ef38d..16a51efed5 100755
--- a/scripts/build_plugin.py
+++ b/scripts/build_plugin.py
@@ -56,6 +56,8 @@ def get_arguments():
action='append', dest='config_args', default=[])
parser.add_argument('--with-docs', help='Build and install documentation.',
action='store_true', default=False)
+ parser.add_argument('--add-sanitize-flags', help="Sets flags for sanitizer compilation flags used in Debug builds",
+ action='append', dest='sanitize_flags', default=[] )
parser.add_argument('--deploy', help='Installs the "Dependencies" component of the plugin.',
action='store_true', default=False)
parser.add_argument('--build-type', help='Build type to pass to CMake (defaults to RelWithDebInfo)',
@@ -110,6 +112,10 @@ def build(args, paths):
with open(os.path.join(paths.result, args.name + '.7z.git_sha'), 'w') as f:
f.write(ide_revision)
+ if not args.build_type.lower() == 'release' and args.sanitize_flags:
+ cmake_args += ['-DWITH_SANITIZE=ON',
+ '-DSANITIZE_FLAGS=' + ",".join(args.sanitize_flags)]
+
cmake_args += args.config_args
common.check_print_call(cmake_args + [paths.src], paths.build)
build_args = ['cmake', '--build', '.']