• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2011 The LibYuv 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    'libyuv.gypi',
12  ],
13  # Make sure that if we are being compiled to an xcodeproj, nothing tries to
14  # include a .pch.
15  'xcode_settings': {
16    'GCC_PREFIX_HEADER': '',
17    'GCC_PRECOMPILE_PREFIX_HEADER': 'NO',
18  },
19  'variables': {
20    'use_system_libjpeg%': 0,
21    # Can be enabled if your jpeg has GYP support.
22    'libyuv_disable_jpeg%': 1,
23    # 'chromium_code' treats libyuv as internal and increases warning level.
24    'chromium_code': 1,
25    # clang compiler default variable usable by other apps that include libyuv.
26    'clang%': 0,
27    # Link-Time Optimizations.
28    'use_lto%': 0,
29    'mips_msa%': 0,  # Default to msa off.
30    'build_neon': 0,
31    'build_msa': 0,
32    'conditions': [
33       ['(target_arch == "armv7" or target_arch == "armv7s" or \
34       (target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\
35       and (arm_neon == 1 or arm_neon_optional == 1)', {
36         'build_neon': 1,
37       }],
38       ['(target_arch == "mipsel" or target_arch == "mips64el")\
39       and (mips_msa == 1)',
40       {
41         'build_msa': 1,
42       }],
43    ],
44  },
45
46  'targets': [
47    {
48      'target_name': 'libyuv',
49      # Change type to 'shared_library' to build .so or .dll files.
50      'type': 'static_library',
51      'variables': {
52        'optimize': 'max',  # enable O2 and ltcg.
53      },
54      # Allows libyuv.a redistributable library without external dependencies.
55      'standalone_static_library': 1,
56      'conditions': [
57       # Disable -Wunused-parameter
58        ['clang == 1', {
59          'cflags': [
60            '-Wno-unused-parameter',
61         ],
62        }],
63        ['build_neon != 0', {
64          'defines': [
65            'LIBYUV_NEON',
66          ],
67          'cflags!': [
68            '-mfpu=vfp',
69            '-mfpu=vfpv3',
70            '-mfpu=vfpv3-d16',
71            # '-mthumb',  # arm32 not thumb
72          ],
73          'conditions': [
74            # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug.
75            ['clang == 0 and use_lto == 1', {
76              'cflags!': [
77                '-flto',
78                '-ffat-lto-objects',
79              ],
80            }],
81            # arm64 does not need -mfpu=neon option as neon is not optional
82            ['target_arch != "arm64"', {
83              'cflags': [
84                '-mfpu=neon',
85                # '-marm',  # arm32 not thumb
86              ],
87            }],
88          ],
89        }],
90        ['build_msa != 0', {
91          'defines': [
92            'LIBYUV_MSA',
93          ],
94        }],
95        ['OS != "ios" and libyuv_disable_jpeg != 1', {
96          'defines': [
97            'HAVE_JPEG'
98          ],
99          'conditions': [
100            # Caveat system jpeg support may not support motion jpeg
101            [ 'use_system_libjpeg == 1', {
102              'dependencies': [
103                 '<(DEPTH)/third_party/libjpeg/libjpeg.gyp:libjpeg',
104              ],
105            }, {
106              'dependencies': [
107                 '<(DEPTH)/third_party/libjpeg_turbo/libjpeg.gyp:libjpeg',
108              ],
109            }],
110            [ 'use_system_libjpeg == 1', {
111              'link_settings': {
112                'libraries': [
113                  '-ljpeg',
114                ],
115              }
116            }],
117          ],
118        }],
119      ], #conditions
120      'defines': [
121        # Enable the following 3 macros to turn off assembly for specified CPU.
122        # 'LIBYUV_DISABLE_X86',
123        # 'LIBYUV_DISABLE_NEON',
124        # 'LIBYUV_DISABLE_DSPR2',
125        # Enable the following macro to build libyuv as a shared library (dll).
126        # 'LIBYUV_USING_SHARED_LIBRARY',
127        # TODO(fbarchard): Make these into gyp defines.
128      ],
129      'include_dirs': [
130        'include',
131        '.',
132      ],
133      'direct_dependent_settings': {
134        'include_dirs': [
135          'include',
136          '.',
137        ],
138        'conditions': [
139          ['OS == "android" and target_arch == "arm64"', {
140            'ldflags': [
141              '-Wl,--dynamic-linker,/system/bin/linker64',
142            ],
143          }],
144          ['OS == "android" and target_arch != "arm64"', {
145            'ldflags': [
146              '-Wl,--dynamic-linker,/system/bin/linker',
147            ],
148          }],
149        ], #conditions
150      },
151      'sources': [
152        '<@(libyuv_sources)',
153      ],
154    },
155  ], # targets.
156}
157
158# Local Variables:
159# tab-width:2
160# indent-tabs-mode:nil
161# End:
162# vim: set expandtab tabstop=2 shiftwidth=2:
163