Commit eb398328 authored by Matthew Waters's avatar Matthew Waters 🐨
Browse files

Initial meson build files

parent e882a544
poject('webrtc-audio-processing', 'c', 'cpp',
version : '0.3.1',
meson_version : '>= 0.47',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])
soversion = 0
cc = meson.get_compiler('c')
host_system = host_machine.system()
platform_cflags = []
os_cflags = []
os_deps = []
have_posix = false
have_win = false
if ['darwin', 'ios'].contains(host_system)
os_cflags = ['-DWEBRTC_MAC', '-DWEBRTC_THREAD_RR', '-DWEBRTC_CLOCK_TYPE_REALTIME']
if host_system == 'ios'
os_cflags += ['-DWEBRTC_IOS']
endif
platform_cflags += ['-D WEBRTC_POSIX']
have_posix = true
elif host_system == 'android'
os_cflags += ['-DWEBRTC_ANDROID', '-DWEBRTC_LINUX', '-DWEBRTC_THREAD_RR', '-DWEBRTC_CLOCK_TYPE_REALTIME']
os_deps += [cc.find_library('log')]
os_deps += [dependency('gnustl', required : get_option('gnustl'))]
platform_cflags += ['-DWEBRTC_POSIX']
have_posix = true
elif host_system == 'linux'
os_cflags += ['-DWEBRTC_LINUX', '-DWEBRTC_THREAD_RR']
os_deps += [cc.find_library('rt', required : false)]
os_deps += [dependency('threads')]
platform_cflags += ['-DWEBRTC_POSIX']
have_posix = true
elif host_system == 'windows'
platform_cflags += ['-DWEBRTC_WIN', '-D_WIN32', '-U__STRICT_ANSI__']
os_deps += [cc.find_library('winmm')]
have_win = true
endif
arch_cflags = []
have_arm = false
have_armv7 = false
have_neon = false
have_x86 = false
if ['arm', 'armv7', 'aarch64'].contains(host_machine.cpu_family())
have_arm = true
arch_cflags = ['-DWEBRTC_ARCH_ARM']
if cc.compiles('''#ifndef __ARM_ARCH_7A__
#error no armv7 arch
#endif''')
have_armv7 = true
arch_cflags = ['-DWEBRTC_ARCH_ARM_V7']
endif
if cc.compiles('''#ifndef __aarch64__
#error no aarch64 arch
#endif''')
have_neon = true
arch_cflags = ['-DWEBRTC_ARCH_ARM64', '-DWEBRTC_HAS_NEON']
endif
endif
if ['x86', 'x86_64'].contains(host_machine.cpu_family())
have_x86 = true
endif
neon_opt = get_option('neon')
if neon_opt != 'no'
if neon_opt != 'runtime'
if cc.compiles('#include <arm_neon.h>', args : '-mfpu=neon')
arch_cflags += ['-mfpu=neon', '-DWEBRTC_HAS_NEON']
have_neon = true
endif
else
neon_opt += ['-DWEBRTC_DETECT_NEON', '-mfpu=neon']
have_neon = true
endif
endif
noise_cflags = []
if get_option('ns_mode') == 'float'
noise_cflags += ['-DWEBRTC_NS_FLOAT=1']
else
noise_cflags += ['-DWEBRTC_NS_FIXED=1']
endif
common_cflags = ['-DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD', '-DNDEBUG'] + platform_cflags + os_cflags + arch_cflags + noise_cflags
common_cxxflags = ['-std=c++11'] + common_cflags
common_deps = os_deps
webrtc_inc = include_directories('.')
subdir('webrtc')
pkgconfig = import('pkgconfig')
pkgconfig.generate(
name: 'webrtc-audio-processing',
description: 'WebRTC Audio Processing library',
version: meson.project_version(),
filebase: 'webrtc-audio-processing',
subdirs: 'webrtc_audio_processing',
extra_cflags: [
'-DWEBRTC_AUDIO_PROCESSING_ONLY_BUILD',
] + platform_cflags,
# XXX: passing the libwebrtc_audio_processing object result in adding not-installed libraries to Libs.private
libraries: '-lwebrtc_audio_processing',
libraries_private: common_deps,
)
option('ns_mode', type: 'combo',
choices : ['float', 'fixed'],
description: 'Noise suppresion mode to use.')
option('gnustl', type: 'feature',
value: 'auto',
description: 'Use gnustl for a c++ library implementation (only used on Android)')
option('neon', type: 'combo',
choices: ['no', 'yes', 'auto', 'runtime'],
description: '')
base_sources = [
'criticalsection.cc',
'checks.cc',
'event.cc',
'platform_thread.cc',
'platform_file.cc',
'stringutils.cc',
'thread_checker_impl.cc',
]
base_headers = [
'arraysize.h',
'checks.h',
'constructormagic.h',
'basictypes.h',
'maybe.h',
'platform_file.h',
]
install_headers(base_headers,
subdir: 'webrtc_audio_processing/webrtc/base'
)
libbase = static_library('libbase',
base_sources,
dependencies: common_deps,
include_directories: webrtc_inc,
cpp_args : common_cxxflags
)
base_dep = declare_dependency(
link_with: libbase
)
common_audio_sources = [
'resampler/push_resampler.cc',
'resampler/push_sinc_resampler.cc',
'resampler/resampler.cc',
'resampler/sinc_resampler.cc',
'resampler/sinusoidal_linear_chirp_source.cc',
'signal_processing/auto_corr_to_refl_coef.c',
'signal_processing/auto_correlation.c',
'signal_processing/complex_fft.c',
'signal_processing/copy_set_operations.c',
'signal_processing/cross_correlation.c',
'signal_processing/division_operations.c',
'signal_processing/dot_product_with_scale.c',
'signal_processing/downsample_fast.c',
'signal_processing/energy.c',
'signal_processing/filter_ar.c',
'signal_processing/filter_ma_fast_q12.c',
'signal_processing/get_hanning_window.c',
'signal_processing/get_scaling_square.c',
'signal_processing/ilbc_specific_functions.c',
'signal_processing/levinson_durbin.c',
'signal_processing/lpc_to_refl_coef.c',
'signal_processing/min_max_operations.c',
'signal_processing/randomization_functions.c',
'signal_processing/real_fft.c',
'signal_processing/refl_coef_to_lpc.c',
'signal_processing/resample.c',
'signal_processing/resample_48khz.c',
'signal_processing/resample_by_2.c',
'signal_processing/resample_by_2_internal.c',
'signal_processing/resample_fractional.c',
'signal_processing/spl_init.c',
'signal_processing/spl_sqrt.c',
'signal_processing/splitting_filter.c',
'signal_processing/sqrt_of_one_minus_x_squared.c',
'signal_processing/vector_scaling_operations.c',
'vad/vad.cc',
'vad/vad_core.c',
'vad/vad_filterbank.c',
'vad/vad_gmm.c',
'vad/vad_sp.c',
'vad/webrtc_vad.c',
'audio_converter.cc',
'audio_ring_buffer.cc',
'audio_util.cc',
'blocker.cc',
'channel_buffer.cc',
'fft4g.c',
'fir_filter.cc',
'lapped_transform.cc',
'real_fourier.cc',
'real_fourier_ooura.cc',
'ring_buffer.c',
'sparse_fir_filter.cc',
'wav_file.cc',
'wav_header.cc',
'window_generator.cc',
]
arch_libs = []
if have_x86
arch_libs += [static_library('common_audio_sse2',
['resampler/sinc_resampler_sse.cc', 'fir_filter_sse.cc'],
dependencies: common_deps,
include_directories: webrtc_inc,
c_args: common_cflags + ['-msse2'],
cpp_args: common_cxxflags + ['-msse2'])]
endif
if have_arm
common_audio_sources += [
'signal_processing/complex_bit_reverse_arm.S',
'signal_processing/spl_sqrt_floor_arm.S',
]
endif
if have_armv7
common_audio_sources += [
'signal_processing/filter_ar_fast_q12_armv7.S',
]
endif
if have_neon
common_audio_sources += [
'resampler/sinc_resampler_neon.cc',
'signal_processing/cross_correlation_neon.c',
'signal_processing/downsample_fast_neon.c',
'signal_processing/min_max_operations_neon.c',
'fir_filter_neon.cc',
]
endif
if not have_arm
common_audio_sources += [
'signal_processing/complex_bit_reverse.c',
'signal_processing/filter_ar_fast_q12.c',
'signal_processing/spl_sqrt_floor.c',
]
endif
libcommon_audio = static_library('common_audio',
common_audio_sources,
dependencies: common_deps,
include_directories: webrtc_inc,
c_args: common_cflags,
cpp_args: common_cxxflags
)
common_audio_dep = declare_dependency(
link_with: [libcommon_audio] + arch_libs,
)
webrtc_sources = [
'common_types.cc'
]
webrtc_headers = [
'common.h',
'common_types.h',
'typedefs.h',
]
install_headers(webrtc_headers,
subdir: 'webrtc_audio_processing/webrtc'
)
libwebrtc = static_library('webrtc',
webrtc_sources,
dependencies: common_deps,
include_directories: webrtc_inc,
c_args: common_cflags,
cpp_args: common_cxxflags
)
webrtc_dep = declare_dependency(
link_with: libwebrtc
)
subdir('base')
subdir('common_audio')
subdir('system_wrappers')
subdir('modules')
audio_coding_sources = [
'codecs/isac/main/source/arith_routines.c',
'codecs/isac/main/source/arith_routines_hist.c',
'codecs/isac/main/source/arith_routines_logist.c',
'codecs/isac/main/source/encode_lpc_swb.c',
'codecs/isac/main/source/entropy_coding.c',
'codecs/isac/main/source/filter_functions.c',
'codecs/isac/main/source/filterbanks.c',
'codecs/isac/main/source/filterbank_tables.c',
'codecs/isac/main/source/intialize.c',
'codecs/isac/main/source/lpc_analysis.c',
'codecs/isac/main/source/lpc_gain_swb_tables.c',
'codecs/isac/main/source/lpc_shape_swb12_tables.c',
'codecs/isac/main/source/lpc_shape_swb16_tables.c',
'codecs/isac/main/source/lpc_tables.c',
'codecs/isac/main/source/pitch_estimator.c',
'codecs/isac/main/source/pitch_filter.c',
'codecs/isac/main/source/pitch_gain_tables.c',
'codecs/isac/main/source/pitch_lag_tables.c',
'codecs/isac/main/source/spectrum_ar_model_tables.c',
]
libaudio_coding = static_library('audio_coding',
audio_coding_sources,
dependencies: common_deps,
include_directories: webrtc_inc,
c_args: common_cflags,
cpp_args: common_cxxflags
)
audio_coding_dep = declare_dependency(
link_with: libaudio_coding
)
webrtc_audio_processing_sources = [
'aec/aec_core.c',
'aec/aec_rdft.c',
'aec/aec_resampler.c',
'aec/echo_cancellation.c',
'aecm/echo_control_mobile.c',
'aecm/aecm_core.c',
'aecm/aecm_core_c.c',
'agc/legacy/analog_agc.c',
'agc/legacy/digital_agc.c',
'agc/agc.cc',
'agc/agc_manager_direct.cc',
'agc/histogram.cc',
'agc/utility.cc',
'beamformer/array_util.cc',
'beamformer/covariance_matrix_generator.cc',
'beamformer/nonlinear_beamformer.cc',
'intelligibility/intelligibility_enhancer.cc',
'intelligibility/intelligibility_utils.cc',
'logging/aec_logging_file_handling.cc',
'transient/click_annotate.cc',
'transient/file_utils.cc',
'transient/moving_moments.cc',
'transient/transient_detector.cc',
'transient/transient_suppressor.cc',
'transient/wpd_node.cc',
'transient/wpd_tree.cc',
'utility/delay_estimator.c',
'utility/delay_estimator_wrapper.c',
'vad/gmm.cc',
'vad/pitch_based_vad.cc',
'vad/pitch_internal.cc',
'vad/pole_zero_filter.cc',
'vad/standalone_vad.cc',
'vad/vad_audio_proc.cc',
'vad/vad_circular_buffer.cc',
'vad/voice_activity_detector.cc',
'audio_buffer.cc',
'audio_processing_impl.cc',
'audio_processing_impl.h',
'echo_cancellation_impl.cc',
'echo_control_mobile_impl.cc',
'gain_control_impl.cc',
'high_pass_filter_impl.cc',
'level_estimator_impl.cc',
'noise_suppression_impl.cc',
'rms_level.cc',
'splitting_filter.cc',
'processing_component.cc',
'three_band_filter_bank.cc',
'typing_detection.cc',
'voice_detection_impl.cc',
]
webrtc_audio_processing_beamformer_headers = [
'beamformer/array_util.h',
]
webrtc_audio_processing_include_headers = [
'include/audio_processing.h',
]
if get_option('ns_mode') == 'float'
webrtc_audio_processing_sources += [
'ns/noise_suppression.c',
'ns/ns_core.c',
]
else
webrtc_audio_processing_sources += [
'ns/noise_suppression_x.c',
'ns/nsx_core.c',
'ns/nsx_core_c.c',
]
if have_neon
webrtc_audio_processing_sources += [
'ns/nsx_core_neon.c',
]
endif
endif
extra_libs = []
if have_x86
extra_libs += [
static_library('webrtc_audio_processing_privatearch',
['aec/aec_core_sse2.c', 'aec/aec_rdft_sse2.c'],
dependencies: common_deps,
include_directories: webrtc_inc,
c_args: common_cflags + ['-msse2'],
cpp_args: common_cxxflags + ['-msse2']
)
]
endif
if have_neon
webrtc_audio_processing_sources += [
'aec/aec_core_neon.c',
'aec/aec_rdft_neon.c',
'aecm/aecm_core_neon.c',
]
endif
install_headers(webrtc_audio_processing_beamformer_headers,
subdir: 'webrtc_audio_processing/webrtc/modules/audio_processing/beamformer'
)
install_headers(webrtc_audio_processing_include_headers,
subdir: 'webrtc_audio_processing/webrtc/modules/audio_processing/include'
)
libwebrtc_audio_processing = library('webrtc_audio_processing',
webrtc_audio_processing_sources,
dependencies: [base_dep, audio_coding_dep, system_wrappers_dep, common_audio_dep, audio_coding_dep, webrtc_dep] + common_deps,
link_with: extra_libs,
include_directories: webrtc_inc,
c_args: common_cflags,
cpp_args: common_cxxflags,
soversion: soversion,
install: true
)
webrtc_audio_processing_dep = declare_dependency(
link_with: libwebrtc_audio_processing,
include_directories: webrtc_inc,
version: meson.project_version()
)
interface_headers = [
'module_common_types.h',
]
install_headers(interface_headers,
subdir: 'webrtc_audio_processing/webrtc/modules/interface'
)
subdir('audio_coding')
subdir('audio_processing')
subdir('interface')
system_wrappers_sources = [
'source/aligned_malloc.cc',
'source/cpu_features.cc',
'source/event.cc',
'source/file_impl.cc',
'source/critical_section.cc',
'source/logging.cc',
'source/metrics_default.cc',
'source/rw_lock.cc',
'source/sleep.cc',
'source/thread.cc',
'source/trace_impl.cc',
]
if have_posix
system_wrappers_sources += [
'source/critical_section_posix.cc',
'source/event_timer_posix.cc',
'source/rw_lock_posix.cc',
'source/thread_posix.cc',
'source/trace_posix.cc',
]
endif
if have_win
system_wrappers_sources += [
'source/critical_section_win.cc',
'source/condition_variable.cc',
'source/condition_variable_event_win.cc',
'source/condition_variable_native_win.cc',
'source/event_timer_win.cc',
'source/rw_lock_win.cc',
'source/rw_lock_generic.cc',
'source/thread_win.cc',
'source/trace_win.cc',
]
endif
system_headers = [
'include/trace.h',
]
install_headers(system_headers,
subdir: 'webrtc_audio_processing/webrtc/system_wrappers/include'
)
libsystem_wrappers = static_library('system_wrappers',
system_wrappers_sources,
dependencies: common_deps,
include_directories: webrtc_inc,
c_args : common_cflags,
cpp_args : common_cxxflags
)
system_wrappers_dep = declare_dependency(
link_with: libsystem_wrappers
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment