Skip to content

Commit f6de8ae

Browse files
peterbarkertpwrules
authored andcommitted
waf: accept entirely lower case values for BUILD_OPTIONS options
1 parent 1141fed commit f6de8ae

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Tools/ardupilotwaf/boards.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ def srcpath(path):
191191
for opt in build_options.BUILD_OPTIONS:
192192
enable_option = opt.config_option().replace("-","_")
193193
disable_option = "disable_" + enable_option[len("enable-"):]
194-
if getattr(cfg.options, enable_option, False):
194+
lower_disable_option = disable_option.lower().replace("_", "-")
195+
lower_enable_option = enable_option.lower().replace("_", "-")
196+
if getattr(cfg.options, enable_option, False) or getattr(cfg.options, lower_enable_option, False):
195197
env.CXXFLAGS += ['-D%s=1' % opt.define]
196198
cfg.msg("Enabled %s" % opt.label, 'yes', color='GREEN')
197-
elif getattr(cfg.options, disable_option, False):
199+
elif getattr(cfg.options, disable_option, False) or getattr(cfg.options, lower_disable_option, False):
198200
env.CXXFLAGS += ['-D%s=0' % opt.define]
199201
cfg.msg("Enabled %s" % opt.label, 'no', color='YELLOW')
200202

wscript

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,21 @@ def add_build_options(g):
111111
default=False,
112112
help=disable_description)
113113

114+
# also add entirely-lower-case equivalents with underscores
115+
# replaced with dashes::
116+
lower_enable_option = enable_option.lower().replace("_", "-")
117+
if lower_enable_option != enable_option:
118+
g.add_option(lower_enable_option,
119+
action='store_true',
120+
default=False,
121+
help=enable_description)
122+
lower_disable_option = disable_option.lower().replace("_", "-")
123+
if lower_disable_option != disable_option:
124+
g.add_option(lower_disable_option,
125+
action='store_true',
126+
default=False,
127+
help=disable_description)
128+
114129
def add_script_options(g):
115130
'''add any drivers or applets from libraries/AP_Scripting'''
116131
driver_list = glob.glob(os.path.join(Context.run_dir, "libraries/AP_Scripting/drivers/*.lua"))

0 commit comments

Comments
 (0)