waf: support --enable-osd option

This commit is contained in:
Andrew Tridgell 2018-07-01 20:10:08 +10:00
parent 35192a6162
commit 355269115e
2 changed files with 18 additions and 1 deletions

View File

@ -262,6 +262,11 @@ class sitl(Board):
'SITL', 'SITL',
] ]
if cfg.options.enable_osd:
env.LIB += ['sfml-graphics', 'sfml-window','sfml-system']
env.CXXFLAGS += ['-DWITH_SITL_OSD','-DOSD_ENABLED=ENABLED','-DHAL_HAVE_AP_ROMFS_EMBEDDED_H']
self.embed_files(cfg, [('osd_font.bin','libraries/AP_OSD/fonts/clarity.bin')])
if sys.platform == 'cygwin': if sys.platform == 'cygwin':
env.LIB += [ env.LIB += [
'winmm', 'winmm',
@ -274,7 +279,15 @@ class sitl(Board):
env.CXXFLAGS += [ env.CXXFLAGS += [
'-fno-slp-vectorize' # compiler bug when trying to use SLP '-fno-slp-vectorize' # compiler bug when trying to use SLP
] ]
def embed_files(self, cfg, files):
'''embed some files using AP_ROMFS'''
header = cfg.bldnode.make_node('sitl/ap_romfs_embedded.h').abspath()
paths = []
embed_path = cfg.srcnode.make_node('libraries/AP_HAL_ChibiOS/hwdef/scripts').abspath()
sys.path.append(embed_path)
import embed
embed.create_embedded_h(header, files)
class chibios(Board): class chibios(Board):
toolchain = 'arm-none-eabi' toolchain = 'arm-none-eabi'

View File

@ -138,6 +138,10 @@ configuration in order to save typing.
default=False, default=False,
help="Disable compilation and test execution") help="Disable compilation and test execution")
g.add_option('--enable-osd', action='store_true',
default=False,
help="Enable OSD display")
g.add_option('--static', g.add_option('--static',
action='store_true', action='store_true',
default=False, default=False,