waf: added --assert-cc-version configure option

this will allow build_binaries.py to confirm it is using the right
compiler for each build
This commit is contained in:
Andrew Tridgell 2021-07-23 08:29:12 +10:00 committed by Willian Galvani
parent ea08167626
commit 5ae741e731
2 changed files with 16 additions and 0 deletions

View File

@ -137,6 +137,13 @@ class Board:
cfg.msg("CXX Compiler", "%s %s" % (cfg.env.COMPILER_CXX, ".".join(cfg.env.CC_VERSION)))
if cfg.options.assert_cc_version:
cfg.msg("Checking compiler", "%s %s" % (cfg.options.assert_cc_version, ".".join(cfg.env.CC_VERSION)))
have_version = cfg.env.COMPILER_CXX+"-"+'.'.join(list(cfg.env.CC_VERSION))
want_version = cfg.options.assert_cc_version
if have_version != want_version:
cfg.fatal("cc version mismatch: %s should be %s" % (have_version, want_version))
if 'clang' in cfg.env.COMPILER_CC:
env.CFLAGS += [
'-fcolor-diagnostics',

View File

@ -272,6 +272,15 @@ configuration in order to save typing.
default=False,
help='force single precision postype_t')
g.add_option('--extra-hwdef',
action='store',
default=None,
help='Extra hwdef.dat file for custom build.')
g.add_option('--assert-cc-version',
default=None,
help='fail configure if not using the specified gcc version')
def _collect_autoconfig_files(cfg):
for m in sys.modules.values():
paths = []