|
| 1 | +audio_lib_cpp_args = [] |
| 2 | +audio_lib_deps = [] |
| 3 | + |
| 4 | +# nas |
| 5 | + |
| 6 | +if not get_option('audio_nas').disabled() |
| 7 | + # nas does not provide a pkg-config file, so we do the detection manually: |
| 8 | + audio_nas_dep = dependency('audio', required: false) |
| 9 | + if not audio_nas_dep.found() |
| 10 | + audio_nas_dep = cxx.find_library('audio', has_headers: 'audio/audiolib.h', required: false) |
| 11 | + if audio_nas_dep.found() |
| 12 | + audio_lib_cpp_args += '-DSUPPORT_NAS' |
| 13 | + audio_lib_deps += audio_nas_dep |
| 14 | + else |
| 15 | + assert(not get_option('audio_nas').enabled(), 'NAS enabled but dependency not found') |
| 16 | + endif |
| 17 | + endif |
| 18 | +endif |
| 19 | + |
| 20 | +# esd |
| 21 | +# esd has been removed from debian stable. Are there esd users out there? |
| 22 | +audio_esd_dep = dependency('esound', required: get_option('audio_esd')) |
| 23 | +if audio_esd_dep.found() |
| 24 | + audio_lib_cpp_args += '-DSUPPORT_ESD' |
| 25 | + audio_lib_deps += audio_esd_dep |
| 26 | +endif |
| 27 | + |
| 28 | +# sun16audio |
| 29 | +if host_machine.system() == 'sunos' # illumos and Solaris |
| 30 | + audio_lib_cpp_args += '-DSUPPORT_SUN16' |
| 31 | +endif |
| 32 | + |
| 33 | +# mplayer (disabled by default, not a robust solution) |
| 34 | +if not get_option('audio_mplayer').disabled() |
| 35 | + audio_lib_cpp_args += '-DSUPPORT_MPLAYER' |
| 36 | +endif |
| 37 | + |
| 38 | + |
| 39 | +# winmm audio |
| 40 | +if not get_option('audio_win32').disabled() and (host_machine.system() == 'windows' or host_machine.system() == 'cygwin') |
| 41 | + audio_lib_cpp_args += '-DSUPPORT_WIN32AUDIO' |
| 42 | + # Here I could try to possibly use find_library()... |
| 43 | + winmm_dep = cxx.find_library('winmm') |
| 44 | + audio_lib_deps += winmm_dep |
| 45 | +endif |
| 46 | + |
| 47 | +if host_machine.system() == 'windows' |
| 48 | + winsock2_dep = cxx.find_library('wsock32') |
| 49 | + audio_lib_deps += winsock2_dep |
| 50 | +endif |
| 51 | + |
| 52 | + |
| 53 | +# irix audio |
| 54 | +if not get_option('audio_irix').disabled() and host_machine.system().startswith('irix') |
| 55 | + irix_dep = cxx.find_library('audio', has_headers: 'audio.h', required: audio_irix) |
| 56 | + if irix_dep.found() |
| 57 | + audio_lib_cpp_args += '-DSUPPORT_IRIX' |
| 58 | + audio_lib_deps += irix_dep |
| 59 | + # usleep not available on irix 5.3: |
| 60 | + if not cxx.has_function('usleep', prefix : '#include <unistd.h>') |
| 61 | + audio_lib_cpp_args += '-DSUPPORT_IRIX53' |
| 62 | + endif |
| 63 | + endif |
| 64 | +endif |
| 65 | + |
| 66 | +# os2audio |
| 67 | +if not get_option('audio_os2').disabled() |
| 68 | + error('the meson build system for speech-tools does not support the os/2 operating system') |
| 69 | + # You will need -los2me, according to os2_audio.cc |
| 70 | +endif |
| 71 | + |
| 72 | +#macosxaudio |
| 73 | +if not get_option('audio_osx').disabled() and host_machine.system() == 'darwin' |
| 74 | + audio_lib_cpp_args += '-DSUPPORT_MACOSX_AUDIO' |
| 75 | + # Here I could try to possibly use find_library()... |
| 76 | + osx_dep = declare_dependency(link_args: ['-framework', 'CoreAudio', '-framework', 'AudioUnit', |
| 77 | + '-framework', 'AudioToolbox', '-framework', 'Cocoa']) |
| 78 | + audio_lib_deps += osx_dep |
| 79 | +endif |
| 80 | + |
| 81 | +#pulseaudio |
| 82 | +audio_pulse_dep = dependency('libpulse-simple', required: get_option('audio_pulseaudio')) |
| 83 | +if audio_pulse_dep.found() |
| 84 | + audio_lib_cpp_args += '-DSUPPORT_PULSEAUDIO' |
| 85 | + audio_lib_deps += audio_pulse_dep |
| 86 | +endif |
| 87 | + |
| 88 | + |
| 89 | +#linuxsound |
| 90 | +## alsa |
| 91 | +audio_alsa_dep = dependency('alsa', required: get_option('audio_alsa')) |
| 92 | +if audio_alsa_dep.found() |
| 93 | + audio_lib_cpp_args += '-DSUPPORT_ALSALINUX' |
| 94 | + audio_lib_deps += audio_alsa_dep |
| 95 | +endif |
| 96 | + |
| 97 | +## voxware |
| 98 | +if host_machine.system() == 'freebsd' or host_machine.system() == 'netbsd' or host_machine.system() == 'openbsd' |
| 99 | + audio_lib_cpp_args += '-DSUPPORT_FREEBSD16' |
| 100 | +endif |
| 101 | + |
| 102 | +if host_machine.system() == 'linux' and not audio_alsa_dep.found() |
| 103 | + audio_lib_cpp_args += '-DSUPPORT_VOXWARE' |
| 104 | +endif |
| 105 | + |
| 106 | +# The linux_sound.cc define logic could be cleaned up (e.g. unused SUPPORT_LINUX16) |
| 107 | + |
| 108 | + |
| 109 | +audio_lib = static_library( |
| 110 | + 'audio_lib', |
| 111 | + sources: files( |
| 112 | + 'gen_audio.cc', |
| 113 | + 'nas.cc', |
| 114 | + 'esd.cc', |
| 115 | + 'sun16audio.cc', |
| 116 | + 'mplayer.cc', |
| 117 | + 'win32audio.cc', |
| 118 | + 'irixaudio.cc', |
| 119 | + 'os2audio.cc', |
| 120 | + 'macosxaudio.cc', |
| 121 | + 'pulseaudio.cc', |
| 122 | + 'linux_sound.cc' |
| 123 | + ), |
| 124 | + include_directories : ['.', '../include/'], |
| 125 | + install: false, |
| 126 | + cpp_args: audio_lib_cpp_args, |
| 127 | + dependencies: audio_lib_deps |
| 128 | +) |
| 129 | + |
| 130 | +libestbase_conv_libs += audio_lib |
| 131 | + |
0 commit comments