project(webrtc)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

list(APPEND WEBRTC_C_SOURCE_FILES
	"modules/third_party/fft/fft.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_estimator.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.c"
	"modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c"
	"modules/audio_coding/codecs/isac/main/source/filterbanks.c"
	"modules/audio_coding/codecs/isac/main/source/transform.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_filter.c"
	"modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c"
	"modules/audio_coding/codecs/isac/main/source/filter_functions.c"
	"modules/audio_coding/codecs/isac/main/source/decode.c"
	"modules/audio_coding/codecs/isac/main/source/lattice.c"
	"modules/audio_coding/codecs/isac/main/source/intialize.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_tables.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.c"
	"modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c"
	"modules/audio_coding/codecs/isac/main/source/encode.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_analysis.c"
	"modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c"
	"modules/audio_coding/codecs/isac/main/source/entropy_coding.c"
	"modules/audio_coding/codecs/isac/main/source/isac_vad.c"
	"modules/audio_coding/codecs/isac/main/source/arith_routines.c"
	"modules/audio_coding/codecs/isac/main/source/crc.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.c"
	"modules/audio_coding/codecs/isac/main/source/decode_bwe.c"
	"modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.c"
	"modules/audio_coding/codecs/isac/main/source/isac.c"
	"modules/audio_processing/ns/nsx_core.c"
	"modules/audio_processing/ns/noise_suppression_x.c"
	"modules/audio_processing/ns/nsx_core_c.c"
	"modules/audio_processing/ns/ns_core.c"
	"modules/audio_processing/ns/noise_suppression.c"
	"modules/audio_processing/agc/legacy/analog_agc.c"
	"modules/audio_processing/agc/legacy/digital_agc.c"
	"common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
	"common_audio/third_party/fft4g/fft4g.c"
	"common_audio/ring_buffer.c"
	"common_audio/signal_processing/complex_fft.c"
	"common_audio/signal_processing/filter_ma_fast_q12.c"
	"common_audio/signal_processing/levinson_durbin.c"
	"common_audio/signal_processing/auto_corr_to_refl_coef.c"
	"common_audio/signal_processing/resample_by_2_internal.c"
	"common_audio/signal_processing/energy.c"
	"common_audio/signal_processing/sqrt_of_one_minus_x_squared.c"
	"common_audio/signal_processing/downsample_fast.c"
	"common_audio/signal_processing/splitting_filter1.c"
	"common_audio/signal_processing/filter_ar_fast_q12.c"
	"common_audio/signal_processing/spl_init.c"
	"common_audio/signal_processing/lpc_to_refl_coef.c"
	"common_audio/signal_processing/cross_correlation.c"
	"common_audio/signal_processing/division_operations.c"
	"common_audio/signal_processing/auto_correlation.c"
	"common_audio/signal_processing/get_scaling_square.c"
	"common_audio/signal_processing/resample.c"
	"common_audio/signal_processing/min_max_operations.c"
	"common_audio/signal_processing/refl_coef_to_lpc.c"
	"common_audio/signal_processing/filter_ar.c"
	"common_audio/signal_processing/vector_scaling_operations.c"
	"common_audio/signal_processing/resample_fractional.c"
	"common_audio/signal_processing/real_fft.c"
	"common_audio/signal_processing/ilbc_specific_functions.c"
	"common_audio/signal_processing/complex_bit_reverse.c"
	"common_audio/signal_processing/randomization_functions.c"
	"common_audio/signal_processing/copy_set_operations.c"
	"common_audio/signal_processing/resample_by_2.c"
	"common_audio/signal_processing/get_hanning_window.c"
	"common_audio/signal_processing/resample_48khz.c"
	"common_audio/signal_processing/spl_inl.c"
	"common_audio/signal_processing/spl_sqrt.c"
	"common_audio/vad/vad_sp.c"
	"common_audio/vad/webrtc_vad.c"
	"common_audio/vad/vad_filterbank.c"
	"common_audio/vad/vad_core.c"
	"common_audio/vad/vad_gmm.c"
)

list(APPEND WEBRTC_CXX_SOURCE_FILES
	"system_wrappers/source/field_trial.cc"
	"system_wrappers/source/metrics.cc"
	"system_wrappers/source/cpu_features.cc"
	"absl/strings/internal/memutil.cc"
	"absl/strings/string_view.cc"
	"absl/strings/ascii.cc"
	"absl/types/bad_optional_access.cc"
	"absl/types/optional.cc"
	"absl/base/internal/raw_logging.cc"
	"absl/base/internal/throw_delegate.cc"
	"rtc_base/race_checker.cc"
	"rtc_base/strings/string_builder.cc"
	"rtc_base/memory/aligned_malloc.cc"
	"rtc_base/timeutils.cc"
	"rtc_base/platform_file.cc"
	"rtc_base/string_to_number.cc"
	"rtc_base/thread_checker_impl.cc"
	"rtc_base/stringencode.cc"
	"rtc_base/stringutils.cc"
	"rtc_base/checks.cc"
	"rtc_base/platform_thread.cc"
	"rtc_base/criticalsection.cc"
	"rtc_base/platform_thread_types.cc"
	"rtc_base/event.cc"
	"rtc_base/event_tracer.cc"
	"rtc_base/logging_webrtc.cc"
	"third_party/rnnoise/src/rnn_vad_weights.cc"
	"third_party/rnnoise/src/kiss_fft.cc"
	"api/audio/audio_frame.cc"
	"api/audio/echo_canceller3_config.cc"
	"api/audio/echo_canceller3_factory.cc"
	"modules/third_party/fft/fft.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_estimator.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.c"
	"modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c"
	"modules/audio_coding/codecs/isac/main/source/filterbanks.c"
	"modules/audio_coding/codecs/isac/main/source/transform.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_filter.c"
	"modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c"
	"modules/audio_coding/codecs/isac/main/source/filter_functions.c"
	"modules/audio_coding/codecs/isac/main/source/decode.c"
	"modules/audio_coding/codecs/isac/main/source/lattice.c"
	"modules/audio_coding/codecs/isac/main/source/intialize.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_tables.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.c"
	"modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c"
	"modules/audio_coding/codecs/isac/main/source/encode.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_analysis.c"
	"modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c"
	"modules/audio_coding/codecs/isac/main/source/entropy_coding.c"
	"modules/audio_coding/codecs/isac/main/source/isac_vad.c"
	"modules/audio_coding/codecs/isac/main/source/arith_routines.c"
	"modules/audio_coding/codecs/isac/main/source/crc.c"
	"modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.c"
	"modules/audio_coding/codecs/isac/main/source/decode_bwe.c"
	"modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.c"
	"modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.c"
	"modules/audio_coding/codecs/isac/main/source/isac.c"
	"modules/audio_processing/rms_level.cc"
	"modules/audio_processing/echo_detector/normalized_covariance_estimator.cc"
	"modules/audio_processing/echo_detector/moving_max.cc"
	"modules/audio_processing/echo_detector/circular_buffer.cc"
	"modules/audio_processing/echo_detector/mean_variance_estimator.cc"
	"modules/audio_processing/splitting_filter.cc"
	"modules/audio_processing/gain_control_impl.cc"
	"modules/audio_processing/ns/nsx_core.c"
	"modules/audio_processing/ns/noise_suppression_x.c"
	"modules/audio_processing/ns/nsx_core_c.c"
	"modules/audio_processing/ns/ns_core.c"
	"modules/audio_processing/ns/noise_suppression.c"
	"modules/audio_processing/audio_buffer.cc"
	"modules/audio_processing/typing_detection.cc"
	"modules/audio_processing/include/audio_processing_statistics.cc"
	"modules/audio_processing/include/audio_generator_factory.cc"
	"modules/audio_processing/include/aec_dump.cc"
	"modules/audio_processing/include/audio_processing.cc"
	"modules/audio_processing/include/config.cc"
	"modules/audio_processing/agc2/interpolated_gain_curve.cc"
	"modules/audio_processing/agc2/agc2_common.cc"
	"modules/audio_processing/agc2/gain_applier.cc"
	"modules/audio_processing/agc2/adaptive_agc.cc"
	"modules/audio_processing/agc2/adaptive_digital_gain_applier.cc"
	"modules/audio_processing/agc2/limiter.cc"
	"modules/audio_processing/agc2/saturation_protector.cc"
	"modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc"
	"modules/audio_processing/agc2/rnn_vad/rnn.cc"
	"modules/audio_processing/agc2/rnn_vad/pitch_search_internal.cc"
	"modules/audio_processing/agc2/rnn_vad/spectral_features.cc"
	"modules/audio_processing/agc2/rnn_vad/pitch_search.cc"
	"modules/audio_processing/agc2/rnn_vad/features_extraction.cc"
	"modules/audio_processing/agc2/rnn_vad/fft_util.cc"
	"modules/audio_processing/agc2/rnn_vad/lp_residual.cc"
	"modules/audio_processing/agc2/adaptive_mode_level_estimator_agc.cc"
	"modules/audio_processing/agc2/vector_float_frame.cc"
	"modules/audio_processing/agc2/noise_level_estimator.cc"
	"modules/audio_processing/agc2/agc2_testing_common.cc"
	"modules/audio_processing/agc2/fixed_digital_level_estimator.cc"
	"modules/audio_processing/agc2/fixed_gain_controller.cc"
	"modules/audio_processing/agc2/vad_with_level.cc"
	"modules/audio_processing/agc2/limiter_db_gain_curve.cc"
	"modules/audio_processing/agc2/down_sampler.cc"
	"modules/audio_processing/agc2/signal_classifier.cc"
	"modules/audio_processing/agc2/noise_spectrum_estimator.cc"
	"modules/audio_processing/agc2/compute_interpolated_gain_curve.cc"
	"modules/audio_processing/agc2/biquad_filter.cc"
	"modules/audio_processing/agc2/adaptive_mode_level_estimator.cc"
	"modules/audio_processing/transient/moving_moments.cc"
	"modules/audio_processing/transient/wpd_tree.cc"
	"modules/audio_processing/transient/wpd_node.cc"
	"modules/audio_processing/transient/transient_suppressor.cc"
	"modules/audio_processing/transient/transient_detector.cc"
	"modules/audio_processing/low_cut_filter.cc"
	"modules/audio_processing/level_estimator_impl.cc"
	"modules/audio_processing/three_band_filter_bank.cc"
	"modules/audio_processing/aec/echo_cancellation.cc"
	"modules/audio_processing/aec/aec_resampler.cc"
	"modules/audio_processing/aec/aec_core.cc"
	"modules/audio_processing/aec/aec_core_sse2.cc"
	"modules/audio_processing/voice_detection_impl.cc"
	"modules/audio_processing/echo_cancellation_impl.cc"
	"modules/audio_processing/gain_control_for_experimental_agc.cc"
	"modules/audio_processing/agc/agc.cc"
	"modules/audio_processing/agc/loudness_histogram.cc"
	"modules/audio_processing/agc/agc_manager_direct.cc"
	"modules/audio_processing/agc/legacy/analog_agc.c"
	"modules/audio_processing/agc/legacy/digital_agc.c"
	"modules/audio_processing/agc/utility.cc"
	"modules/audio_processing/audio_processing_impl.cc"
	"modules/audio_processing/audio_generator/file_audio_generator.cc"
	"modules/audio_processing/gain_controller2.cc"
	"modules/audio_processing/residual_echo_detector.cc"
	"modules/audio_processing/noise_suppression_impl.cc"
	"modules/audio_processing/aecm/aecm_core.cc"
	"modules/audio_processing/aecm/aecm_core_c.cc"
	"modules/audio_processing/aecm/echo_control_mobile.cc"
	"modules/audio_processing/aec3/render_reverb_model.cc"
	"modules/audio_processing/aec3/reverb_model_fallback.cc"
	"modules/audio_processing/aec3/echo_remover_metrics.cc"
	"modules/audio_processing/aec3/matched_filter_lag_aggregator.cc"
	"modules/audio_processing/aec3/render_delay_buffer2.cc"
	"modules/audio_processing/aec3/echo_path_variability.cc"
	"modules/audio_processing/aec3/frame_blocker.cc"
	"modules/audio_processing/aec3/subtractor.cc"
	"modules/audio_processing/aec3/aec3_fft.cc"
	"modules/audio_processing/aec3/fullband_erle_estimator.cc"
	"modules/audio_processing/aec3/suppression_filter.cc"
	"modules/audio_processing/aec3/block_processor.cc"
	"modules/audio_processing/aec3/subband_erle_estimator.cc"
	"modules/audio_processing/aec3/render_delay_controller_metrics.cc"
	"modules/audio_processing/aec3/render_delay_buffer.cc"
	"modules/audio_processing/aec3/vector_buffer.cc"
	"modules/audio_processing/aec3/erl_estimator.cc"
	"modules/audio_processing/aec3/aec_state.cc"
	"modules/audio_processing/aec3/adaptive_fir_filter.cc"
	"modules/audio_processing/aec3/render_delay_controller.cc"
	"modules/audio_processing/aec3/skew_estimator.cc"
	"modules/audio_processing/aec3/echo_path_delay_estimator.cc"
	"modules/audio_processing/aec3/block_framer.cc"
	"modules/audio_processing/aec3/erle_estimator.cc"
	"modules/audio_processing/aec3/reverb_model.cc"
	"modules/audio_processing/aec3/cascaded_biquad_filter.cc"
	"modules/audio_processing/aec3/render_buffer.cc"
	"modules/audio_processing/aec3/subtractor_output.cc"
	"modules/audio_processing/aec3/stationarity_estimator.cc"
	"modules/audio_processing/aec3/render_signal_analyzer.cc"
	"modules/audio_processing/aec3/subtractor_output_analyzer.cc"
	"modules/audio_processing/aec3/suppression_gain.cc"
	"modules/audio_processing/aec3/echo_audibility.cc"
	"modules/audio_processing/aec3/block_processor_metrics.cc"
	"modules/audio_processing/aec3/moving_average.cc"
	"modules/audio_processing/aec3/reverb_model_estimator.cc"
	"modules/audio_processing/aec3/aec3_common.cc"
	"modules/audio_processing/aec3/residual_echo_estimator.cc"
	"modules/audio_processing/aec3/matched_filter.cc"
	"modules/audio_processing/aec3/reverb_decay_estimator.cc"
	"modules/audio_processing/aec3/render_delay_controller2.cc"
	"modules/audio_processing/aec3/suppression_gain_limiter.cc"
	"modules/audio_processing/aec3/main_filter_update_gain.cc"
	"modules/audio_processing/aec3/echo_remover.cc"
	"modules/audio_processing/aec3/downsampled_render_buffer.cc"
	"modules/audio_processing/aec3/matrix_buffer.cc"
	"modules/audio_processing/aec3/block_processor2.cc"
	"modules/audio_processing/aec3/echo_canceller3.cc"
	"modules/audio_processing/aec3/block_delay_buffer.cc"
	"modules/audio_processing/aec3/fft_buffer.cc"
	"modules/audio_processing/aec3/comfort_noise_generator.cc"
	"modules/audio_processing/aec3/shadow_filter_update_gain.cc"
	"modules/audio_processing/aec3/filter_analyzer.cc"
	"modules/audio_processing/aec3/reverb_frequency_response.cc"
	"modules/audio_processing/aec3/decimator.cc"
	"modules/audio_processing/echo_control_mobile_impl.cc"
	"modules/audio_processing/logging/apm_data_dumper.cc"
	"modules/audio_processing/vad/voice_activity_detector.cc"
	"modules/audio_processing/vad/standalone_vad.cc"
	"modules/audio_processing/vad/pitch_internal.cc"
	"modules/audio_processing/vad/vad_circular_buffer.cc"
	"modules/audio_processing/vad/vad_audio_proc.cc"
	"modules/audio_processing/vad/pole_zero_filter.cc"
	"modules/audio_processing/vad/pitch_based_vad.cc"
	"modules/audio_processing/vad/gmm.cc"
	"modules/audio_processing/utility/ooura_fft.cc"
	"modules/audio_processing/utility/delay_estimator_wrapper.cc"
	"modules/audio_processing/utility/ooura_fft_sse2.cc"
	"modules/audio_processing/utility/delay_estimator.cc"
	"modules/audio_processing/utility/block_mean_calculator.cc"
	"common_audio/window_generator.cc"
	"common_audio/channel_buffer.cc"
	"common_audio/fir_filter_factory.cc"
	"common_audio/wav_header.cc"
	"common_audio/real_fourier_ooura.cc"
	"common_audio/audio_util.cc"
	"common_audio/fir_filter_sse.cc"
	"common_audio/resampler/push_sinc_resampler.cc"
	"common_audio/resampler/resampler.cc"
	"common_audio/resampler/sinc_resampler_sse.cc"
	"common_audio/resampler/push_resampler.cc"
	"common_audio/resampler/sinc_resampler.cc"
	"common_audio/resampler/sinusoidal_linear_chirp_source.cc"
	"common_audio/wav_file.cc"
	"common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
	"common_audio/third_party/fft4g/fft4g.c"
	"common_audio/audio_converter.cc"
	"common_audio/real_fourier.cc"
	"common_audio/sparse_fir_filter.cc"
	"common_audio/smoothing_filter.cc"
	"common_audio/fir_filter_c.cc"
	"common_audio/ring_buffer.c"
	"common_audio/signal_processing/complex_fft.c"
	"common_audio/signal_processing/filter_ma_fast_q12.c"
	"common_audio/signal_processing/levinson_durbin.c"
	"common_audio/signal_processing/dot_product_with_scale.cc"
	"common_audio/signal_processing/auto_corr_to_refl_coef.c"
	"common_audio/signal_processing/resample_by_2_internal.c"
	"common_audio/signal_processing/energy.c"
	"common_audio/signal_processing/sqrt_of_one_minus_x_squared.c"
	"common_audio/signal_processing/downsample_fast.c"
	"common_audio/signal_processing/splitting_filter1.c"
	"common_audio/signal_processing/filter_ar_fast_q12.c"
	"common_audio/signal_processing/spl_init.c"
	"common_audio/signal_processing/lpc_to_refl_coef.c"
	"common_audio/signal_processing/cross_correlation.c"
	"common_audio/signal_processing/division_operations.c"
	"common_audio/signal_processing/auto_correlation.c"
	"common_audio/signal_processing/get_scaling_square.c"
	"common_audio/signal_processing/resample.c"
	"common_audio/signal_processing/min_max_operations.c"
	"common_audio/signal_processing/refl_coef_to_lpc.c"
	"common_audio/signal_processing/filter_ar.c"
	"common_audio/signal_processing/vector_scaling_operations.c"
	"common_audio/signal_processing/resample_fractional.c"
	"common_audio/signal_processing/real_fft.c"
	"common_audio/signal_processing/ilbc_specific_functions.c"
	"common_audio/signal_processing/complex_bit_reverse.c"
	"common_audio/signal_processing/randomization_functions.c"
	"common_audio/signal_processing/copy_set_operations.c"
	"common_audio/signal_processing/resample_by_2.c"
	"common_audio/signal_processing/get_hanning_window.c"
	"common_audio/signal_processing/resample_48khz.c"
	"common_audio/signal_processing/spl_inl.c"
	"common_audio/signal_processing/spl_sqrt.c"
	"common_audio/vad/vad_sp.c"
	"common_audio/vad/vad.cc"
	"common_audio/vad/webrtc_vad.c"
	"common_audio/vad/vad_filterbank.c"
	"common_audio/vad/vad_core.c"
	"common_audio/vad/vad_gmm.c"
)

add_library(${PROJECT_NAME} OBJECT ${WEBRTC_C_SOURCE_FILES} ${WEBRTC_CXX_SOURCE_FILES})

target_compile_definitions(${PROJECT_NAME} PUBLIC
	WEBRTC_APM_DEBUG_DUMP=0
	WEBRTC_POSIX
	WEBRTC_LINUX
	WEBRTC_NS_FLOAT
)

# TODO: drop include dirs with latest webrtc
target_include_directories(${PROJECT_NAME} PUBLIC
	"${CMAKE_CURRENT_LIST_DIR}/.."
)

if( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" )
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
endif( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" )

