diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 2ecb4c0196..b444e8523d 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -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'] diff --git a/Tools/ardupilotwaf/cxx_checks.py b/Tools/ardupilotwaf/cxx_checks.py index 3944d06a70..96d4816065 100644 --- a/Tools/ardupilotwaf/cxx_checks.py +++ b/Tools/ardupilotwaf/cxx_checks.py @@ -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 \nint main() {}''', define_name="HAVE_SFML_AUDIO_HPP", + msg="Checking for Audio.hpp", mandatory=False): + if not cfg.check(compiler='cxx', fragment='''#include \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 +