Tools: ardupilotwaf: include sfml-audio

This commit is contained in:
Peter Barker 2019-03-20 13:08:51 +11:00 committed by Andrew Tridgell
parent 9c26b5bb9c
commit 156d580bcd
2 changed files with 29 additions and 0 deletions

View File

@ -346,6 +346,11 @@ class sitl(Board):
if fnmatch.fnmatch(f, "font*bin"):
env.ROMFS_FILES += [(f,'libraries/AP_OSD/fonts/'+f)]
if cfg.options.enable_sfml_audio:
if not cfg.check_SFML_Audio(env):
cfg.fatal("Failed to find SFML Audio libraries")
env.CXXFLAGS += ['-DWITH_SITL_TONEALARM']
if cfg.options.sitl_flash_storage:
env.CXXFLAGS += ['-DSTORAGE_USE_FLASH=1']

View File

@ -260,3 +260,27 @@ def check_SFML(cfg, env):
env.LIB += libs
return True
@conf
def check_SFML_Audio(cfg, env):
if not cfg.options.enable_sfml_audio:
cfg.msg("Checking for SFML audio:", 'disabled', color='YELLOW')
return False
libs = ['sfml-audio']
for lib in libs:
if not cfg.check(compiler='cxx', lib=lib, mandatory=False,
global_define=True):
cfg.fatal("Missing SFML libraries - please install libsfml-dev")
return False
# see if we need Audio.hpp or Audio.h
if not cfg.check(compiler='cxx',
fragment='''#include <SFML/Audio.hpp>\nint main() {}''', define_name="HAVE_SFML_AUDIO_HPP",
msg="Checking for Audio.hpp", mandatory=False):
if not cfg.check(compiler='cxx', fragment='''#include <SFML/Audio.h>\nint main() {}''', define_name="HAVE_SFML_AUDIO_H",
msg="Checking for Audio.h", mandatory=False):
cfg.fatal("Missing SFML headers SFML/Audio.hpp or SFML/Audio.h")
return False
env.LIB += libs
return True