mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
waf: add --define command-line option
Allows CPP defines to be specified on command-line Eases enable/disable of optional features
This commit is contained in:
parent
6c17fd7bac
commit
c0243772b4
@ -563,6 +563,10 @@ arducopter and upload it to my board".
|
||||
action='store_true',
|
||||
help='Output all test programs.')
|
||||
|
||||
g.add_option('--define',
|
||||
action='append',
|
||||
help='Add C++ define to build.')
|
||||
|
||||
g = opt.ap_groups['clean']
|
||||
|
||||
g.add_option('--clean-all-sigs',
|
||||
|
@ -136,6 +136,13 @@ class Board:
|
||||
# make easy to override them. Convert back to list before consumption.
|
||||
env.DEFINES = {}
|
||||
|
||||
# potentially set extra defines from an environment variable:
|
||||
if cfg.options.define is not None:
|
||||
for (n, v) in [d.split("=") for d in cfg.options.define]:
|
||||
cfg.msg("Defining: %s" % (n, ), v)
|
||||
env.CFLAGS += ['-D%s=%s' % (n, v)]
|
||||
env.CXXFLAGS += ['-D%s=%s' % (n, v)]
|
||||
|
||||
env.CFLAGS += [
|
||||
'-ffunction-sections',
|
||||
'-fdata-sections',
|
||||
|
Loading…
Reference in New Issue
Block a user