From aa5502926fdb1d1b45f7cb0ed8570d90f84532eb Mon Sep 17 00:00:00 2001 From: Arnaud Rebillout Date: Wed, 28 Nov 2018 15:42:25 +0700 Subject: [PATCH] meson: Add ORC support Signed-off-by: Arnaud Rebillout --- meson.build | 18 ++++++++++++++---- meson_options.txt | 3 +++ src/modules/meson.build | 29 ++++++++++++++++++++--------- src/pulsecore/meson.build | 24 +++++++++++++++++++++--- src/tests/meson.build | 1 + 5 files changed, 59 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 7e204c584..efe5f0f48 100644 --- a/meson.build +++ b/meson.build @@ -342,6 +342,19 @@ if gtk_dep.found() cdata.set('HAVE_GTK', 1) endif +have_orcc = false +orcc_args = [] +orc_dep = dependency('orc-0.4', version : '>= 0.4.11', required : get_option('orc')) +orcc = find_program('orcc', required : get_option('orc')) +if orc_dep.found() and orcc.found() + have_orcc = true + orcc_args = [orcc] + #orcc_args = [orcc, '--include', 'glib.h'] + cdata.set('HAVE_ORC', 1) +else + cdata.set('DISABLE_ORC', 1) +endif + samplerate_dep = dependency('samplerate', version : '>= 0.1.0', required : get_option('samplerate')) if samplerate_dep.found() cdata.set('HAVE_LIBSAMPLERATE', 1) @@ -374,9 +387,6 @@ if x11_dep.found() cdata.set('HAVE_X11', 1) endif -# FIXME: support ORC -cdata.set('DISABLE_ORC', 1) - # Module dependencies if cc.has_header('sys/soundcard.h') @@ -590,7 +600,7 @@ summary = [ 'Enable IPv6: @0@'.format(get_option('ipv6')), 'Enable OpenSSL (for Airtunes): @0@'.format(openssl_dep.found()), 'Enable FFTW: @0@'.format(fftw_dep.found()), -# 'Enable orc: @0@'.format(${ENABLE_ORC}), + 'Enable ORC: @0@'.format(have_orcc), 'Enable Adrian echo canceller: @0@'.format(get_option('adrian-aec')), 'Enable Speex (resampler, AEC): @0@'.format(speex_dep.found()), 'Enable SoXR (resampler): @0@'.format(soxr_dep.found()), diff --git a/meson_options.txt b/meson_options.txt index df49710c2..8a2663ceb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -93,6 +93,9 @@ option('lirc', option('openssl', type : 'feature', value : 'auto', description : 'Optional OpenSSL support (used for Airtunes/RAOP)') +option('orc', + type : 'feature', value : 'auto', + description : 'Optimized Inner Loop Runtime Compiler') option('samplerate', type : 'feature', value : 'disabled', description : 'Optional libsamplerate support (DEPRECATED)') diff --git a/src/modules/meson.build b/src/modules/meson.build index 1bc01b731..61ff7fa48 100644 --- a/src/modules/meson.build +++ b/src/modules/meson.build @@ -206,6 +206,7 @@ module_echo_cancel_sources = [ 'echo-cancel/module-echo-cancel.c', 'echo-cancel/null.c', ] +module_echo_cancel_orc_sources = [] module_echo_cancel_flags = [] module_echo_cancel_deps = [] module_echo_cancel_libs = [] @@ -216,15 +217,25 @@ if get_option('adrian-aec') 'echo-cancel/adrian-aec.c', 'echo-cancel/adrian-aec.h', ] module_echo_cancel_flags += ['-DHAVE_ADRIAN_EC=1'] - module_echo_cancel_deps = [libm_dep] -endif + module_echo_cancel_deps += [libm_dep] + + if have_orcc + orcsrc = 'adrian-aec' + orc_h = custom_target(orcsrc + '-orc-gen.h', + input : join_paths('echo-cancel', orcsrc + '.orc'), + output : orcsrc + '-orc-gen.h', + command : orcc_args + ['--header', '-o', '@OUTPUT@', '@INPUT@'] + ) + orc_c = custom_target(orcsrc + '-orc-gen.c', + input : join_paths('echo-cancel', orcsrc + '.orc'), + output : orcsrc + '-orc-gen.c', + command : orcc_args + ['--implementation', '-o', '@OUTPUT@', '@INPUT@'] + ) + module_echo_cancel_orc_sources += [orc_c, orc_h] + module_echo_cancel_deps += [orc_dep] + endif -# FIXME: support ORC (depends on Adrian) -#ORC_SOURCE += modules/echo-cancel/adrian-aec -#module_echo_cancel_sources += [ -# 'echo-cancel/adrian-aec-orc-gen.c', 'echo-cancel/adrian-aec-orc-gen.h' -#] -#module_echo_cancel_deps += [orc_dep] +endif if speex_dep.found() module_echo_cancel_sources += ['echo-cancel/speex.c'] @@ -238,7 +249,7 @@ endif all_modules += [ [ 'module-echo-cancel', - module_echo_cancel_sources, + module_echo_cancel_sources + module_echo_cancel_orc_sources, [], module_echo_cancel_flags, module_echo_cancel_deps, diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build index 9901fded4..48cc79ff4 100644 --- a/src/pulsecore/meson.build +++ b/src/pulsecore/meson.build @@ -145,6 +145,24 @@ if x11_dep.found() libpulsecore_headers += ['x11wrap.h'] endif +orc_sources = [] +orc_headers = [] +if have_orcc + orcsrc = 'svolume' + orc_h = custom_target(orcsrc + '-ocr-gen.h', + input : orcsrc + '.orc', + output : orcsrc + '-orc-gen.h', + command : orcc_args + ['--header', '-o', '@OUTPUT@', '@INPUT@'] + ) + orc_c = custom_target(orcsrc + '-orc-gen.c', + input : orcsrc + '.orc', + output : orcsrc + '-orc-gen.c', + command : orcc_args + ['--implementation', '-o', '@OUTPUT@', '@INPUT@'] + ) + orc_sources = [orc_c, 'svolume_orc.c'] + orc_headers = [orc_h] +endif + # FIXME: walk through dependencies and add files # FIXME: SIMD support (ORC) @@ -167,14 +185,14 @@ cdata.merge_from(libpulsecore_simd[1]) #'thread-win32.c', libpulsecore = shared_library('pulsecore-' + pa_version_major_minor, - libpulsecore_sources, - libpulsecore_headers, + libpulsecore_sources, libpulsecore_headers, + orc_sources, orc_headers, include_directories : [configinc, topinc], c_args : [pa_c_args, server_c_args], install : true, install_dir : privlibdir, link_with : libpulsecore_simd_lib, - dependencies : [libm_dep, libpulsecommon_dep, libpulse_dep, ltdl_dep, shm_dep, sndfile_dep, database_dep, dbus_dep, samplerate_dep, soxr_dep, speex_dep, x11_dep], + dependencies : [libm_dep, libpulsecommon_dep, libpulse_dep, ltdl_dep, shm_dep, sndfile_dep, database_dep, dbus_dep, orc_dep, samplerate_dep, soxr_dep, speex_dep, x11_dep], implicit_include_directories : false) libpulsecore_dep = declare_dependency(link_with: libpulsecore) diff --git a/src/tests/meson.build b/src/tests/meson.build index d5d4a91d4..b995b5c3f 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -139,6 +139,7 @@ echo_cancel_test_sources = [] foreach s : module_echo_cancel_sources echo_cancel_test_sources += '../modules/' + s endforeach +echo_cancel_test_sources += module_echo_cancel_orc_sources norun_tests += [ [ 'echo-cancel-test', echo_cancel_test_sources, -- 2.34.1