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
parent aa0a77049e
commit 66bad7b885
2 changed files with 11 additions and 0 deletions

View File

@ -156,6 +156,13 @@ class Board:
cfg.msg("CXX Compiler", "%s %s" % (cfg.env.COMPILER_CXX, ".".join(cfg.env.CC_VERSION))) 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: if 'clang' in cfg.env.COMPILER_CC:
env.CFLAGS += [ env.CFLAGS += [
'-fcolor-diagnostics', '-fcolor-diagnostics',

View File

@ -286,6 +286,10 @@ configuration in order to save typing.
default=None, default=None,
help='Extra hwdef.dat file for custom build.') 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): def _collect_autoconfig_files(cfg):
for m in sys.modules.values(): for m in sys.modules.values():
paths = [] paths = []