1# Copyright (c) 2012 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5{
6  'variables': {
7    'conditions': [
8      ['target_arch=="arm" or target_arch=="armv7" or target_arch=="arm64"', {
9        'use_opus_fixed_point%': 1,
10      }, {
11        'use_opus_fixed_point%': 0,
12      }],
13      ['target_arch=="arm" or target_arch=="armv7"', {
14        'use_opus_arm_optimization%': 1,
15      }, {
16        'use_opus_arm_optimization%': 0,
17      }],
18      ['target_arch=="arm"', {
19        'use_opus_rtcd%': 1,
20      }, {
21        'use_opus_rtcd%': 0,
22      }],
23    ],
24  },
25  'targets': [
26    {
27      'target_name': 'opus',
28      'type': 'static_library',
29      'defines': [
30        'OPUS_BUILD',
31        'OPUS_EXPORT=',
32      ],
33      'include_dirs': [
34        'src/celt',
35        'src/include',
36        'src/silk',
37      ],
38      'direct_dependent_settings': {
39        'include_dirs': [
40          'src/include',
41        ],
42      },
43      'includes': ['opus_srcs.gypi', ],
44      'sources': ['<@(opus_common_sources)'],
45      'conditions': [
46        ['OS!="win"', {
47          'defines': [
48            'HAVE_LRINT',
49            'HAVE_LRINTF',
50            'VAR_ARRAYS',
51          ],
52        }, {
53          'defines': [
54            'USE_ALLOCA',
55            'inline=__inline',
56          ],
57          'msvs_disabled_warnings': [
58            4305,  # Disable truncation warning in celt/pitch.c .
59            4334,  # Disable 32-bit shift warning in src/opus_encoder.c .
60          ],
61        }],
62        ['os_posix==1', {
63          'link_settings': {
64            'libraries': [ '-lm' ],
65          },
66        }],
67        ['os_posix==1 and OS!="android"', {
68          # Suppress a warning given by opus_decoder.c that tells us
69          # optimizations are turned off.
70          'cflags': [
71            '-Wno-#pragma-messages',
72          ],
73          'xcode_settings': {
74            'WARNING_CFLAGS': [
75              '-Wno-#pragma-messages',
76            ],
77          },
78        }],
79        ['os_posix==1 and (target_arch=="arm" or target_arch=="armv7" or target_arch=="arm64")', {
80          'cflags!': ['-Os'],
81          'cflags': ['-O3'],
82        }],
83        ['use_opus_fixed_point==0', {
84          'include_dirs': [
85            'src/silk/float',
86          ],
87          'sources': ['<@(opus_float_sources)'],
88        }, {
89          'defines': [
90            'FIXED_POINT',
91          ],
92          'include_dirs': [
93            'src/silk/fixed',
94          ],
95          'sources': ['<@(opus_fixed_sources)'],
96          'conditions': [
97            ['use_opus_arm_optimization==1', {
98              'defines': [
99                'OPUS_ARM_ASM',
100                'OPUS_ARM_INLINE_ASM',
101                'OPUS_ARM_INLINE_EDSP',
102              ],
103              'includes': [
104                'opus_srcs_arm.gypi',
105              ],
106              'conditions': [
107                ['use_opus_rtcd==1', {
108                  'defines': [
109                    'OPUS_ARM_MAY_HAVE_EDSP',
110                    'OPUS_ARM_MAY_HAVE_MEDIA',
111                    'OPUS_ARM_MAY_HAVE_NEON',
112                    'OPUS_HAVE_RTCD',
113                  ],
114                  'includes': [
115                    'opus_srcs_rtcd.gypi',
116                  ],
117                }],
118              ],
119            }],
120          ],
121        }],
122      ],
123    },  # target opus
124    {
125      'target_name': 'opus_demo',
126      'type': 'executable',
127      'dependencies': [
128        'opus'
129      ],
130      'conditions': [
131        ['OS == "win"', {
132          'defines': [
133            'inline=__inline',
134          ],
135        }],
136        ['OS=="android"', {
137          'link_settings': {
138            'libraries': [
139              '-llog',
140            ],
141          },
142        }],
143        ['clang==1', {
144          'cflags': [ '-Wno-absolute-value' ],
145        }]
146      ],
147      'sources': [
148        'src/src/opus_demo.c',
149      ],
150      'include_dirs': [
151        'src/celt',
152        'src/silk',
153      ],
154    },  # target opus_demo
155  ]
156}
157