From 5ae741e73118f68c3cd44410c80c494586c77b43 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 23 Jul 2021 08:29:12 +1000 Subject: [PATCH] waf: added --assert-cc-version configure option this will allow build_binaries.py to confirm it is using the right compiler for each build --- Tools/ardupilotwaf/boards.py | 7 +++++++ wscript | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 36424299e6..8ad522b8aa 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -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', diff --git a/wscript b/wscript index 2effc8117d..0058eab835 100644 --- a/wscript +++ b/wscript @@ -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 = []