From 4f7905331a88d31b93fd0d609dc84173f169e58f Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 13 Jun 2019 20:30:21 +1000 Subject: [PATCH] waf: add build option to include dates in binary --- Tools/ardupilotwaf/boards.py | 10 +++++++--- wscript | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 21ecac52ad..f4d3a0eea2 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -246,6 +246,9 @@ class Board: cfg.srcnode.find_dir('modules/uavcan/libuavcan/include').abspath() ] + if cfg.env.build_dates: + env.build_dates = True + # We always want to use PRI format macros cfg.define('__STDC_FORMAT_MACROS', 1) @@ -259,9 +262,10 @@ class Board: bld.ap_version_append_str('GIT_VERSION', bld.git_head_hash(short=True)) import time ltime = time.localtime() - bld.ap_version_append_int('BUILD_DATE_YEAR', ltime.tm_year) - bld.ap_version_append_int('BUILD_DATE_MONTH', ltime.tm_mon) - bld.ap_version_append_int('BUILD_DATE_DAY', ltime.tm_mday) + if bld.env.build_dates: + bld.ap_version_append_int('BUILD_DATE_YEAR', ltime.tm_year) + bld.ap_version_append_int('BUILD_DATE_MONTH', ltime.tm_mon) + bld.ap_version_append_int('BUILD_DATE_DAY', ltime.tm_mday) def embed_ROMFS_files(self, ctx): '''embed some files using AP_ROMFS''' diff --git a/wscript b/wscript index 883da81d5b..b8a68c674a 100644 --- a/wscript +++ b/wscript @@ -196,6 +196,10 @@ configuration in order to save typing. default=False, help="Enable SITL RGBLed") + g.add_option('--build-dates', action='store_true', + default=False, + help="Include build date in binaries. Appears in AUTOPILOT_VERSION.os_sw_version") + g.add_option('--sitl-flash-storage', action='store_true', default=False,