1# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS.  All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9{
10  'includes': [
11    '../build/common.gypi',
12  ],
13  'targets': [
14    {
15      'target_name': 'common_audio',
16      'type': 'static_library',
17      'dependencies': [
18        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
19      ],
20      'include_dirs': [
21        'resampler/include',
22        'signal_processing/include',
23      ],
24      'direct_dependent_settings': {
25        'include_dirs': [
26          'resampler/include',
27          'signal_processing/include',
28          'vad/include',
29        ],
30      },
31      'sources': [
32        'audio_converter.cc',
33        'audio_converter.h',
34        'audio_ring_buffer.cc',
35        'audio_ring_buffer.h',
36        'audio_util.cc',
37        'blocker.cc',
38        'blocker.h',
39        'channel_buffer.cc',
40        'channel_buffer.h',
41        'fft4g.c',
42        'fft4g.h',
43        'fir_filter.cc',
44        'fir_filter.h',
45        'fir_filter_neon.h',
46        'fir_filter_sse.h',
47        'include/audio_util.h',
48        'lapped_transform.cc',
49        'lapped_transform.h',
50        'real_fourier.cc',
51        'real_fourier.h',
52        'real_fourier_ooura.cc',
53        'real_fourier_ooura.h',
54        'resampler/include/push_resampler.h',
55        'resampler/include/resampler.h',
56        'resampler/push_resampler.cc',
57        'resampler/push_sinc_resampler.cc',
58        'resampler/push_sinc_resampler.h',
59        'resampler/resampler.cc',
60        'resampler/sinc_resampler.cc',
61        'resampler/sinc_resampler.h',
62        'ring_buffer.c',
63        'ring_buffer.h',
64        'signal_processing/include/real_fft.h',
65        'signal_processing/include/signal_processing_library.h',
66        'signal_processing/include/spl_inl.h',
67        'signal_processing/auto_corr_to_refl_coef.c',
68        'signal_processing/auto_correlation.c',
69        'signal_processing/complex_fft.c',
70        'signal_processing/complex_fft_tables.h',
71        'signal_processing/complex_bit_reverse.c',
72        'signal_processing/copy_set_operations.c',
73        'signal_processing/cross_correlation.c',
74        'signal_processing/division_operations.c',
75        'signal_processing/dot_product_with_scale.c',
76        'signal_processing/downsample_fast.c',
77        'signal_processing/energy.c',
78        'signal_processing/filter_ar.c',
79        'signal_processing/filter_ar_fast_q12.c',
80        'signal_processing/filter_ma_fast_q12.c',
81        'signal_processing/get_hanning_window.c',
82        'signal_processing/get_scaling_square.c',
83        'signal_processing/ilbc_specific_functions.c',
84        'signal_processing/levinson_durbin.c',
85        'signal_processing/lpc_to_refl_coef.c',
86        'signal_processing/min_max_operations.c',
87        'signal_processing/randomization_functions.c',
88        'signal_processing/refl_coef_to_lpc.c',
89        'signal_processing/real_fft.c',
90        'signal_processing/resample.c',
91        'signal_processing/resample_48khz.c',
92        'signal_processing/resample_by_2.c',
93        'signal_processing/resample_by_2_internal.c',
94        'signal_processing/resample_by_2_internal.h',
95        'signal_processing/resample_fractional.c',
96        'signal_processing/spl_init.c',
97        'signal_processing/spl_sqrt.c',
98        'signal_processing/spl_sqrt_floor.c',
99        'signal_processing/splitting_filter.c',
100        'signal_processing/sqrt_of_one_minus_x_squared.c',
101        'signal_processing/vector_scaling_operations.c',
102        'sparse_fir_filter.cc',
103        'sparse_fir_filter.h',
104        'swap_queue.h',
105        'vad/include/vad.h',
106        'vad/include/webrtc_vad.h',
107        'vad/vad.cc',
108        'vad/webrtc_vad.c',
109        'vad/vad_core.c',
110        'vad/vad_core.h',
111        'vad/vad_filterbank.c',
112        'vad/vad_filterbank.h',
113        'vad/vad_gmm.c',
114        'vad/vad_gmm.h',
115        'vad/vad_sp.c',
116        'vad/vad_sp.h',
117        'wav_header.cc',
118        'wav_header.h',
119        'wav_file.cc',
120        'wav_file.h',
121        'window_generator.cc',
122        'window_generator.h',
123      ],
124      'conditions': [
125        ['rtc_use_openmax_dl==1', {
126          'sources': [
127            'real_fourier_openmax.cc',
128            'real_fourier_openmax.h',
129          ],
130          'defines': ['RTC_USE_OPENMAX_DL',],
131          'conditions': [
132            ['build_openmax_dl==1', {
133              'dependencies': ['<(DEPTH)/third_party/openmax_dl/dl/dl.gyp:openmax_dl',],
134            }],
135          ],
136        }],
137        ['target_arch=="ia32" or target_arch=="x64"', {
138          'dependencies': ['common_audio_sse2',],
139        }],
140        ['build_with_neon==1', {
141          'dependencies': ['common_audio_neon',],
142        }],
143        ['target_arch=="arm"', {
144          'sources': [
145            'signal_processing/complex_bit_reverse_arm.S',
146            'signal_processing/spl_sqrt_floor_arm.S',
147          ],
148          'sources!': [
149            'signal_processing/complex_bit_reverse.c',
150            'signal_processing/spl_sqrt_floor.c',
151          ],
152          'conditions': [
153            ['arm_version>=7', {
154              'sources': [
155                'signal_processing/filter_ar_fast_q12_armv7.S',
156              ],
157              'sources!': [
158                'signal_processing/filter_ar_fast_q12.c',
159              ],
160            }],
161          ],  # conditions
162        }],
163        ['target_arch=="mipsel" and mips_arch_variant!="r6"', {
164          'sources': [
165            'signal_processing/include/spl_inl_mips.h',
166            'signal_processing/complex_bit_reverse_mips.c',
167            'signal_processing/complex_fft_mips.c',
168            'signal_processing/cross_correlation_mips.c',
169            'signal_processing/downsample_fast_mips.c',
170            'signal_processing/filter_ar_fast_q12_mips.c',
171            'signal_processing/min_max_operations_mips.c',
172            'signal_processing/resample_by_2_mips.c',
173            'signal_processing/spl_sqrt_floor_mips.c',
174          ],
175          'sources!': [
176            'signal_processing/complex_bit_reverse.c',
177            'signal_processing/complex_fft.c',
178            'signal_processing/filter_ar_fast_q12.c',
179            'signal_processing/spl_sqrt_floor.c',
180          ],
181          'conditions': [
182            ['mips_dsp_rev>0', {
183              'sources': [
184                'signal_processing/vector_scaling_operations_mips.c',
185              ],
186            }],
187          ],
188        }],
189      ],  # conditions
190      # Ignore warning on shift operator promotion.
191      'msvs_disabled_warnings': [ 4334, ],
192    },
193  ],  # targets
194  'conditions': [
195    ['target_arch=="ia32" or target_arch=="x64"', {
196      'targets': [
197        {
198          'target_name': 'common_audio_sse2',
199          'type': 'static_library',
200          'sources': [
201            'fir_filter_sse.cc',
202            'resampler/sinc_resampler_sse.cc',
203          ],
204          'conditions': [
205            ['os_posix==1', {
206              'cflags': [ '-msse2', ],
207              'xcode_settings': {
208                'OTHER_CFLAGS': [ '-msse2', ],
209              },
210            }],
211          ],
212        },
213      ],  # targets
214    }],
215    ['build_with_neon==1', {
216      'targets': [
217        {
218          'target_name': 'common_audio_neon',
219          'type': 'static_library',
220          'includes': ['../build/arm_neon.gypi',],
221          'sources': [
222            'fir_filter_neon.cc',
223            'resampler/sinc_resampler_neon.cc',
224            'signal_processing/cross_correlation_neon.c',
225            'signal_processing/downsample_fast_neon.c',
226            'signal_processing/min_max_operations_neon.c',
227          ],
228        },
229      ],  # targets
230    }],
231    ['include_tests==1 and OS!="ios"', {
232      'targets' : [
233        {
234          # Does not compile on iOS: webrtc:4755.
235          'target_name': 'common_audio_unittests',
236          'type': '<(gtest_target_type)',
237          'dependencies': [
238            'common_audio',
239            '<(webrtc_root)/test/test.gyp:test_support_main',
240            '<(DEPTH)/testing/gmock.gyp:gmock',
241            '<(DEPTH)/testing/gtest.gyp:gtest',
242          ],
243          'sources': [
244            'audio_converter_unittest.cc',
245            'audio_ring_buffer_unittest.cc',
246            'audio_util_unittest.cc',
247            'blocker_unittest.cc',
248            'fir_filter_unittest.cc',
249            'lapped_transform_unittest.cc',
250            'real_fourier_unittest.cc',
251            'resampler/resampler_unittest.cc',
252            'resampler/push_resampler_unittest.cc',
253            'resampler/push_sinc_resampler_unittest.cc',
254            'resampler/sinc_resampler_unittest.cc',
255            'resampler/sinusoidal_linear_chirp_source.cc',
256            'resampler/sinusoidal_linear_chirp_source.h',
257            'ring_buffer_unittest.cc',
258            'signal_processing/real_fft_unittest.cc',
259            'signal_processing/signal_processing_unittest.cc',
260            'sparse_fir_filter_unittest.cc',
261            'swap_queue_unittest.cc',
262            'vad/vad_core_unittest.cc',
263            'vad/vad_filterbank_unittest.cc',
264            'vad/vad_gmm_unittest.cc',
265            'vad/vad_sp_unittest.cc',
266            'vad/vad_unittest.cc',
267            'vad/vad_unittest.h',
268            'wav_header_unittest.cc',
269            'wav_file_unittest.cc',
270            'window_generator_unittest.cc',
271          ],
272          'conditions': [
273            ['rtc_use_openmax_dl==1', {
274              'defines': ['RTC_USE_OPENMAX_DL',],
275            }],
276            ['OS=="android"', {
277              'dependencies': [
278                '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
279              ],
280            }],
281          ],
282        },
283      ],  # targets
284      'conditions': [
285        ['OS=="android"', {
286          'targets': [
287            {
288              'target_name': 'common_audio_unittests_apk_target',
289              'type': 'none',
290              'dependencies': [
291                '<(apk_tests_path):common_audio_unittests_apk',
292              ],
293            },
294          ],
295        }],
296        ['test_isolation_mode != "noop"', {
297          'targets': [
298            {
299              'target_name': 'common_audio_unittests_run',
300              'type': 'none',
301              'dependencies': [
302                'common_audio_unittests',
303              ],
304              'includes': [
305                '../build/isolate.gypi',
306              ],
307              'sources': [
308                'common_audio_unittests.isolate',
309              ],
310            },
311          ],
312        }],
313      ],
314    }],
315  ],  # conditions
316}
317