1jack_sources = [ 2 'gstjackaudioclient.c', 3 'gstjackaudiosink.c', 4 'gstjackaudiosrc.c', 5 'gstjack.c', 6 'gstjackutil.c', 7] 8 9jack_option = get_option('jack') 10if jack_option.disabled() 11 subdir_done() 12endif 13 14jack_incdirs = [configinc, libsinc] 15 16libjack_dep = dependency('jack', version : '>= 1.9.7', required : false) 17 18if not libjack_dep.found() 19 fs = import('fs') 20 host_cpu = host_machine.cpu_family() 21 jack_maybe_installed = false 22 error_msg = '"jack" option is enabled but ' 23 if (host_system == 'windows' and build_machine.system() == 'windows') 24 # Need to detect whether we're running on 64-bit Windows or not. 25 # If `C:/Program Files (x86)/` exists, we're running on 64-bit Windows, and 26 # C:/Program Files/ contains 64-bit programs. Else, we're on 32-bit Windows 27 # and C:/Program Files/ contains 32-bit programs. 28 # 29 # The user could either have a 32-bit JACK installation or a 64-bit one. 30 # When building for 32-bit x86, we need to check for both. 31 if fs.is_dir('C:/Program Files (x86)') 32 jack64_install_dir = 'C:/Program Files/JACK2' 33 jack32_install_dir = 'C:/Program Files (x86)/JACK2' 34 else 35 jack64_install_dir = '' 36 jack32_install_dir = 'C:/Program Files/JACK2' 37 endif 38 39 if host_cpu == 'x86' 40 jack_install_dir = jack32_install_dir 41 jack_maybe_installed = fs.is_dir(jack32_install_dir / 'include') 42 if not jack_maybe_installed and jack64_install_dir != '' 43 jack_maybe_installed = fs.is_dir(jack64_install_dir / 'include') 44 jack_install_dir = jack64_install_dir 45 endif 46 elif jack64_install_dir != '' 47 jack_maybe_installed = import('fs').is_dir(jack64_install_dir / 'include') 48 jack_install_dir = jack64_install_dir 49 endif 50 51 error_msg += 'JACK2 installation could not be found' 52 else 53 error_msg += 'JACK dependency could not be found' 54 endif 55 56 if not jack_maybe_installed 57 if jack_option.enabled() 58 error(error_msg) 59 endif 60 subdir_done() 61 endif 62 63 if not host_cpu.startswith('x86') 64 if jack_option.enabled() 65 error('On Windows, JACK only supports x86 32-bit and 64-bit') 66 endif 67 subdir_done() 68 endif 69 70 if host_cpu == 'x86' 71 jack_libname = 'libjack' 72 if jack_install_dir == jack64_install_dir 73 jack_libdir = jack_install_dir / 'lib32' 74 else 75 jack_libdir = jack_install_dir / 'lib' 76 endif 77 else 78 jack_libname = 'libjack64' 79 jack_libdir = jack_install_dir / 'lib' 80 endif 81 82 inc = include_directories(jack_install_dir / 'include') 83 libjack_dep = cc.find_library(jack_libname, 84 dirs: jack_libdir, 85 has_headers: 'jack/jack.h', 86 header_include_directories: inc, 87 required: jack_option) 88 # This won't be needed once we require a meson version that includes this: 89 # https://github.com/mesonbuild/meson/pull/10428 90 jack_incdirs += inc 91endif 92 93gstjack = library('gstjack', 94 jack_sources, 95 c_args : gst_plugins_good_args + ['-DHAVE_JACK_1_9_7'], 96 include_directories : jack_incdirs, 97 dependencies : [gst_dep, gstbase_dep, gstaudio_dep, libjack_dep], 98 install : true, 99 install_dir : plugins_install_dir, 100) 101pkgconfig.generate(gstjack, install_dir : plugins_pkgconfig_install_dir) 102plugins += [gstjack] 103