waf: Enable Werror by default and add option to disable it

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
This commit is contained in:
Ryan Friedman 2023-05-29 18:35:11 -06:00 committed by Andrew Tridgell
parent 17ba7180d1
commit ae20754ab9
1 changed files with 12 additions and 1 deletions

13
wscript
View File

@ -143,8 +143,13 @@ def options(opt):
g.add_option('--Werror', g.add_option('--Werror',
action='store_true', action='store_true',
default=False, default=True,
help='build with -Werror.') help='build with -Werror.')
g.add_option('--disable-Werror',
action='store_true',
default=False,
help='Disable -Werror.')
g.add_option('--toolchain', g.add_option('--toolchain',
action='store', action='store',
@ -584,6 +589,12 @@ def configure(cfg):
# Always use system extensions # Always use system extensions
cfg.define('_GNU_SOURCE', 1) cfg.define('_GNU_SOURCE', 1)
if cfg.options.Werror:
if cfg.options.disable_Werror:
raise ValueError("Cannot enable and disable Werror at the same time")
else:
cfg.options.Werror = not cfg.options.disable_Werror
cfg.write_config_header(os.path.join(cfg.variant, 'ap_config.h'), guard='_AP_CONFIG_H_') cfg.write_config_header(os.path.join(cfg.variant, 'ap_config.h'), guard='_AP_CONFIG_H_')
# add in generated flags # add in generated flags